Mercurial > hg > CbC > CbC_llvm
diff tools/clang/lib/Parse/ParseStmt.cpp @ 8:ac3ff95a8c30
don't set optimization level to 2 if extension is 'cbc' (cancel 4th commit).
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Jul 2013 12:42:47 +0900 |
parents | c8782e147cac |
children | 1d7e5c85e4cf |
line wrap: on
line diff
--- a/tools/clang/lib/Parse/ParseStmt.cpp Thu Jun 20 15:02:26 2013 +0900 +++ b/tools/clang/lib/Parse/ParseStmt.cpp Wed Jul 03 12:42:47 2013 +0900 @@ -226,8 +226,8 @@ case tok::kw_goto: // C99 6.8.6.1: goto-statement or CbC goto #ifndef noCbC if (PP.LookAhead(1).is(tok::l_paren)) { // is CbC goto : 'goto' codeSegment() ';' - return ParseCbCGotoStatement(); SemiError = "goto code segment"; + return ParseCbCGotoStatement(Attrs, Stmts); } #endif Res = ParseGotoStatement(); @@ -1634,12 +1634,11 @@ /// jump-statement: /// 'goto' codeSegment ';' /// -/// -StmtResult Parser::ParseCbCGotoStatement() { +StmtResult Parser::ParseCbCGotoStatement(ParsedAttributesWithRange &Attrs,StmtVector &Stmts) { assert(Tok.is(tok::kw_goto) && "Not a goto stmt!"); - ConsumeToken(); // eat the 'goto'. + SourceLocation gotoLoc = ConsumeToken(); // eat the 'goto'. - StmtResult Res; + StmtResult gotoRes; if (Tok.is(tok::identifier) && NextToken().is(tok::l_paren)) { // 'goto' codeSegment() ';' @@ -1658,13 +1657,24 @@ ConsumeToken(); return StmtError(); } - Res = ParseExprStatement(); + gotoRes = ParseExprStatement(); } else { Diag(Tok, diag::err_expected_ident); return StmtError(); } - return Res; + assert((Attrs.empty() || gotoRes.isInvalid() || gotoRes.isUsable()) && + "attributes on empty statement"); + + if (!(Attrs.empty() || gotoRes.isInvalid())) + gotoRes = Actions.ProcessStmtAttributes(gotoRes.get(), Attrs.getList(), Attrs.Range); + + if(gotoRes.isUsable()) + Stmts.push_back(gotoRes.release()); + /* add return; after goto code segment. */ + + ExprResult R; + return Actions.ActOnReturnStmt(gotoLoc, R.take()); } #endif