summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixup Sema and CodeGen for block literal attributes when the returnMike Stump2009-04-291-7/+6
| | | | | | | | type and argument types are missing, and let return type deduction happen before we give errors for returning from a noreturn block. Radar 6441502 llvm-svn: 70413
* Sema and CodeGen support for attributes on blocks. Radar 6441502Mike Stump2009-04-291-0/+6
| | | | llvm-svn: 70403
* Implement sema checking for noreturn.Mike Stump2009-04-291-2/+7
| | | | llvm-svn: 70353
* Improve validation of C++ exception handling: diagnose throwing incomplete ↵Sebastian Redl2009-04-271-0/+1
| | | | | | types and jumps into protected try-catch scopes. llvm-svn: 70242
* implement PR4077: [Linux kernel] inscrutable error on inline asm ↵Chris Lattner2009-04-261-0/+18
| | | | | | | | | | | | | | | | | input/output constraint mismatch Before we emitted: $ clang t.c -S -m64 llvm: error: Unsupported asm: input constraint with a matching output constraint of incompatible type! Now we produce: $ clang t.c -S -m64 t.c:5:40: error: unsupported inline asm: input with type 'unsigned long' matching output with type 'int' asm volatile("foo " : "=a" (a) :"0" (b)); ~~~ ~^~ llvm-svn: 70142
* in a tied operand, don't copy over the name or constraint string, just the ↵Chris Lattner2009-04-261-1/+0
| | | | | | flags. llvm-svn: 70137
* pull operands names "[foo]" into ConstraintInfo.Chris Lattner2009-04-261-6/+6
| | | | llvm-svn: 70136
* pull the constraint string into the ConstraintInfo structChris Lattner2009-04-261-15/+14
| | | | | | instead of passing it around in addition to it. llvm-svn: 70135
* change TargetInfo::ConstraintInfo to be a struct that containsChris Lattner2009-04-261-9/+8
| | | | | | the enum along with some other data. llvm-svn: 70114
* split ObjC and C++ Statements out into their own headers.Chris Lattner2009-04-261-1/+2
| | | | llvm-svn: 70105
* implement semantic analysis for @synchronized, fixing a crash on invalidChris Lattner2009-04-211-0/+9
| | | | | | rdar://6810940 - @synchronized has no sema checks llvm-svn: 69670
* add support for goto checking and @synchronized blocks,Chris Lattner2009-04-211-0/+2
| | | | | | rdar://6810106 llvm-svn: 69667
* add a new Sema::CurFunctionNeedsScopeChecking bool that is used to avoid Chris Lattner2009-04-191-0/+1
| | | | | | | calling into the jump checker when a function or method is known to contain no VLAs or @try blocks. llvm-svn: 69509
* Add location info for indirect goto.Chris Lattner2009-04-191-2/+2
| | | | llvm-svn: 69497
* abstract the SwitchStack for blocks just like we do the goto labels.Chris Lattner2009-04-181-7/+7
| | | | | | This fixes a crash on invalid (test10). rdar://6805469 llvm-svn: 69465
* refactor some code, adding a new getLabelMap() accessor methodChris Lattner2009-04-181-3/+2
| | | | | | | so that clients can't poke the function-local one when they really want the current block label. No functionality change. llvm-svn: 69463
* if we already know that a decl is invalid in an @catch, don't verify its type.Chris Lattner2009-04-121-1/+5
| | | | llvm-svn: 68925
* add a new isNull() method to DeclGroupRef.Chris Lattner2009-04-121-2/+3
| | | | llvm-svn: 68909
* Parse deleted member functions. Parsing member declarations goes through a ↵Sebastian Redl2009-04-121-3/+44
| | | | | | | | | different code path that I forgot previously. Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now. The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though. llvm-svn: 68902
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-23/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+7
| | | | | | | | | | | | | | | | | | | | 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
* rename some methods.Chris Lattner2009-03-281-2/+2
| | | | llvm-svn: 67923
* Sanity-check argument to indirect goto.Eli Friedman2009-03-261-3/+7
| | | | llvm-svn: 67746
* Fix for PR3869: actually enforce that the argument of an indirect goto Eli Friedman2009-03-261-2/+4
| | | | | | is of type void*. I'll try to add the appropriate checking later. llvm-svn: 67721
* introduce a new -fheinous-gnu-extensions flag that enables reallyChris Lattner2009-03-131-6/+33
| | | | | | | | | | | really horrible extensions that are disabled by default but that can be accepted by -fheinous-gnu-extensions (but which always emit a warning when enabled). As our first instance of this, implement PR3788/PR3794, which allows non-lvalues in inline asms in contexts where lvalues are required. bleh. llvm-svn: 66910
* Reimplement fix for <rdar://problem/6451399> problems with labels and blocks.Steve Naroff2009-03-131-2/+3
| | | | | | | | This solution is much simpler (and doesn't add any per-scope overhead, which concerned Chris). The only downside is the LabelMap is now declared in two places (Sema and BlockSemaInfo). My original fix tried to unify the LabelMap in "Scope" (which would support nested functions in general). In any event, this fixes the bug given the current language definition. If/when we decide to support GCC style nested functions, this will need to be tweaked. llvm-svn: 66896
* Remove ActiveScope (revert ↵Steve Naroff2009-03-131-18/+6
| | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741). Will replace with something better today... llvm-svn: 66893
* position the caret properly on asm string diagnostics, e.g.:Chris Lattner2009-03-101-3/+2
| | | | | | | | Sema/asm.c:64:9: error: invalid % escape in inline assembly string asm("%!" : ); // expected-error {{invalid % escape in inline assembly string}} ~~^~ llvm-svn: 66606
* add plumbing to report diagnostics back through sema for malformed asmstrings.Chris Lattner2009-03-101-4/+18
| | | | llvm-svn: 66598
* Change Parser::ParseCaseStatement to use an iterative approach to parsingChris Lattner2009-03-041-10/+14
| | | | | | | | | | | | | | | | | | 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
* Change a warning to an error...Steve Naroff2009-03-031-1/+1
| | | | llvm-svn: 65978
* Fix <rdar://problem/6252237> [sema] qualified id should be disallowed in ↵Steve Naroff2009-03-031-3/+8
| | | | | | @catch statements. llvm-svn: 65969
* Fix <rdar://problem/6632061> [sema] non object types should not be allowed ↵Steve Naroff2009-03-031-2/+8
| | | | | | in @catch statements. llvm-svn: 65968
* Fix <rdar://problem/6640991> Exception handling executes wrong clause ↵Steve Naroff2009-03-031-2/+2
| | | | | | | | | | | (Daniel, please verify). Also necessary to fix: <rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements llvm-svn: 65964
* Fix <rdar://problem/6635908> crash on invalidSteve Naroff2009-03-031-3/+5
| | | | llvm-svn: 65909
* ObjCAtCatchStmt's ParamStmt is always a DeclStmt.Daniel Dunbar2009-03-011-1/+1
| | | | llvm-svn: 65759
* Fix <rdar://problem/6451399> problems with labels and blocks.Steve Naroff2009-02-281-6/+18
| | | | | | | | | - Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with. - Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr(). - Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope. - Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions). llvm-svn: 65694
* Match gcc and always perform array/function conversion for asm input exprs. ↵Anders Carlsson2009-02-221-2/+2
| | | | | | Fixes PR3641. llvm-svn: 65256
* Several related changes: Chris Lattner2009-02-141-16/+8
| | | | | | | | | | | | | | | 1) implement parser and sema support for reading and verifying attribute(warnunusedresult). 2) rename hasLocalSideEffect to isUnusedResultAWarning, inverting the sense of its result. 3) extend isUnusedResultAWarning to directly return the loc and range info that should be reported to the user. Make it substantially more precise in some cases than what was previously reported. 4) teach isUnusedResultAWarning about CallExpr to decls that are pure/const/warnunusedresult, fixing a fixme. 5) change warn_attribute_wrong_decl_type to not pass in english strings, instead, pass in integers and use %select. llvm-svn: 64543
* Remove DeclGroupOwningRef, since we intend for declarations to be ownedDouglas Gregor2009-02-131-2/+2
| | | | | | | | | | | | | | | by DeclContexts (always) rather than by statements. DeclContext currently goes out of its way to avoid destroying any Decls that might be owned by a DeclGroupOwningRef. However, in an error-recovery situation, a failure in a declaration statement can cause all of the decls in a DeclGroupOwningRef to be destroyed after they've already be added into the DeclContext. Hence, DeclContext is left with already-destroyed declarations, and bad things happen. This problem was causing failures that showed up as assertions on x86 Linux in test/Parser/objc-forcollection-neg-2.m. llvm-svn: 64474
* Sema::ActOnObjCAtThrowStmt(): return from recently added errors. Thanks Chris!Steve Naroff2009-02-121-3/+3
| | | | llvm-svn: 64389
* Turn warning into error. Minor incompatibility with GCC (for scalar types, ↵Steve Naroff2009-02-121-4/+2
| | | | | | GCC only produces a warning). llvm-svn: 64375
* Fix <rdar://problem/6243503> [sema] @throw; accepted outside catch block.Steve Naroff2009-02-111-2/+9
| | | | llvm-svn: 64318
* Fix <rdar://problem/6206858> [sema] type check @throw statements.Steve Naroff2009-02-111-3/+16
| | | | | | Added a FIXME to handle 'rethrow' check. llvm-svn: 64308
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-38/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Add support for blocks with explicit return types.Mike Stump2009-02-041-15/+16
| | | | llvm-svn: 63784
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+0
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* If an input constraint refers to an output constraint, it should have the ↵Anders Carlsson2009-01-271-1/+7
| | | | | | same constraint info as the output constraint. Fixes PR3417 llvm-svn: 63127
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Fix an inline asm sema bug that I introduced.Anders Carlsson2009-01-211-2/+2
| | | | llvm-svn: 62666
OpenPOWER on IntegriCloud