From: Chris Lattner Date: Tue, 19 Feb 2008 06:46:10 +0000 (+0000) Subject: fix the second half of PR2041: __restrict is ok in c90 mode, even if X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49581f4dc324d6a183419168b01cb04e73342c07;p=clang fix the second half of PR2041: __restrict is ok in c90 mode, even if restrict isn't. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47316 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Basic/IdentifierTable.cpp b/Basic/IdentifierTable.cpp index f6c5f3a1af..45d888140a 100644 --- a/Basic/IdentifierTable.cpp +++ b/Basic/IdentifierTable.cpp @@ -91,12 +91,13 @@ static void AddKeyword(const char *Keyword, unsigned KWLen, } 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 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { ((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); diff --git a/test/Sema/c89.c b/test/Sema/c89.c index 4c89e82ba2..831c1ce7c5 100644 --- a/test/Sema/c89.c +++ b/test/Sema/c89.c @@ -32,4 +32,4 @@ void test5(register); /* PR2041 */ int *restrict; - +int *__restrict; /* expected-error {{expected identifier}} */