[cfe-commits] r39607 - /cfe/cfe/trunk/Lex/IdentifierTable.cpp

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:46:11 PDT 2007


Author: clattner
Date: Wed Jul 11 11:46:11 2007
New Revision: 39607

URL: http://llvm.org/viewvc/llvm-project?rev=39607&view=rev
Log:
Fix a bug steve noticed where we warned that __attribute is an extension,
but where we didn't warn about __attribute__.

Modified:
    cfe/cfe/trunk/Lex/IdentifierTable.cpp

Modified: cfe/cfe/trunk/Lex/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/IdentifierTable.cpp?rev=39607&r1=39606&r2=39607&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/IdentifierTable.cpp (original)
+++ cfe/cfe/trunk/Lex/IdentifierTable.cpp Wed Jul 11 11:46:11 2007
@@ -79,6 +79,16 @@
   Info.setIsExtensionToken(Flags == 1);
 }
 
+static void AddAlias(const char *Keyword, unsigned KWLen,
+                     const char *AliaseeKeyword, unsigned AliaseeKWLen,
+                     const LangOptions &LangOpts, IdentifierTable &Table) {
+  IdentifierInfo &AliasInfo = Table.get(Keyword, Keyword+KWLen);
+  IdentifierInfo &AliaseeInfo = Table.get(AliaseeKeyword,
+                                          AliaseeKeyword+AliaseeKWLen);
+  AliasInfo.setTokenID(AliaseeInfo.getTokenID());
+  AliasInfo.setIsExtensionToken(AliaseeInfo.isExtensionToken());
+}  
+
 /// AddPPKeyword - Register a preprocessor keyword like "define" "undef" or 
 /// "elif".
 static void AddPPKeyword(tok::PPKeywordKind PPID, 
@@ -128,7 +138,7 @@
              ((FLAGS) >> C99Shift) & Mask, \
              ((FLAGS) >> CPPShift) & Mask, LangOpts, *this);
 #define ALIAS(NAME, TOK) \
-  AddKeyword(NAME, strlen(NAME), tok::kw_ ## TOK, 0, 0, 0, LangOpts, *this);
+  AddAlias(NAME, strlen(NAME), #TOK, strlen(#TOK), LangOpts, *this);
 #define PPKEYWORD(NAME) \
   AddPPKeyword(tok::pp_##NAME, #NAME, strlen(#NAME), *this);
 #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \





More information about the cfe-commits mailing list