comparison tools/clang/lib/Parse/ParseCbC.cpp @ 97:b0dd3743370f

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Wed, 14 Oct 2015 19:39:58 +0900
parents 8a1cd0ffee6e
children 88e6d15e811d
comparison
equal deleted inserted replaced
94:d52ff4b80465 97:b0dd3743370f
281 D.SetRangeEnd(Loc); 281 D.SetRangeEnd(Loc);
282 DeclSpec FDS(AttrFactory); 282 DeclSpec FDS(AttrFactory);
283 DS.Finish(Diags, PP, Policy); 283 DS.Finish(Diags, PP, Policy);
284 284
285 D.AddTypeInfo(DeclaratorChunk::getPointer(FDS.getTypeQualifiers(), Loc, FDS.getConstSpecLoc(), FDS.getVolatileSpecLoc(), 285 D.AddTypeInfo(DeclaratorChunk::getPointer(FDS.getTypeQualifiers(), Loc, FDS.getConstSpecLoc(), FDS.getVolatileSpecLoc(),
286 FDS.getRestrictSpecLoc()), FDS.getAttributes(), SourceLocation()); 286 FDS.getRestrictSpecLoc(), DS.getAtomicSpecLoc()), FDS.getAttributes(), SourceLocation());
287 D.setGroupingParens(hadGroupingParens); 287 D.setGroupingParens(hadGroupingParens);
288 288
289 289
290 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope| 290 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope|
291 (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0)); 291 (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0));
472 CXXScopeSpec SS; 472 CXXScopeSpec SS;
473 UnqualifiedId Name; 473 UnqualifiedId Name;
474 SourceLocation TemplateKWLoc; 474 SourceLocation TemplateKWLoc;
475 tok::TokenKind OpKind = (IsArrow ? tok::arrow : tok::period); 475 tok::TokenKind OpKind = (IsArrow ? tok::arrow : tok::period);
476 Name.setIdentifier(II,Loc); 476 Name.setIdentifier(II,Loc);
477 return Actions.ActOnMemberAccessExpr(getCurScope(), Base, Loc, OpKind, SS, TemplateKWLoc, Name, nullptr, false); 477 return Actions.ActOnMemberAccessExpr(getCurScope(), Base, Loc, OpKind, SS, TemplateKWLoc, Name, nullptr);
478 } 478 }
479 479
480 480
481 /// Create__CbC_envStruct - This method create "struct __CbC_env" which is used to continuation with environment. 481 /// Create__CbC_envStruct - This method create "struct __CbC_env" which is used to continuation with environment.
482 /// If the __CbC_env has been already defined, it doesn't create __CbC_env again. 482 /// If the __CbC_env has been already defined, it doesn't create __CbC_env again.
547 DeclSpec DS(AttrFactory); 547 DeclSpec DS(AttrFactory);
548 DS.Finish(Diags, PP, Policy); 548 DS.Finish(Diags, PP, Policy);
549 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, Loc),Loc); 549 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, Loc),Loc);
550 550
551 DeclaratorInfo.D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,DS.getConstSpecLoc(), 551 DeclaratorInfo.D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,DS.getConstSpecLoc(),
552 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc()), 552 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc(), DS.getAtomicSpecLoc()),
553 DS.getAttributes(),SourceLocation()); 553 DS.getAttributes(),SourceLocation());
554 Decl *Field = Actions.ActOnField(getCurScope(), TagDecl, 554 Decl *Field = Actions.ActOnField(getCurScope(), TagDecl,
555 DeclaratorInfo.D.getDeclSpec().getSourceRange().getBegin(), 555 DeclaratorInfo.D.getDeclSpec().getSourceRange().getBegin(),
556 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize); 556 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize);
557 DeclaratorInfo.complete(Field); 557 DeclaratorInfo.complete(Field);
655 Loc, Loc, D, TrailingReturnType), FnAttrs, Loc); 655 Loc, Loc, D, TrailingReturnType), FnAttrs, Loc);
656 PrototypeScope.Exit(); 656 PrototypeScope.Exit();
657 657
658 Decl *TheDecl; 658 Decl *TheDecl;
659 ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope); 659 ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
660 Decl *BodyRes = Actions.ActOnStartOfFunctionDef(getCurScope(), D); 660 Sema::SkipBodyInfo SkipBody;
661 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo();
662 Decl *BodyRes = Actions.ActOnStartOfFunctionDef(getCurScope(), D,
663 TemplateInfo.TemplateParams ? *TemplateInfo.TemplateParams : MultiTemplateParamsArg(),
664 &SkipBody);
661 665
662 D.complete(BodyRes); 666 D.complete(BodyRes);
663 D.getMutableDeclSpec().abort(); 667 D.getMutableDeclSpec().abort();
664 Actions.ActOnDefaultCtorInitializers(BodyRes); 668 Actions.ActOnDefaultCtorInitializers(BodyRes);
665 StmtResult FnBody; 669 StmtResult FnBody;
678 starDS.Finish(Diags, PP, Policy); 682 starDS.Finish(Diags, PP, Policy);
679 envDInfo.SetIdentifier(0,Loc); 683 envDInfo.SetIdentifier(0,Loc);
680 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.getTypeQualifiers(), Loc, 684 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.getTypeQualifiers(), Loc,
681 starDS.getConstSpecLoc(), 685 starDS.getConstSpecLoc(),
682 starDS.getVolatileSpecLoc(), 686 starDS.getVolatileSpecLoc(),
683 starDS.getRestrictSpecLoc()), 687 starDS.getRestrictSpecLoc(),
688 starDS.getAtomicSpecLoc()),
684 starDS.getAttributes(), 689 starDS.getAttributes(),
685 SourceLocation()); 690 SourceLocation());
686 ExprVector ArgExprs2; 691 ExprVector ArgExprs2;
687 LHS = LookupNameAndBuildExpr(envII); 692 LHS = LookupNameAndBuildExpr(envII);
688 ArgExprs2.push_back(LHS.get()); 693 ArgExprs2.push_back(LHS.get());
722 ljD.ExtendWithDeclSpec(starDS2); 727 ljD.ExtendWithDeclSpec(starDS2);
723 ljD.SetIdentifier(0, Loc); 728 ljD.SetIdentifier(0, Loc);
724 ljD.AddTypeInfo(DeclaratorChunk::getPointer(ljDS.getTypeQualifiers(), Loc, 729 ljD.AddTypeInfo(DeclaratorChunk::getPointer(ljDS.getTypeQualifiers(), Loc,
725 ljDS.getConstSpecLoc(), 730 ljDS.getConstSpecLoc(),
726 ljDS.getVolatileSpecLoc(), 731 ljDS.getVolatileSpecLoc(),
727 ljDS.getRestrictSpecLoc()), 732 ljDS.getRestrictSpecLoc(),
733 ljDS.getAtomicSpecLoc()),
728 ljDS.getAttributes(), 734 ljDS.getAttributes(),
729 SourceLocation()); 735 SourceLocation());
730 ljLHS = LookupNameAndBuildExpr(envII); 736 ljLHS = LookupNameAndBuildExpr(envII);
731 Expr *ljCastExpr = ljLHS.get(); 737 Expr *ljCastExpr = ljLHS.get();
732 TypeSourceInfo *ljCastTInfo = Actions.GetTypeForDeclaratorCast(ljD, ljCastExpr->getType()); 738 TypeSourceInfo *ljCastTInfo = Actions.GetTypeForDeclaratorCast(ljD, ljCastExpr->getType());
802 DeclSpec pointerDS(AttrFactory); 808 DeclSpec pointerDS(AttrFactory);
803 pointerDS.Finish(Diags, PP, Policy); 809 pointerDS.Finish(Diags, PP, Policy);
804 ParamDeclarator.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc, 810 ParamDeclarator.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc,
805 pointerDS.getConstSpecLoc(), 811 pointerDS.getConstSpecLoc(),
806 pointerDS.getVolatileSpecLoc(), 812 pointerDS.getVolatileSpecLoc(),
807 pointerDS.getRestrictSpecLoc()), 813 pointerDS.getRestrictSpecLoc(),
814 pointerDS.getAtomicSpecLoc()),
808 pointerDS.getAttributes(),SourceLocation()); 815 pointerDS.getAttributes(),SourceLocation());
809 } 816 }
810 ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator)); 817 ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator));
811 return Param; 818 return Param;
812 819
964 Token SavedToken = Tok; 971 Token SavedToken = Tok;
965 Token IITok = Tok.is(tok::identifier) ? Tok : Next; 972 Token IITok = Tok.is(tok::identifier) ? Tok : Next;
966 PP.ClearCache(); 973 PP.ClearCache();
967 ProtoParsing = true; 974 ProtoParsing = true;
968 975
969 const DirectoryLookup *CurDir; 976 const DirectoryLookup *CurDir = nullptr;
970 FileID FID = PP.getSourceManager().createFileID(PP.getCurrentFileLexer()->getFileEntry(), IITok.getLocation(), SrcMgr::C_User); 977 FileID FID = PP.getSourceManager().createFileID(PP.getCurrentFileLexer()->getFileEntry(), IITok.getLocation(), SrcMgr::C_User);
971 PP.EnterSourceFile(FID,CurDir,IITok.getLocation()); 978 PP.EnterSourceFile(FID,CurDir,IITok.getLocation());
972 ConsumeToken(); 979 ConsumeToken();
973 980
974 if(SearchCodeSegmentDeclaration(IITok.getIdentifierInfo()->getName().str())){ 981 if(SearchCodeSegmentDeclaration(IITok.getIdentifierInfo()->getName().str())){