[cfe-commits] r47316 - in /cfe/trunk: Basic/IdentifierTable.cpp test/Sema/c89.c

Chris Lattner sabre at nondot.org
Mon Feb 18 22:46:10 PST 2008


Author: lattner
Date: Tue Feb 19 00:46:10 2008
New Revision: 47316

URL: http://llvm.org/viewvc/llvm-project?rev=47316&view=rev
Log:
fix the second half of PR2041: __restrict is ok in c90 mode, even if
restrict isn't.

Modified:
    cfe/trunk/Basic/IdentifierTable.cpp
    cfe/trunk/test/Sema/c89.c

Modified: cfe/trunk/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/IdentifierTable.cpp?rev=47316&r1=47315&r2=47316&view=diff

==============================================================================
--- cfe/trunk/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/Basic/IdentifierTable.cpp Tue Feb 19 00:46:10 2008
@@ -91,12 +91,13 @@
 }
 
 static void AddAlias(const char *Keyword, unsigned KWLen,
+                     tok::TokenKind AliaseeID,
                      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.setTokenID(AliaseeID);
   AliasInfo.setIsExtensionToken(AliaseeInfo.isExtensionToken());
 }  
 
@@ -148,7 +149,8 @@
              ((FLAGS) >> CPP0xShift) & Mask, \
              ((FLAGS) >> BoolShift) & Mask, LangOpts, *this);
 #define ALIAS(NAME, TOK) \
-  AddAlias(NAME, strlen(NAME), #TOK, strlen(#TOK), LangOpts, *this);
+  AddAlias(NAME, strlen(NAME), tok::kw_ ## TOK, #TOK, strlen(#TOK),  \
+           LangOpts, *this);
 #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \
   if (LangOpts.CXXOperatorNames)          \
     AddCXXOperatorKeyword(#NAME, strlen(#NAME), tok::ALIAS, *this);

Modified: cfe/trunk/test/Sema/c89.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/c89.c?rev=47316&r1=47315&r2=47316&view=diff

==============================================================================
--- cfe/trunk/test/Sema/c89.c (original)
+++ cfe/trunk/test/Sema/c89.c Tue Feb 19 00:46:10 2008
@@ -32,4 +32,4 @@
 
 /* PR2041 */
 int *restrict;
-
+int *__restrict;  /* expected-error {{expected identifier}} */





More information about the cfe-commits mailing list