aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
AgeCommit message (Collapse)Author
2008-12-12use smarter error recovery for do/while.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12apply the new error recovery smarts we have for if's to while's and switch's.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12merge recovery-2.c into recovery-3.c.Chris Lattner
Substantially improve error recovery after broken if conditions by parsing the full if when we have a semantic error instead of using parser recovery techniques to recover from a semantic error. This fixes rdar://6094870 - spurious error after invalid 'if' condition git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Convert some more expression parsers to use smart pointers.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Convert selected expression parsers to use smart pointers.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Convert the remaining statement parsers to smart pointers.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Convert some more statement parsers to smart pointers.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Convert a number of statement parsers to smart pointers.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10Added a warning when referencing an if's condition variable in theDouglas Gregor
"else" clause, e.g., if (int X = foo()) { } else { if (X) { // warning: X is always zero in this context } } Fixes rdar://6425550 and lets me think about something other than DeclContext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10Use a scoped object to manage entry/exit from a parser scope rather than ↵Douglas Gregor
explicitly calling EnterScope/ExitScope git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl
Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09Kick out the proof-of-concept ASTOwner and replace it with ASTOwningResultSebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09Consistently use smart pointers for stmt and expr nodes in parser local ↵Sebastian Redl
variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25Use RAII objects to ensure proper destruction of expression and statement ↵Sebastian Redl
AST nodes in the parser in most cases, even on error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23make the 'to match this' diagnostic a note.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19Added operator overloading for unary operators, post-increment, andDouglas Gregor
post-decrement, including support for generating all of the built-in operator candidates for these operators. C++ and C have different rules for the arguments to the builtin unary '+' and '-'. Implemented both variants in Sema::ActOnUnaryOp. In C++, pre-increment and pre-decrement return lvalues. Update Expr::isLvalue accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59638 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18Change a couple of the Parser::Diag methods to return DiagnosticInfoChris Lattner
and let the clients push whatever they want into the DiagnosticInfo instead of hard coding a few forms. Also switch various clients to use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the canonical form to simplify the code a bit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13Fix a couple of suboptimalities in error recovery.Chris Lattner
1. In the top level of ParseStatementOrDeclaration, don't eat a } if we just parsed a statement if it list there. Also, don't even bother emitting an error about a missing semicolon if the statement had a bug (an rbrace is fine). 2. In do/while parsing, don't require a 'while' to be present if the do body didn't parse. This allows us to generate a clean diagnostic for this code: t.c:1:22: error: expected expression void foo (void) { do . while (0); } ^ Thanks to Neil for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20simplify some other code for __extension__ processing.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05Disambiguate between a declaration or an expression, in the ↵Argyrios Kyrtzidis
'for-init-statement' part of a 'for' statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05Resolve ambiguous C++ statements (C++ 6.8p1).Argyrios Kyrtzidis
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11Add comments about C++ clause 3.3.2p4 that mentions that the condition ↵Argyrios Kyrtzidis
declaration should be local to an if/switch/while/for statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11Fix do-while scoping in C++.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11Revert r56078, getLang().C99 being true in C++ is a bug that will be fixed.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10-getLang().C99 is true in C++ too, remove the use of the C99orCXX variable.Argyrios Kyrtzidis
-Scoping in C99 works good for C++ too, remove the C++-specific comments. If someone thinks that the C++-specific comments are necessary for clarification, let me know and I'll put them back on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56078 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10Add some C++-specific comments in the parsing methods of if/switch/while/for.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09Implement parser support for the 'condition' part of C++ ↵Argyrios Kyrtzidis
selection-statements and iteration-statements (if/switch/while/for). Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-07Support C++'s declaration-statement.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12Use of NextToken() makes ParseIdentifierStatement unnecessary.Argyrios Kyrtzidis
Simplify the parser by removing Parser::ParseIdentifierStatement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09Simplify the parser a bit by looking at the next token without consuming it ↵Argyrios Kyrtzidis
(by Preprocessor::LookNext): -Remove ParseExpressionWithLeadingIdentifier and ParseAssignmentExprWithLeadingIdentifier. -Separate ParseLabeledStatement from ParseIdentifierStatement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07Have Parser::FuzzyParseMicrosoftAsmStatement() return the null statement (';'). Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8