summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-12-05 15:05:29 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-12-05 15:05:29 +0000
commit3c0f9b4a7d0b26f23ea2227d6c58cec00d9c3459 (patch)
treecb393a6376af6a750966d80ae4955bb78a17a1c3 /clang/lib
parent892855250046f0ae7b864f3e4cbfc30421ed84be (diff)
downloadbcm5719-llvm-3c0f9b4a7d0b26f23ea2227d6c58cec00d9c3459.tar.gz
bcm5719-llvm-3c0f9b4a7d0b26f23ea2227d6c58cec00d9c3459.zip
Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute.
llvm-svn: 223467
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 37460f5e0fc..26cf5439e7a 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -118,6 +118,7 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident__has_extension = RegisterBuiltinMacro(*this, "__has_extension");
Ident__has_builtin = RegisterBuiltinMacro(*this, "__has_builtin");
Ident__has_attribute = RegisterBuiltinMacro(*this, "__has_attribute");
+ Ident__has_declspec = RegisterBuiltinMacro(*this, "__has_declspec_attribute");
Ident__has_include = RegisterBuiltinMacro(*this, "__has_include");
Ident__has_include_next = RegisterBuiltinMacro(*this, "__has_include_next");
Ident__has_warning = RegisterBuiltinMacro(*this, "__has_warning");
@@ -1381,6 +1382,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
II == Ident__has_builtin ||
II == Ident__is_identifier ||
II == Ident__has_attribute ||
+ II == Ident__has_declspec ||
II == Ident__has_cpp_attribute) {
// The argument to these builtins should be a parenthesized identifier.
SourceLocation StartLoc = Tok.getLocation();
@@ -1428,6 +1430,9 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
else if (II == Ident__has_cpp_attribute)
Value = hasAttribute(AttrSyntax::CXX, ScopeII, FeatureII,
getTargetInfo().getTriple(), getLangOpts());
+ else if (II == Ident__has_declspec)
+ Value = hasAttribute(AttrSyntax::Declspec, nullptr, FeatureII,
+ getTargetInfo().getTriple(), getLangOpts());
else if (II == Ident__has_extension)
Value = HasExtension(*this, FeatureII);
else {
OpenPOWER on IntegriCloud