[PATCH] D137251: [clang][cuda/hip] Allow `__noinline__` lambdas

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 10:31:59 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some very minor nits.



================
Comment at: clang/docs/ReleaseNotes.rst:618
 
+ - Allow the use of `__noinline__` as a keyword (instead of `__attribute__((noinline))`)
+   in lambda declarations.
----------------



================
Comment at: clang/docs/ReleaseNotes.rst:757-758
   operator.
-- ``clang_Cursor_getNumTemplateArguments``, ``clang_Cursor_getTemplateArgumentKind``, 
-  ``clang_Cursor_getTemplateArgumentType``, ``clang_Cursor_getTemplateArgumentValue`` and 
+- ``clang_Cursor_getNumTemplateArguments``, ``clang_Cursor_getTemplateArgumentKind``,
+  ``clang_Cursor_getTemplateArgumentType``, ``clang_Cursor_getTemplateArgumentValue`` and
   ``clang_Cursor_getTemplateArgumentUnsignedValue`` now work on struct, class,
----------------
Unrelated whitespace changes that can be rolled back.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1300
+        ParseGNUAttributes(Attr, nullptr, &D);
+      } else if (Tok.is(tok::kw___noinline__)) {
+        IdentifierInfo *AttrName = Tok.getIdentifierInfo();
----------------
yaxunl wrote:
> Pierre-vh wrote:
> > aaron.ballman wrote:
> > > Any other keyword attributes that are missing?
> > > 
> > > `alignas`/`_Alignas`
> > > `__forceinline`
> > > `__cdecl`/`__stdcall`/etc
> > > 
> > I'm not too familiar with how those attributes work yet, so maybe there's more to handle but I don't have any concrete example of it being an issue and would rather not touch those unless needed
> CUDA only allows `__attribute__` for lambda. `__noinline__` used to be an attribute. That's why people use it with lambda. I don't think people use other keywords with lambda.
> CUDA only allows __attribute__ for lambda. __noinline__ used to be an attribute. That's why people use it with lambda. I don't think people use other keywords with lambda.

Ahhh, thank you, that helps!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137251/new/

https://reviews.llvm.org/D137251



More information about the cfe-commits mailing list