summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-05-11 14:09:50 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-05-11 14:09:50 +0000
commit416b127456f4707236448677d8aece70e84b8884 (patch)
treedcf21840d09577bbed1166f9be9f27c09f627518 /clang/lib/Lex
parentd9ff035de8ee5d74d1709abaa44b7bfad24b501b (diff)
downloadbcm5719-llvm-416b127456f4707236448677d8aece70e84b8884.tar.gz
bcm5719-llvm-416b127456f4707236448677d8aece70e84b8884.zip
Disable __has_cpp_attribute when not compiling in C++ mode. As this feature test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute.
This addresses PR23435. llvm-svn: 236996
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 5af0205af37..87a07a43d08 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -283,7 +283,11 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident_Pragma = RegisterBuiltinMacro(*this, "_Pragma");
// C++ Standing Document Extensions.
- Ident__has_cpp_attribute = RegisterBuiltinMacro(*this, "__has_cpp_attribute");
+ if (LangOpts.CPlusPlus)
+ Ident__has_cpp_attribute =
+ RegisterBuiltinMacro(*this, "__has_cpp_attribute");
+ else
+ Ident__has_cpp_attribute = nullptr;
// GCC Extensions.
Ident__BASE_FILE__ = RegisterBuiltinMacro(*this, "__BASE_FILE__");
OpenPOWER on IntegriCloud