[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 11:27:48 PDT 2022


yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a reviewer: aaron.ballman.
Herald added subscribers: mattd, carlosgalvezp, dexonsmith.
Herald added a project: All.
yaxunl requested review of this revision.

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.


https://reviews.llvm.org/D124866

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Parse/Parser.h
  clang/lib/Basic/IdentifierTable.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/test/CodeGenCUDA/noinline.cu
  clang/test/SemaCUDA/noinline.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124866.426787.patch
Type: text/x-patch
Size: 5172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220503/5fcb9e3b/attachment-0001.bin>


More information about the cfe-commits mailing list