# HG changeset patch # User Shinji KONO # Date 1590922232 -32400 # Node ID 0f533c0a1429d61ee07fb8c86b60f9d6a641b57c # Parent df311c476dd5be2618bda9142dcfe9bf496dfd12 ... diff -r df311c476dd5 -r 0f533c0a1429 clang/include/clang/Parse/Parser.h --- a/clang/include/clang/Parse/Parser.h Sun May 31 12:30:11 2020 +0900 +++ b/clang/include/clang/Parse/Parser.h Sun May 31 19:50:32 2020 +0900 @@ -2352,7 +2352,7 @@ void CreateRetCS(IdentifierInfo* csName); void Create__CbC_envStruct(SourceLocation Loc, AccessSpecifier AS); IdentifierInfo* CreateIdentifierInfo(const char* Name, SourceLocation Loc); - IdentifierInfo* CreateIdentifierInfo(const char* Name, tok::TokenKind kind, SourceLocation Loc); + IdentifierInfo* CreateAnonIdentifierInfo(const char* Name, SourceLocation Loc); Decl* Create__CbC_envBody(Decl* TagDecl, DeclSpec::TST T, SourceLocation Loc, const char* Name); ExprResult LookupNameAndBuildExpr(IdentifierInfo *II = 0, bool IsAddressOfOperand = false); ExprResult LookupMemberAndBuildExpr(IdentifierInfo *II, Expr* Base, bool IsArrow); diff -r df311c476dd5 -r 0f533c0a1429 clang/lib/Parse/ParseCbC.cpp --- a/clang/lib/Parse/ParseCbC.cpp Sun May 31 12:30:11 2020 +0900 +++ b/clang/lib/Parse/ParseCbC.cpp Sun May 31 19:50:32 2020 +0900 @@ -616,13 +616,13 @@ /// usage : /// IdentifierInfo *II = CreateIdentifierInfo(IIName, Kind, Location); -IdentifierInfo* Parser::CreateIdentifierInfo(const char* Name, tok::TokenKind kind, SourceLocation Loc) { +IdentifierInfo* Parser::CreateIdentifierInfo(const char* Name, SourceLocation Loc) { int length = strlen(Name); Token TokenForII; TokenForII.startToken(); TokenForII.setLocation(Loc); TokenForII.setLength(length); - TokenForII.setKind(kind); + TokenForII.setKind(tok::raw_identifier); TokenForII.setRawIdentifierData(Name); IdentifierInfo *II; II = PP.getIdentifierInfo(TokenForII.getRawIdentifier()); @@ -631,10 +631,6 @@ return II; } -IdentifierInfo* Parser::CreateIdentifierInfo(const char* Name, SourceLocation Loc) { - return CreateIdentifierInfo(Name, tok::raw_identifier, Loc); -} - /// CreateUniqueIdentifierInfo - Create unique IdentifierInfo. /// IdentifierInfos have unique name which were created by this function. /// Naming conventions : @@ -774,7 +770,7 @@ FnStmts.push_back(innerR.get()); ExprResult ljExpr,ljLHS; - ljExpr = AnonToExpr(CreateIdentifierInfo("__builtin_longjmp", tok::annot_non_type, Loc), tok::l_paren); + ljExpr = AnonToExpr(CreateIdentifierInfo("__builtin_longjmp", Loc), tok::l_paren); ExprVector ljArgExprs; DeclSpec ljDS(AttrFactory); setTST(&ljDS, DeclSpec::TST_struct, structName); @@ -839,13 +835,23 @@ ExprResult Parser::AnonToExpr(IdentifierInfo *II, tok::TokenKind Kind){ SourceLocation Loc = Tok.getLocation(); - Token Next; + Token Next,IITok; Next.setKind(Kind); ExternalSpace::StatementFilterCCC CCCValidator(Next); CXXScopeSpec SS; - NamedDecl *ND = getNonTypeAnnotation(Tok); - ExprResult E(Actions.ActOnNameClassifiedAsNonType(getCurScope(), SS, ND, Loc, Tok)); - PP.AnnotateCachedTokens(Tok); + Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, II, Loc, Next, &CCCValidator); + IITok.startToken(); + IITok.setKind(tok::annot_non_type); + setNonTypeAnnotation(IITok, Classification.getNonTypeDecl()); + IITok.setLocation(Loc); + IITok.setAnnotationEndLoc(Loc); + PP.AnnotateCachedTokens(IITok); + const bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope); + if (SS.isNotEmpty()) + AnnotateScopeToken(SS, !WasScopeAnnotation); + NamedDecl *ND = getNonTypeAnnotation(IITok); + ExprResult E; + E = Actions.ActOnNameClassifiedAsNonType(getCurScope(), SS, ND, Loc, IITok); return E; } @@ -959,7 +965,7 @@ /// If not, include it. void Parser::CheckTheSjHeader(){ SourceLocation Loc = Tok.getLocation(); - LookupResult R(Actions, CreateIdentifierInfo("setjmp", tok::annot_non_type, Loc), Loc, Actions.LookupOrdinaryName, Actions.ForVisibleRedeclaration); + LookupResult R(Actions, CreateIdentifierInfo("setjmp", Loc), Loc, Actions.LookupOrdinaryName, Actions.ForVisibleRedeclaration); if (!Actions.LookupName(R, getCurScope())){ // look up the setjmp if (PP.IncludeHeader(Tok, "setjmp.h")) ConsumeToken();