summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix PR6782, an accept invalid. We weren't emitting the diagnostic Chris Lattner2010-04-051-1/+1
| | | | | | returned by SetTypeSpecType. llvm-svn: 100443
* Don't skip past the '}' if an expression has error and is not followed by ';'.Argyrios Kyrtzidis2010-03-311-3/+5
| | | | llvm-svn: 99972
* Clean up ownership of 'AttributeList' objects in Parser. ApparentlyTed Kremenek2010-02-111-15/+44
| | | | | | | | | | | | | | | | | | | | | we would just leak them all over the place, with no clear ownership of these objects at all. AttributeList objects would get leaked on both error and non-error paths. Note: I introduced the usage of llvm::OwningPtr<AttributeList> to manage these objects, which is particularly useful for methods with multiple return sites. In at least one method I used them even when they weren't strictly necessary because it clarified the ownership semantics and made the code easier to read. Should the excessive 'take()' and 'reset()' calls become a performance issue we can always re-evaluate. Note+1: I believe I have not introduced any double-frees, but it would be nice for someone to review this. This fixes <rdar://problem/7635046>. llvm-svn: 95847
* Use IdentifierInfo * instead of std::string for the AsmStmt names.Anders Carlsson2010-01-301-8/+7
| | | | llvm-svn: 94925
* fix PR6034, a crash on invalid where the switch stack would get Chris Lattner2010-01-241-8/+8
| | | | | | unbalanced. llvm-svn: 94347
* Improve code completion by introducing patterns for the various C andDouglas Gregor2010-01-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | C++ grammatical constructs that show up in top-level (namespace-level) declarations, member declarations, template declarations, statements, expressions, conditions, etc. For example, we now provide a pattern for static_cast<type>(expr) when we can have an expression, or using namespace identifier; when we can have a using directive. Also, improves the results of code completion at the beginning of a top-level declaration. Previously, we would see value names (function names, global variables, etc.); now we see types, namespace names, etc., but no values. llvm-svn: 93134
* Remember if the AsmStmt came from Microsoft-style inline assembly code.Mike Stump2010-01-041-1/+1
| | | | llvm-svn: 92526
* fix PR5500: clang fails to parse inline asm with :: in C++ mode Chris Lattner2009-12-201-7/+22
| | | | llvm-svn: 91802
* refactor asm stmt parsing to avoid nesting as much, andChris Lattner2009-12-201-39/+38
| | | | | | pull ':' eating out of ParseAsmOperandsOpt. llvm-svn: 91801
* Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename ↵Anders Carlsson2009-12-161-8/+8
| | | | | | Action::FullExpr to Action::MakeFullExpr to avoid name clashes. llvm-svn: 91494
* Implement just a bit more of inline assembly.Mike Stump2009-12-111-1/+14
| | | | llvm-svn: 91079
* fix PR5740: a colon is sacred when parsing case statement expressions!Chris Lattner2009-12-101-0/+7
| | | | llvm-svn: 91016
* rename ExtensionRAIIObject.h -> RAIIObjectsForParser.hChris Lattner2009-12-101-1/+1
| | | | llvm-svn: 91008
* When the condition of a switch() statement is semantically invalid,Douglas Gregor2009-11-251-3/+1
| | | | | | | still parse the body of the switch to try to avoid spurious diagnostics. Fixes PR5606. llvm-svn: 89847
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-28/+38
| | | | | | | | | | | | | | | | | All statements that involve conditions can now hold on to a separate condition declaration (a VarDecl), and will use a DeclRefExpr referring to that VarDecl for the condition expression. ForStmts now have such a VarDecl (I'd missed those in previous commits). Also, since this change reworks the Action interface for if/while/switch/for, use FullExprArg for the full expressions in those expressions, to ensure that we're emitting Note that we are (still) not generating the right cleanups for condition variables in for statements. That will be a follow-on commit. llvm-svn: 89817
* "Do" loops cannot have condition variables, so don't parse them.Douglas Gregor2009-11-241-4/+3
| | | | llvm-svn: 89801
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-37/+76
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Don't issue spurious diagnostic with Obj-C fast enumeration.Fariborz Jahanian2009-11-191-0/+1
| | | | | | (radar 7409165). llvm-svn: 89400
* Reorganize the parsing of decl groups / function definitions so thatJohn McCall2009-11-031-2/+1
| | | | | | | declarators are parsed primarily within a single function (at least for these cases). Remove some excess diagnostics arising during parse failures. llvm-svn: 85924
* PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar2009-10-181-1/+1
| | | | | | are updated. llvm-svn: 84447
* Move misc clients to IdentifierInfo StringRef API.Daniel Dunbar2009-10-181-1/+3
| | | | | | | | | - strcmp -> == - OS.write(II->getName() ...) -> OS << II->getNameStr() - Avoid std::string concatenation - Use getNameStr().str() when an std::string is really needed. llvm-svn: 84437
* Code completion for ordinary names when we're starting a declaration, ↵Douglas Gregor2009-09-211-0/+10
| | | | | | expression, or statement llvm-svn: 82481
* Code completion for "case" statements within a switch on an expressionDouglas Gregor2009-09-211-0/+5
| | | | | | of enumeration type, providing the various unused enumerators as options. llvm-svn: 82467
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-47/+47
| | | | llvm-svn: 81346
* Change ActOnReturnStmt to not take a FullExprArg. Instead, Sema will wrap ↵Anders Carlsson2009-08-181-1/+1
| | | | | | the return expr inside a CXXExprWithTemporaries if needed. llvm-svn: 79342
* change ParseStatementOrDeclaration to emit the 'missing ;' withChris Lattner2009-06-141-1/+5
| | | | | | | | | | | | | | | | | | | ExpectAndConsume instead of custom diag logic. This gets us an insertion hint and positions the ; at the end of the line instead of on the next token. Before: t.c:5:1: error: expected ';' after return statement } ^ after: t.c:4:11: error: expected ';' after return statement return 4 ^ ; llvm-svn: 73315
* improve localizability by not passing english phrases into Chris Lattner2009-06-141-7/+7
| | | | | | diagnostics in some cases. llvm-svn: 73314
* add the location of the ')' in a do/while statement to DoStmt.Chris Lattner2009-06-121-4/+10
| | | | | | This fixes a source range problem reported by Olaf Krzikalla. llvm-svn: 73266
* Make sure to call FullExpr before parsing anything else.Anders Carlsson2009-06-041-2/+6
| | | | llvm-svn: 72834
* 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
OpenPOWER on IntegriCloud