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

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 11:06:11 PST 2022


xbolva00 added inline comments.


================
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}}
+}
----------------
aaron.ballman wrote:
> xbolva00 wrote:
> > aaron.ballman wrote:
> > > 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.)
> > ```
> > __attribute__((noinline)) bar(); 
> > ```
> > 
> > is not diagnosed, as "// The Clang spelling implies GNU<name>, CXX11<"clang", name>, and optionally," :[] Not sure if this could be easily fixed.
> That's what I suspected -- I think we should diagnose this case.
> 
> I think I had my idea backwards in Attr.td. We should use `GCC<"noinline">` as the spelling, and add `CXX11<"clang", "noinline">` and `C2x<"clang", "noinline">`; then the GNU spelling is associated with GCC. Then you can change the accessor for the attribute and that should fix this issue.
Ok, it is possible to swap Spellings to handle it as well.


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

https://reviews.llvm.org/D119061



More information about the cfe-commits mailing list