comparison tools/clang/lib/Parse/ParseCbC.cpp @ 128:c347d3398279

fix
author mir3636
date Wed, 06 Dec 2017 14:37:17 +0900
parents c4cc77a799c9
children 9ec641e857f8
comparison
equal deleted inserted replaced
127:2ce56a727a15 128:c347d3398279
224 DeclSpec star_DS(AttrFactory); 224 DeclSpec star_DS(AttrFactory);
225 star_DS.Finish(Actions, Actions.getASTContext().getPrintingPolicy()); 225 star_DS.Finish(Actions, Actions.getASTContext().getPrintingPolicy());
226 DeclaratorInfo.ExtendWithDeclSpec(star_DS); 226 DeclaratorInfo.ExtendWithDeclSpec(star_DS);
227 DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation()); 227 DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation());
228 DeclaratorInfo.AddTypeInfo(DeclaratorChunk::getPointer(star_DS.getTypeQualifiers(), Loc,star_DS.getConstSpecLoc(),star_DS.getVolatileSpecLoc(), 228 DeclaratorInfo.AddTypeInfo(DeclaratorChunk::getPointer(star_DS.getTypeQualifiers(), Loc,star_DS.getConstSpecLoc(),star_DS.getVolatileSpecLoc(),
229 star_DS.getRestrictSpecLoc(),star_DS.getAtomicSpecLoc()),star_DS.getAttributes(),SourceLocation()); 229 star_DS.getRestrictSpecLoc(),star_DS.getAtomicSpecLoc(),star_DS.getUnalignedSpecLoc()),star_DS.getAttributes(),SourceLocation());
230 return Actions.ActOnCastExpr(getCurScope(), Loc, DeclaratorInfo, CastTy,Loc, Result.get()); 230 return Actions.ActOnCastExpr(getCurScope(), Loc, DeclaratorInfo, CastTy,Loc, Result.get());
231 231
232 } 232 }
233 233
234 /// CreateAssignmentStmt - Create assignment statement such as "aaa = bbb;", "auaua = llll;", etc. 234 /// CreateAssignmentStmt - Create assignment statement such as "aaa = bbb;", "auaua = llll;", etc.
296 D.SetRangeEnd(Loc); 296 D.SetRangeEnd(Loc);
297 DeclSpec FDS(AttrFactory); 297 DeclSpec FDS(AttrFactory);
298 DS.Finish(Actions, Policy); 298 DS.Finish(Actions, Policy);
299 299
300 D.AddTypeInfo(DeclaratorChunk::getPointer(FDS.getTypeQualifiers(), Loc, FDS.getConstSpecLoc(), FDS.getVolatileSpecLoc(), 300 D.AddTypeInfo(DeclaratorChunk::getPointer(FDS.getTypeQualifiers(), Loc, FDS.getConstSpecLoc(), FDS.getVolatileSpecLoc(),
301 FDS.getRestrictSpecLoc(), DS.getAtomicSpecLoc()), FDS.getAttributes(), SourceLocation()); 301 FDS.getRestrictSpecLoc(), DS.getAtomicSpecLoc(), FDS.getUnalignedSpecLoc()), FDS.getAttributes(), SourceLocation());
302 D.setGroupingParens(hadGroupingParens); 302 D.setGroupingParens(hadGroupingParens);
303 303
304 304
305 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope| 305 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope|
306 (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0)); 306 (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0));
336 RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc, 336 RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc,
337 VolatileQualifierLoc, RefQualifierLoc, SourceLocation(), 337 VolatileQualifierLoc, RefQualifierLoc, SourceLocation(),
338 ESpecType, ESpecRange.getBegin(), 338 ESpecType, ESpecRange.getBegin(),
339 DynamicExceptions.data(), DynamicExceptionRanges.data(), 339 DynamicExceptions.data(), DynamicExceptionRanges.data(),
340 DynamicExceptions.size(), 340 DynamicExceptions.size(),
341 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, Loc, Loc, D, TrailingReturnType), 341 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, None, Loc, Loc, D, TrailingReturnType),
342 FnAttrs, Loc); 342 FnAttrs, Loc);
343 PrototypeScope.Exit(); 343 PrototypeScope.Exit();
344 DSp = &FDS; 344 DSp = &FDS;
345 } 345 }
346 346
562 DeclSpec DS(AttrFactory); 562 DeclSpec DS(AttrFactory);
563 DS.Finish(Actions, Policy); 563 DS.Finish(Actions, Policy);
564 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, Loc),Loc); 564 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, Loc),Loc);
565 565
566 DeclaratorInfo.D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,DS.getConstSpecLoc(), 566 DeclaratorInfo.D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,DS.getConstSpecLoc(),
567 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc(), DS.getAtomicSpecLoc()), 567 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc(), DS.getAtomicSpecLoc(), DS.getUnalignedSpecLoc()),
568 DS.getAttributes(),SourceLocation()); 568 DS.getAttributes(),SourceLocation());
569 Decl *Field = Actions.ActOnField(getCurScope(), TagDecl, 569 Decl *Field = Actions.ActOnField(getCurScope(), TagDecl,
570 DeclaratorInfo.D.getDeclSpec().getSourceRange().getBegin(), 570 DeclaratorInfo.D.getDeclSpec().getSourceRange().getBegin(),
571 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize); 571 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize);
572 DeclaratorInfo.complete(Field); 572 DeclaratorInfo.complete(Field);
664 D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto, IsAmbiguous, Loc, ParamInfo.data(), ParamInfo.size(), EllipsisLoc, Loc, 664 D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto, IsAmbiguous, Loc, ParamInfo.data(), ParamInfo.size(), EllipsisLoc, Loc,
665 FDS.getTypeQualifiers(), RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc, 665 FDS.getTypeQualifiers(), RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc,
666 VolatileQualifierLoc, RestrictQualifierLoc, SourceLocation(), 666 VolatileQualifierLoc, RestrictQualifierLoc, SourceLocation(),
667 ESpecType, ESpecRange.getBegin(), 667 ESpecType, ESpecRange.getBegin(),
668 DynamicExceptions.data(), DynamicExceptionRanges.data(), DynamicExceptions.size(), 668 DynamicExceptions.data(), DynamicExceptionRanges.data(), DynamicExceptions.size(),
669 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, 669 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, None,
670 Loc, Loc, D, TrailingReturnType), FnAttrs, Loc); 670 Loc, Loc, D, TrailingReturnType), FnAttrs, Loc);
671 PrototypeScope.Exit(); 671 PrototypeScope.Exit();
672 672
673 Decl *TheDecl; 673 Decl *TheDecl;
674 ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope); 674 ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
698 envDInfo.SetIdentifier(0,Loc); 698 envDInfo.SetIdentifier(0,Loc);
699 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.getTypeQualifiers(), Loc, 699 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.getTypeQualifiers(), Loc,
700 starDS.getConstSpecLoc(), 700 starDS.getConstSpecLoc(),
701 starDS.getVolatileSpecLoc(), 701 starDS.getVolatileSpecLoc(),
702 starDS.getRestrictSpecLoc(), 702 starDS.getRestrictSpecLoc(),
703 starDS.getAtomicSpecLoc()), 703 starDS.getAtomicSpecLoc(),
704 starDS.getUnalignedSpecLoc()),
704 starDS.getAttributes(), 705 starDS.getAttributes(),
705 SourceLocation()); 706 SourceLocation());
706 ExprVector ArgExprs2; 707 ExprVector ArgExprs2;
707 LHS = LookupNameAndBuildExpr(envII); 708 LHS = LookupNameAndBuildExpr(envII);
708 ArgExprs2.push_back(LHS.get()); 709 ArgExprs2.push_back(LHS.get());
743 ljD.SetIdentifier(0, Loc); 744 ljD.SetIdentifier(0, Loc);
744 ljD.AddTypeInfo(DeclaratorChunk::getPointer(ljDS.getTypeQualifiers(), Loc, 745 ljD.AddTypeInfo(DeclaratorChunk::getPointer(ljDS.getTypeQualifiers(), Loc,
745 ljDS.getConstSpecLoc(), 746 ljDS.getConstSpecLoc(),
746 ljDS.getVolatileSpecLoc(), 747 ljDS.getVolatileSpecLoc(),
747 ljDS.getRestrictSpecLoc(), 748 ljDS.getRestrictSpecLoc(),
748 ljDS.getAtomicSpecLoc()), 749 ljDS.getAtomicSpecLoc(),
750 ljDS.getUnalignedSpecLoc()),
749 ljDS.getAttributes(), 751 ljDS.getAttributes(),
750 SourceLocation()); 752 SourceLocation());
751 ljLHS = LookupNameAndBuildExpr(envII); 753 ljLHS = LookupNameAndBuildExpr(envII);
752 Expr *ljCastExpr = ljLHS.get(); 754 Expr *ljCastExpr = ljLHS.get();
753 TypeSourceInfo *ljCastTInfo = Actions.GetTypeForDeclaratorCast(ljD, ljCastExpr->getType()); 755 TypeSourceInfo *ljCastTInfo = Actions.GetTypeForDeclaratorCast(ljD, ljCastExpr->getType());
824 pointerDS.Finish(Actions, Policy); 826 pointerDS.Finish(Actions, Policy);
825 ParamDeclarator.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc, 827 ParamDeclarator.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc,
826 pointerDS.getConstSpecLoc(), 828 pointerDS.getConstSpecLoc(),
827 pointerDS.getVolatileSpecLoc(), 829 pointerDS.getVolatileSpecLoc(),
828 pointerDS.getRestrictSpecLoc(), 830 pointerDS.getRestrictSpecLoc(),
829 pointerDS.getAtomicSpecLoc()), 831 pointerDS.getAtomicSpecLoc(),
832 pointerDS.getUnalignedSpecLoc()),
830 pointerDS.getAttributes(),SourceLocation()); 833 pointerDS.getAttributes(),SourceLocation());
831 } 834 }
832 ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator)); 835 ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator));
833 return Param; 836 return Param;
834 837