Mercurial > hg > CbC > CbC_llvm
comparison 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 |
comparison
equal
deleted
inserted
replaced
7:eac3edb8778b | 8:ac3ff95a8c30 |
---|---|
224 return ParseForStatement(TrailingElseLoc); | 224 return ParseForStatement(TrailingElseLoc); |
225 | 225 |
226 case tok::kw_goto: // C99 6.8.6.1: goto-statement or CbC goto | 226 case tok::kw_goto: // C99 6.8.6.1: goto-statement or CbC goto |
227 #ifndef noCbC | 227 #ifndef noCbC |
228 if (PP.LookAhead(1).is(tok::l_paren)) { // is CbC goto : 'goto' codeSegment() ';' | 228 if (PP.LookAhead(1).is(tok::l_paren)) { // is CbC goto : 'goto' codeSegment() ';' |
229 return ParseCbCGotoStatement(); | |
230 SemiError = "goto code segment"; | 229 SemiError = "goto code segment"; |
230 return ParseCbCGotoStatement(Attrs, Stmts); | |
231 } | 231 } |
232 #endif | 232 #endif |
233 Res = ParseGotoStatement(); | 233 Res = ParseGotoStatement(); |
234 SemiError = "goto"; | 234 SemiError = "goto"; |
235 break; | 235 break; |
1632 #ifndef noCbC | 1632 #ifndef noCbC |
1633 /// ParseCbCGotoStatement | 1633 /// ParseCbCGotoStatement |
1634 /// jump-statement: | 1634 /// jump-statement: |
1635 /// 'goto' codeSegment ';' | 1635 /// 'goto' codeSegment ';' |
1636 /// | 1636 /// |
1637 /// | 1637 StmtResult Parser::ParseCbCGotoStatement(ParsedAttributesWithRange &Attrs,StmtVector &Stmts) { |
1638 StmtResult Parser::ParseCbCGotoStatement() { | |
1639 assert(Tok.is(tok::kw_goto) && "Not a goto stmt!"); | 1638 assert(Tok.is(tok::kw_goto) && "Not a goto stmt!"); |
1640 ConsumeToken(); // eat the 'goto'. | 1639 SourceLocation gotoLoc = ConsumeToken(); // eat the 'goto'. |
1641 | 1640 |
1642 StmtResult Res; | 1641 StmtResult gotoRes; |
1643 | 1642 |
1644 if (Tok.is(tok::identifier) && NextToken().is(tok::l_paren)) { // 'goto' codeSegment() ';' | 1643 if (Tok.is(tok::identifier) && NextToken().is(tok::l_paren)) { // 'goto' codeSegment() ';' |
1645 | 1644 |
1646 CorrectionCandidateCallback DefaultValidator; | 1645 CorrectionCandidateCallback DefaultValidator; |
1647 DefaultValidator.WantTypeSpecifiers = true; | 1646 DefaultValidator.WantTypeSpecifiers = true; |
1656 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true); | 1655 SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true); |
1657 if (Tok.is(tok::semi)) | 1656 if (Tok.is(tok::semi)) |
1658 ConsumeToken(); | 1657 ConsumeToken(); |
1659 return StmtError(); | 1658 return StmtError(); |
1660 } | 1659 } |
1661 Res = ParseExprStatement(); | 1660 gotoRes = ParseExprStatement(); |
1662 } | 1661 } |
1663 else { | 1662 else { |
1664 Diag(Tok, diag::err_expected_ident); | 1663 Diag(Tok, diag::err_expected_ident); |
1665 return StmtError(); | 1664 return StmtError(); |
1666 } | 1665 } |
1667 return Res; | 1666 assert((Attrs.empty() || gotoRes.isInvalid() || gotoRes.isUsable()) && |
1667 "attributes on empty statement"); | |
1668 | |
1669 if (!(Attrs.empty() || gotoRes.isInvalid())) | |
1670 gotoRes = Actions.ProcessStmtAttributes(gotoRes.get(), Attrs.getList(), Attrs.Range); | |
1671 | |
1672 if(gotoRes.isUsable()) | |
1673 Stmts.push_back(gotoRes.release()); | |
1674 /* add return; after goto code segment. */ | |
1675 | |
1676 ExprResult R; | |
1677 return Actions.ActOnReturnStmt(gotoLoc, R.take()); | |
1668 } | 1678 } |
1669 #endif | 1679 #endif |
1670 | 1680 |
1671 /// ParseContinueStatement | 1681 /// ParseContinueStatement |
1672 /// jump-statement: | 1682 /// jump-statement: |