[PATCH] D67414: [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 13:48:18 PDT 2019


mstorsjo marked 2 inline comments as done.
mstorsjo added inline comments.


================
Comment at: lib/AST/Decl.cpp:3283
 
   if (Context.getLangOpts().CPlusPlus)
     return false;
----------------
nickdesaulniers wrote:
> I would have thought the existing case here would handle your change.  If it doesn't, why not?  Should your change also remove this (essentially moving it earlier)?
With the `gnu_inline` attribute on a function, the block above can end up returning `FoundBody = true`.

So yes, I guess one would get the same effect by just moving the existing if statement up past the gnu inline block.


================
Comment at: lib/AST/Decl.cpp:3381
   // The rest of this function is C-only.
   assert(!Context.getLangOpts().CPlusPlus &&
          "should not use C inline rules in C++");
----------------
nickdesaulniers wrote:
> Ditto.
Hmm, if moved above, I guess we should convert the assert to a plain `if (CPlusPlus) return false;` instead?


Repository:
  rC Clang

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

https://reviews.llvm.org/D67414





More information about the cfe-commits mailing list