Mercurial > hg > CbC > CbC_llvm
changeset 138:53f12981605a
Fix goto is environment
author | anatofuz |
---|---|
date | Wed, 07 Mar 2018 18:36:33 +0900 |
parents | dc788094b8e4 |
children | 3c911905a0e9 |
files | tools/clang/include/clang/Basic/TokenKinds.def tools/clang/lib/Parse/ParseCbC.cpp tools/clang/lib/Parse/ParseExpr.cpp |
diffstat | 3 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/clang/include/clang/Basic/TokenKinds.def Tue Mar 06 08:58:23 2018 +0900 +++ b/tools/clang/include/clang/Basic/TokenKinds.def Wed Mar 07 18:36:33 2018 +0900 @@ -311,8 +311,8 @@ #ifndef noCbC // CbC Keywords. KEYWORD(__code , KEYALL) -KEYWORD(__return , KEYALL) -KEYWORD(__environment , KEYALL) +KEYWORD(_CbC_return , KEYALL) +KEYWORD(_CbC_environment , KEYALL) #endif // C++ 2.11p1: Keywords.
--- a/tools/clang/lib/Parse/ParseCbC.cpp Tue Mar 06 08:58:23 2018 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Wed Mar 07 18:36:33 2018 +0900 @@ -421,7 +421,6 @@ return New; } - /// CreateSjForContinuationWithEnv - Create statements of setjmp for continuation with the environment. /// code example: /// if (setjmp(__CbC_environment.env)){ @@ -444,7 +443,8 @@ ArgExprs.push_back(__envExprRes.get()); CondExp = Actions.ActOnCallExpr(getCurScope(), CondExp.get(), Loc, ArgExprs, Loc, 0); - CondExp = Actions.CheckBooleanCondition(Loc, CondExp.get()); + Cond = Actions.ActOnCondition(getCurScope(), Loc, CondExp.get(), Sema::ConditionKind::Boolean); + ParseScope InnerScope(this, Scope::DeclScope,false); SourceLocation InnerStatementTrailingElseLoc; @@ -464,8 +464,7 @@ InnerScope.Exit(); IfScope.Exit(); StmtResult ElseStmt; - bool IsConstexpr = false; - IfRes = Actions.ActOnIfStmt(Loc, IsConstexpr, InitStmt.get(), Cond, ThenStmt.get(),Loc, ElseStmt.get()); + IfRes = Actions.ActOnIfStmt(Loc, false, CondExp.get(), Cond, ThenStmt.get(),Loc, ElseStmt.get()); return IfRes; }
--- a/tools/clang/lib/Parse/ParseExpr.cpp Tue Mar 06 08:58:23 2018 +0900 +++ b/tools/clang/lib/Parse/ParseExpr.cpp Wed Mar 07 18:36:33 2018 +0900 @@ -1436,10 +1436,10 @@ break; } #ifndef noCbC - case tok::kw___return: + case tok::kw__CbC_return: Res = Prepare__retForGotoWithTheEnvExpr(); break; - case tok::kw___environment: + case tok::kw__CbC_environment: Res = Prepare__envForGotoWithTheEnvExpr(); break; #endif @@ -2808,10 +2808,10 @@ Expr = ParseBraceInitializer(); } #ifndef noCbC - else if (Tok.is(tok::kw___return)){ + else if (Tok.is(tok::kw__CbC_return)){ Expr = Prepare__retForGotoWithTheEnvExpr(); } - else if (Tok.is(tok::kw___environment)){ + else if (Tok.is(tok::kw__CbC_environment)){ Expr = Prepare__envForGotoWithTheEnvExpr(); } else if (Tok.is(tok::identifier) && NeedPrototypeDeclaration(Tok)){ // check code segment declaration.