Mercurial > hg > CbC > CbC_llvm
changeset 107:a03ddd01be7e
resolve warnings
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 17:34:49 +0900 |
parents | 596a38ee9c9e |
children | 1881386f7909 |
files | tools/clang/lib/Parse/ParseCbC.cpp |
diffstat | 1 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/clang/lib/Parse/ParseCbC.cpp Sat Jan 30 16:11:01 2016 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Sun Jan 31 17:34:49 2016 +0900 @@ -175,8 +175,9 @@ ParseScope CompoundScope(this, Scope::DeclScope); PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),Loc,"in compound statement ('{}')"); StmtVector CompoundStmts; - - // struct __CbC_env __CbC_environment; + ExprResult Result(true); + + // struct __CbC_env __CbC_environment; innerRes = CreateDeclStmt(__CbC_envII, false, false, DeclSpec::TST_struct, structII, DeclSpec::TQ_volatile); if (innerRes.isUsable()) CompoundStmts.push_back(innerRes.get()); @@ -213,7 +214,21 @@ StmtResult CompoundStmtRes = Actions.ActOnCompoundStmt(Loc,Loc,CompoundStmts,true); ConsumeToken(); // eat the '__environment'. - return Actions.ActOnStmtExpr(Loc, CompoundStmtRes.get(), Loc); + Result = Actions.ActOnStmtExpr(Loc, CompoundStmtRes.get(), Loc); + + // cast + ParsedType CastTy; + DeclSpec void_DS(AttrFactory); + setTST(&void_DS, DeclSpec::TST_void); + Declarator DeclaratorInfo(void_DS, Declarator::TypeNameContext); + DeclSpec star_DS(AttrFactory); + star_DS.Finish(Actions, Actions.getASTContext().getPrintingPolicy()); + DeclaratorInfo.ExtendWithDeclSpec(star_DS); + DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation()); + DeclaratorInfo.AddTypeInfo(DeclaratorChunk::getPointer(star_DS.getTypeQualifiers(), Loc,star_DS.getConstSpecLoc(),star_DS.getVolatileSpecLoc(), + star_DS.getRestrictSpecLoc(),star_DS.getAtomicSpecLoc()),star_DS.getAttributes(),SourceLocation()); + return Actions.ActOnCastExpr(getCurScope(), Loc, DeclaratorInfo, CastTy,Loc, Result.get()); + } /// CreateAssignmentStmt - Create assignment statement such as "aaa = bbb;", "auaua = llll;", etc.