[PATCH] D96051: [OpenCL] Support enum and typedef args in TableGen BIFs
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 5 03:48:01 PST 2021
Anastasia added inline comments.
================
Comment at: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl:38
+typedef uint cl_mem_fence_flags;
+#define CLK_GLOBAL_MEM_FENCE 0x02
+
----------------
Should we add this conditionally if the base header is not included?
In the subsequent patches where you will add other functions, we should make sure that the base header indeed contains the declarations we use in tablegen.
================
Comment at: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp:727
+ }
+ return S.Context.getEnumType(Result.getAsSingle<EnumDecl>());
+}
----------------
I think we should add an assert that Result.getAsSingle<EnumDecl>() indeed holds. Consider if instead of using base header the types are defined manually and they are regular integers, not enums.
================
Comment at: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp:739
+ }
+ return S.Context.getTypedefType(Result.getAsSingle<TypedefNameDecl>());
+}
----------------
Same here, let's add an assert.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96051/new/
https://reviews.llvm.org/D96051
More information about the cfe-commits
mailing list