ir: Deal with name conflicts correctly in declaration type resolution.

So, basically, make opaque items last, and make previous names override
them.

Fixes #649
This commit is contained in:
Emilio Cobos Álvarez
2021-01-26 12:41:58 +01:00
parent c47ee1516b
commit 750745831a
15 changed files with 260 additions and 38 deletions
@@ -0,0 +1,16 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType {
Buffer = 0,
NotBuffer = 1,
};
typedef uint32_t BindingType;
typedef struct BindGroupLayoutEntry {
BindingType ty;
} BindGroupLayoutEntry;
void root(struct BindGroupLayoutEntry entry);
@@ -0,0 +1,30 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
{
Buffer = 0,
NotBuffer = 1,
};
#ifndef __cplusplus
typedef uint32_t BindingType;
#endif // __cplusplus
typedef struct BindGroupLayoutEntry {
BindingType ty;
} BindGroupLayoutEntry;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct BindGroupLayoutEntry entry);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
@@ -0,0 +1,16 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType {
Buffer = 0,
NotBuffer = 1,
};
typedef uint32_t BindingType;
typedef struct {
BindingType ty;
} BindGroupLayoutEntry;
void root(BindGroupLayoutEntry entry);
@@ -0,0 +1,30 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
{
Buffer = 0,
NotBuffer = 1,
};
#ifndef __cplusplus
typedef uint32_t BindingType;
#endif // __cplusplus
typedef struct {
BindingType ty;
} BindGroupLayoutEntry;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(BindGroupLayoutEntry entry);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
@@ -0,0 +1,20 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
enum class BindingType : uint32_t {
Buffer = 0,
NotBuffer = 1,
};
struct BindGroupLayoutEntry {
BindingType ty;
};
extern "C" {
void root(BindGroupLayoutEntry entry);
} // extern "C"
@@ -0,0 +1,17 @@
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef enum:
Buffer # = 0,
NotBuffer # = 1,
ctypedef uint32_t BindingType;
ctypedef struct BindGroupLayoutEntry:
BindingType ty;
void root(BindGroupLayoutEntry entry);
@@ -0,0 +1,16 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType {
Buffer = 0,
NotBuffer = 1,
};
typedef uint32_t BindingType;
struct BindGroupLayoutEntry {
BindingType ty;
};
void root(struct BindGroupLayoutEntry entry);
@@ -0,0 +1,30 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
enum BindingType
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
{
Buffer = 0,
NotBuffer = 1,
};
#ifndef __cplusplus
typedef uint32_t BindingType;
#endif // __cplusplus
struct BindGroupLayoutEntry {
BindingType ty;
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct BindGroupLayoutEntry entry);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
@@ -0,0 +1,17 @@
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef enum:
Buffer # = 0,
NotBuffer # = 1,
ctypedef uint32_t BindingType;
cdef struct BindGroupLayoutEntry:
BindingType ty;
void root(BindGroupLayoutEntry entry);
+14
View File
@@ -0,0 +1,14 @@
mod uhoh {
enum BindingType { Buffer, NotBuffer }
}
#[repr(u32)]
pub enum BindingType { Buffer = 0, NotBuffer = 1 }
#[repr(C)]
pub struct BindGroupLayoutEntry {
pub ty: BindingType, // This is the repr(u32) enum
}
#[no_mangle]
pub extern "C" fn root(entry: BindGroupLayoutEntry) {}