[PATCH] D119061: [Clang] noinline call site attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 10:39:20 PST 2022


aaron.ballman added a comment.

Also, it looks like there are some clang-format nits that can be addressed.



================
Comment at: clang/include/clang/Basic/AttrDocs.td:525
+
+``noinline`` attribute can also be used as a Clang-specific statement attribute.
+If a statement is marked ``noinline`` and contains calls, those calls inside the
----------------
Maybe we should also say "Only the [[clang::noinline]] spelling can be used as a statement attribute; other spellings of the attribute are not supported on statements." or something to that effect. WDYT?

Adding some code examples to clarify would also not go amiss.


================
Comment at: clang/test/Sema/attr-noinline.cpp:23
+
+  [[gnu::noinline]] bar(); // expected-warning {{'noinline' attribute is ignored in statements as it only applies to functions}}
+}
----------------
It might be nice to clarify the diagnostic; it's not that `noinline` attribute is ignored always, it's that `[[gnu::noinline]]` and `__attribute__((noinline))` are ignored specifically.

Can you add one more test case for:
```
__attribute__((noinline)) bar();
```
(I would expect this to also diagnose.)


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

https://reviews.llvm.org/D119061



More information about the cfe-commits mailing list