diff options
author | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2022-05-03 14:13:56 -0400 |
---|---|---|
committer | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2022-05-10 14:32:27 -0400 |
commit | afc9d674fe5a14b95c50a38d8605a159c2460427 (patch) | |
tree | a003f9a93cf1ccbdc1a273e1c7c8778395872e92 /clang/lib/Basic/IdentifierTable.cpp | |
parent | 0353c2c996c5863463c356de97c9852f9330ed11 (diff) | |
download | llvm-afc9d674fe5a14b95c50a38d8605a159c2460427.zip llvm-afc9d674fe5a14b95c50a38d8605a159c2460427.tar.gz llvm-afc9d674fe5a14b95c50a38d8605a159c2460427.tar.bz2 |
[CUDA][HIP] support __noinline__ as keyword
CUDA/HIP programs use __noinline__ like a keyword e.g.
__noinline__ void foo() {} since __noinline__ is defined
as a macro __attribute__((noinline)) in CUDA/HIP runtime
header files.
However, gcc and clang supports __attribute__((__noinline__))
the same as __attribute__((noinline)). Some C++ libraries
use __attribute__((__noinline__)) in their header files.
When CUDA/HIP programs include such header files,
clang will emit error about invalid attributes.
This patch fixes this issue by supporting __noinline__ as
a keyword, so that CUDA/HIP runtime could remove
the macro definition.
Reviewed by: Aaron Ballman, Artem Belevich
Differential Revision: https://reviews.llvm.org/D124866
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | clang/lib/Basic/IdentifierTable.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index b86cb7a..af19de4 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -108,6 +108,7 @@ namespace { KEYOPENCLCXX = 0x400000, KEYMSCOMPAT = 0x800000, KEYSYCL = 0x1000000, + KEYCUDA = 0x2000000, KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (0x1ffffff & ~KEYNOMS18 & ~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude. @@ -158,6 +159,8 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts, return KS_Future; if (LangOpts.isSYCL() && (Flags & KEYSYCL)) return KS_Enabled; + if (LangOpts.CUDA && (Flags & KEYCUDA)) + return KS_Enabled; return KS_Disabled; } |