summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ActOnReturnStmt should also take a FullExprArg.Anders Carlsson2009-05-301-1/+1
| | | | llvm-svn: 72641
* Merge the ASTVector and ASTOwningVector templates, since they offeredDouglas Gregor2009-05-211-1/+0
| | | | | | | | redundant functionality. The result (ASTOwningVector) lives in clang/Parse/Ownership.h and is used by both the parser and semantic analysis. No intended functionality change. llvm-svn: 72214
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-1/+1
| | | | llvm-svn: 72210
* Make ActOnWhileStmt take a FullExprArg for the condition expr.Anders Carlsson2009-05-171-1/+1
| | | | llvm-svn: 71990
* Make ActOnExprStmt take a FullExprArg.Anders Carlsson2009-05-171-3/+3
| | | | llvm-svn: 71989
* Add the FullExprArg wrapper and use it for if statement conditions.Anders Carlsson2009-05-171-1/+1
| | | | llvm-svn: 71982
* Make the RAII extension warning silencing for __extension__ a bit Eli Friedman2009-05-161-3/+3
| | | | | | | narrower, so it doesn't catch expresions that aren't sub-expressions of __extension__ operator. llvm-svn: 71967
* Don't insert an extra ParenExpr around asm operands.Eli Friedman2009-05-031-1/+3
| | | | llvm-svn: 70673
* Get rid of some useless uses of NoExtensions. The philosophy here is Eli Friedman2009-04-281-1/+1
| | | | | | | | | | | | that if we're going to print an extension warning anyway, there's no point to changing behavior based on NoExtensions: it will only make error recovery worse. Note that this doesn't cause any behavior change because NoExtensions isn't used by the current front-end. I'm still considering what to do about the remaining use of NoExtensions in IdentifierTable.cpp. llvm-svn: 70273
* The mysterious bug turns out to be an incredibly bone-headed mistake.Sebastian Redl2009-04-261-1/+2
| | | | llvm-svn: 70160
* Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl2009-04-261-4/+44
| | | | | | can't track down. llvm-svn: 70155
* Fix a problem with objc foreach loop. It turns out that objc mode changesChris Lattner2009-04-221-4/+4
| | | | | | | | | | | | for scoping to match C99 even when in C89 mode. This patch fixes this (eliminating a "redefinition of thisKey" error), and also prevents non-sensical diagnostics in -pedantic mode like this: t.m:7:8: warning: variable declaration in for loop is a C99-specific feature for (id thisKey in keys) ; ^ llvm-svn: 69760
* fix a FIXME, providing accurate source range info for DeclStmt's. The endChris Lattner2009-04-021-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of the range is now the ';' location. For something like this: $ cat t2.c #define bool int void f(int x, int y) { bool b = !x && y; } We used to produce: $ clang-cc t2.c -ast-dump typedef char *__builtin_va_list; void f(int x, int y) (CompoundStmt 0x2201f10 <t2.c:3:22, line:5:1> (DeclStmt 0x2201ef0 <line:2:14> <---- 0x2201a20 "int b = (BinaryOperator 0x2201ed0 <line:4:10, col:16> 'int' '&&' (UnaryOperator 0x2201e90 <col:10, col:11> 'int' prefix '!' (DeclRefExpr 0x2201c90 <col:11> 'int' ParmVar='x' 0x2201a50)) (DeclRefExpr 0x2201eb0 <col:16> 'int' ParmVar='y' 0x2201e10))") Now we produce: $ clang-cc t2.c -ast-dump typedef char *__builtin_va_list; void f(int x, int y) (CompoundStmt 0x2201f10 <t2.c:3:22, line:5:1> (DeclStmt 0x2201ef0 <line:2:14, line:4:17> <------ 0x2201a20 "int b = (BinaryOperator 0x2201ed0 <col:10, col:16> 'int' '&&' (UnaryOperator 0x2201e90 <col:10, col:11> 'int' prefix '!' (DeclRefExpr 0x2201c90 <col:11> 'int' ParmVar='x' 0x2201a50)) (DeclRefExpr 0x2201eb0 <col:16> 'int' ParmVar='y' 0x2201e10))") llvm-svn: 68288
* minor simplificationChris Lattner2009-03-291-4/+1
| | | | llvm-svn: 68011
* hoist some code for handling objc foreach construct out of Declaration ↵Chris Lattner2009-03-291-4/+10
| | | | | | | | processing into ParseForStatement. Merge two tests into one. llvm-svn: 68010
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | productions (except the already broken ObjC cases like @class X,Y;) in the parser that can produce more than one Decl return a DeclGroup instead of a Decl, etc. This allows elimination of the Decl::NextDeclarator field, and exposes various clients that should look at all decls in a group, but which were only looking at one (such as the dumper, printer, etc). These have been fixed. Still TODO: 1) there are some FIXME's in the code about potentially using DeclGroup for better location info. 2) ParseObjCAtDirectives should return a DeclGroup due to @class etc. 3) I'm not sure what is going on with StmtIterator.cpp, or if it can be radically simplified now. 4) I put a truly horrible hack in ParseTemplate.cpp. I plan to bring up #3/4 on the mailing list, but don't plan to tackle #1/2 in the short term. llvm-svn: 68002
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-6/+6
| | | | | | | | | | | | | | | | | | | | pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. llvm-svn: 67952
* random cleanups.Chris Lattner2009-03-241-15/+18
| | | | llvm-svn: 67624
* rename PrettyStackTraceDecl -> PrettyStackTraceActionsDecl.Chris Lattner2009-03-051-3/+3
| | | | | | | | | | | | | | | | Introduce a new PrettyStackTraceDecl. Use it to add the top level LLVM IR generation stuff in Backend.cpp to stack traces. We now get crashes like: Stack dump: 0. Program arguments: clang t.c -emit-llvm 1. <eof> parser at end of file 2. t.c:1:5: LLVM IR generation of declaration 'a' Abort for IR generation crashes. llvm-svn: 66153
* When parsing a function body, add it to the crash stack, giving us somethingChris Lattner2009-03-051-0/+4
| | | | | | | | | | | | | like: Stack dump: 0. t.c:5:10: in compound statement ('{}') 1. t.c:3:12: in compound statement ('{}') 2. t.c:3:12: parsing function body 'foo' 3. clang t.c Abort llvm-svn: 66118
* Simplify the interface to ParseFunctionStatementBody to not take Chris Lattner2009-03-051-3/+6
| | | | | | | locations that are the current tok loc. Note that inline C++ methods have a big fixme that could cause a crash. llvm-svn: 66113
* 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
OpenPOWER on IntegriCloud