summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Include information about compound statements when crashing in sema or theChris Lattner2009-03-051-2/+7
| | | | | | | | | | parser. For example, we now print out: 0. t.c:5:10: in compound statement {} 1. t.c:3:12: in compound statement {} 2. clang t.c -fsyntax-only llvm-svn: 66108
* fixes suggested by Sebastian!Chris Lattner2009-03-041-2/+2
| | | | llvm-svn: 66044
* Change Parser::ParseCaseStatement to use an iterative approach to parsingChris Lattner2009-03-041-35/+93
| | | | | | | | | | | | | | | | | | multiple sequential case statements instead of doing it with recursion. This fixes a problem where we run out of stack space parsing 100K directly nested cases. There are a couple other problems that prevent this from being useful in practice (right now the example only parses correctly with -disable-free and doesn't work with -emit-llvm), but this is a start. I'm not including a testcase because it is large and uninteresting for regtesting. Sebastian, I would appreciate it if you could scrutinize the smart pointer gymnastics I do. llvm-svn: 66011
* Put the invalid flag of OwningResult into the Action pointer.Sebastian Redl2009-02-051-27/+25
| | | | | | | | This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two. This leads to simpler client code and speeds up my benchmark by 2.7%. For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp. llvm-svn: 63867
* Fix for PR3418: make sure to handle the RHS of expressions starting with Eli Friedman2009-01-271-9/+3
| | | | | | __extension__. This sort of construct shows up in the gcc source code. llvm-svn: 63100
* Convert more expression actions to smart pointers.Sebastian Redl2009-01-191-2/+2
| | | | | | Fix type of logical negation for C++. llvm-svn: 62475
* Rename move_convert to move_arg and move_res. The new names are less ↵Sebastian Redl2009-01-181-36/+31
| | | | | | misleading (and shorter). llvm-svn: 62466
* Convert asm statement action to smart pointers.Sebastian Redl2009-01-181-6/+5
| | | | llvm-svn: 62464
* Convert more statement actions to smart pointers.Sebastian Redl2009-01-181-4/+4
| | | | llvm-svn: 62463
* Convert some more statement actions to smart pointers.Sebastian Redl2009-01-161-17/+14
| | | | | | Fix a type error; parser wanted to pass the third part of a for-statement as a statement; should be expression. llvm-svn: 62380
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-2/+2
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Convert some more actions to smart pointers.Sebastian Redl2009-01-111-9/+10
| | | | | | | No performance regression in my basic test. Also fixed a type error in ActOnFinishSwitchStmt's arguments (body is a stmt). llvm-svn: 62032
* Convert a two more statement actions to smart pointers.Sebastian Redl2008-12-281-5/+5
| | | | llvm-svn: 61456
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-221-1/+2
| | | | llvm-svn: 61337
* Parser support for C++ try-catch.Sebastian Redl2008-12-211-1/+92
| | | | llvm-svn: 61312
* Convert a few Stmt actions to smart pointers.Sebastian Redl2008-12-211-10/+10
| | | | llvm-svn: 61309
* Do proper recovery from an invalid switch condiition. Fixes PR3229.Eli Friedman2008-12-171-3/+4
| | | | llvm-svn: 61160
* Some utilities for using the smart pointers in Actions, especially Sema. ↵Sebastian Redl2008-12-131-1/+1
| | | | | | Convert a few functions. llvm-svn: 60983
* use smarter error recovery for do/while.Chris Lattner2008-12-121-4/+7
| | | | llvm-svn: 60933
* apply the new error recovery smarts we have for if's to while's and switch's.Chris Lattner2008-12-121-42/+49
| | | | llvm-svn: 60932
* merge recovery-2.c into recovery-3.c.Chris Lattner2008-12-121-9/+22
| | | | | | | | | | 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 llvm-svn: 60929
* Convert some more expression parsers to use smart pointers.Sebastian Redl2008-12-111-2/+2
| | | | llvm-svn: 60904
* Convert selected expression parsers to use smart pointers.Sebastian Redl2008-12-111-4/+4
| | | | llvm-svn: 60900
* Convert the remaining statement parsers to smart pointers.Sebastian Redl2008-12-111-1/+1
| | | | llvm-svn: 60895
* Convert some more statement parsers to smart pointers.Sebastian Redl2008-12-111-76/+79
| | | | llvm-svn: 60892
* Convert a number of statement parsers to smart pointers.Sebastian Redl2008-12-111-78/+79
| | | | llvm-svn: 60888
* Added a warning when referencing an if's condition variable in theDouglas Gregor2008-12-101-0/+3
| | | | | | | | | | | | | | | "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. llvm-svn: 60858
* Use a scoped object to manage entry/exit from a parser scope rather than ↵Douglas Gregor2008-12-101-55/+48
| | | | | | explicitly calling EnterScope/ExitScope llvm-svn: 60830
* Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl2008-12-101-47/+49
| | | | | | Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers. llvm-svn: 60809
* Kick out the proof-of-concept ASTOwner and replace it with ASTOwningResultSebastian Redl2008-12-091-32/+32
| | | | llvm-svn: 60791
* Consistently use smart pointers for stmt and expr nodes in parser local ↵Sebastian Redl2008-12-091-167/+136
| | | | | | variables. llvm-svn: 60761
* Use RAII objects to ensure proper destruction of expression and statement ↵Sebastian Redl2008-11-251-18/+38
| | | | | | AST nodes in the parser in most cases, even on error. llvm-svn: 60057
* make the 'to match this' diagnostic a note.Chris Lattner2008-11-231-1/+1
| | | | llvm-svn: 59921
* Added operator overloading for unary operators, post-increment, andDouglas Gregor2008-11-191-1/+2
| | | | | | | | | | | | | 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. llvm-svn: 59638
* Change a couple of the Parser::Diag methods to return DiagnosticInfoChris Lattner2008-11-181-13/+13
| | | | | | | | | 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. llvm-svn: 59509
* Fix a couple of suboptimalities in error recovery.Chris Lattner2008-11-131-8/+11
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 59256
* simplify some other code for __extension__ processing.Chris Lattner2008-10-201-7/+5
| | | | llvm-svn: 57807
* Disambiguate between a declaration or an expression, in the ↵Argyrios Kyrtzidis2008-10-051-1/+1
| | | | | | 'for-init-statement' part of a 'for' statement. llvm-svn: 57112
* Resolve ambiguous C++ statements (C++ 6.8p1).Argyrios Kyrtzidis2008-10-051-2/+2
| | | | | | 'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them. llvm-svn: 57084
* Add comments about C++ clause 3.3.2p4 that mentions that the condition ↵Argyrios Kyrtzidis2008-09-111-0/+16
| | | | | | declaration should be local to an if/switch/while/for statement. llvm-svn: 56134
* Fix do-while scoping in C++.Argyrios Kyrtzidis2008-09-111-1/+7
| | | | llvm-svn: 56095
* Revert r56078, getLang().C99 being true in C++ is a bug that will be fixed.Argyrios Kyrtzidis2008-09-111-12/+91
| | | | llvm-svn: 56090
* -getLang().C99 is true in C++ too, remove the use of the C99orCXX variable.Argyrios Kyrtzidis2008-09-101-91/+12
| | | | | | | | -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. llvm-svn: 56078
* Add some C++-specific comments in the parsing methods of if/switch/while/for.Argyrios Kyrtzidis2008-09-101-0/+71
| | | | llvm-svn: 56060
* Implement parser support for the 'condition' part of C++ ↵Argyrios Kyrtzidis2008-09-091-23/+67
| | | | | | | | selection-statements and iteration-statements (if/switch/while/for). Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression. llvm-svn: 56007
* Support C++'s declaration-statement.Argyrios Kyrtzidis2008-09-071-1/+2
| | | | llvm-svn: 55888
* Use of NextToken() makes ParseIdentifierStatement unnecessary.Argyrios Kyrtzidis2008-07-121-87/+7
| | | | | | Simplify the parser by removing Parser::ParseIdentifierStatement. llvm-svn: 53520
* Simplify the parser a bit by looking at the next token without consuming it ↵Argyrios Kyrtzidis2008-07-091-30/+41
| | | | | | | | | (by Preprocessor::LookNext): -Remove ParseExpressionWithLeadingIdentifier and ParseAssignmentExprWithLeadingIdentifier. -Separate ParseLabeledStatement from ParseIdentifierStatement. llvm-svn: 53376
* Have Parser::FuzzyParseMicrosoftAsmStatement() return the null statement (';'). Steve Naroff2008-04-071-1/+1
| | | | llvm-svn: 49349
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+1159
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. llvm-svn: 48402
OpenPOWER on IntegriCloud