]> granicus.if.org Git - clang/commitdiff
Generalize hack allowing 'const' in __has_attribute (etc) to allow any token
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 9 Jul 2013 00:57:56 +0000 (00:57 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 9 Jul 2013 00:57:56 +0000 (00:57 +0000)
with identifier info. This covers most identifier-like entities (other than
the ISO646 keywords).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/Preprocessor/has_attribute.c

index 06f14c24bdda3882c12e9e35a818c39d64cc9620..d21515c5a64171d505d4be28fd1d030a3bc56f8e 100644 (file)
@@ -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))
index 711cf671cfea832b45bc1bcabe6a712a8058cb8e..555c2b3f9e2212c779f3365a9fa05b0387353e68 100644 (file)
@@ -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