diff options
| author | Martin Storsjo <martin@martin.st> | 2019-09-27 12:25:19 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2019-09-27 12:25:19 +0000 |
| commit | 71decf841c7396ad96cf95a9123c2df19a4121f6 (patch) | |
| tree | 8acaf5e33a3aba1a42f0c73f0653ace9c8976c78 /clang/lib/Sema | |
| parent | 5ebab1f8f943e967662dd4ffc843bceb3de2e3d2 (diff) | |
| download | bcm5719-llvm-71decf841c7396ad96cf95a9123c2df19a4121f6.tar.gz bcm5719-llvm-71decf841c7396ad96cf95a9123c2df19a4121f6.zip | |
[clang] [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode
This matches how GCC handles it, see e.g. https://gcc.godbolt.org/z/HPplnl.
GCC documents the gnu_inline attribute with "In C++, this attribute does
not depend on extern in any way, but it still requires the inline keyword
to enable its special behavior."
The previous behaviour of gnu_inline in C++, without the extern
keyword, can be traced back to the original commit that added
support for gnu_inline, SVN r69045.
Differential Revision: https://reviews.llvm.org/D67414
llvm-svn: 373078
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index b69cb5d8433..d31b48c122f 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4255,6 +4255,9 @@ static void handleGNUInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) { return; } + if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != SC_Extern) + S.Diag(AL.getLoc(), diag::warn_gnu_inline_cplusplus_without_extern); + D->addAttr(::new (S.Context) GNUInlineAttr(S.Context, AL)); } |

