diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-09 00:57:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-09 00:57:56 +0000 |
commit | baf2912b402f695cd6b957df47fdc9a50c0a5b6a (patch) | |
tree | 4bedccc4aaeb4c707e51be872355fead67704441 /clang | |
parent | 2f672d610e97a671c742689e12560eaeadf94f15 (diff) | |
download | bcm5719-llvm-baf2912b402f695cd6b957df47fdc9a50c0a5b6a.tar.gz bcm5719-llvm-baf2912b402f695cd6b957df47fdc9a50c0a5b6a.zip |
Generalize hack allowing 'const' in __has_attribute (etc) to allow any token
with identifier info. This covers most identifier-like entities (other than
the ISO646 keywords).
llvm-svn: 185895
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 4 | ||||
-rw-r--r-- | clang/test/Preprocessor/has_attribute.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 06f14c24bdd..d21515c5a64 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1218,9 +1218,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { if (Tok.is(tok::l_paren)) { // Read the identifier LexUnexpandedToken(Tok); - if (Tok.is(tok::identifier) || Tok.is(tok::kw_const)) { - FeatureII = Tok.getIdentifierInfo(); - + if ((FeatureII = Tok.getIdentifierInfo())) { // Read the ')'. LexUnexpandedToken(Tok); if (Tok.is(tok::r_paren)) diff --git a/clang/test/Preprocessor/has_attribute.c b/clang/test/Preprocessor/has_attribute.c index 711cf671cfe..555c2b3f9e2 100644 --- a/clang/test/Preprocessor/has_attribute.c +++ b/clang/test/Preprocessor/has_attribute.c @@ -34,3 +34,7 @@ int has_something_we_dont_have(); static int constFunction() __attribute__((const)); #endif +// CHECK: has_no_volatile_attribute +#if !__has_attribute(volatile) +int has_no_volatile_attribute(); +#endif |