summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix a comment.Chris Lattner2011-02-211-2/+2
| | | | llvm-svn: 126143
* Clean up the tests for warning about unused function results given theChandler Carruth2011-02-211-0/+2
| | | | | | | | appropriate attribute. Add a bit more testing that finds a pretty bad regression (since ~forever) in this warning. Fix it with a nice 2 line change. =] llvm-svn: 126098
* Add a new ObjCExceptions member variable to LangOptions. This controls ↵Anders Carlsson2011-02-191-0/+6
| | | | | | whether Objective-C exceptions are enabled or not (they are by default). llvm-svn: 126061
* There's no need to return early if we encounter a try/throw and exceptions ↵Anders Carlsson2011-02-191-1/+1
| | | | | | are disabled. llvm-svn: 126053
* Disallow try/catch/throw when exceptions are disabled.Anders Carlsson2011-02-191-0/+3
| | | | llvm-svn: 126039
* Switch labels over to using normal name lookup, instead of their Chris Lattner2011-02-181-35/+2
| | | | | | | own weird little DenseMap. Hey look, we now emit unused label warnings deterministically, amazing. llvm-svn: 125813
* Step #2/N of __label__ support: keep pushing LabelDecl forward,Chris Lattner2011-02-171-25/+18
| | | | | | | | | | making them be template instantiated in a more normal way and make them handle attributes like other decls. This fixes the used/unused label handling stuff, making it use the same infrastructure as other decls. llvm-svn: 125771
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-24/+26
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* Fix whitespace.NAKAMURA Takumi2011-01-271-85/+85
| | | | llvm-svn: 124364
* 7bit-ize.NAKAMURA Takumi2011-01-271-1/+1
| | | | llvm-svn: 124363
* Generalize the NRVO move-construction-based initialization routine. No ↵Douglas Gregor2011-01-211-30/+32
| | | | | | functionality change llvm-svn: 123996
* Implement the preference for move-construction over copy-constructionDouglas Gregor2011-01-211-12/+84
| | | | | | | | | | | | when returning an NRVO candidate expression. For example, this properly picks the move constructor when dealing with code such as MoveOnlyType f() { MoveOnlyType mot; return mot; } The previously-XFAIL'd rvalue-references test case now works, and has been moved into the appropriate paragraph-specific test case. llvm-svn: 123992
* We love parenthesesDouglas Gregor2011-01-211-2/+2
| | | | llvm-svn: 123983
* Promote the static getNRVOCandidate() function, which computed theDouglas Gregor2011-01-211-21/+30
| | | | | | | | | | | | | NRVO candidate for a return statement, to Sema::getCopyElisionCandidate(), and teach it enough to also determine the NRVO candidate for a throw expression. We still don't use the latter information, however. Along the way, implement core issue 1148, which eliminates copy elision from catch parameters and clarifies that copy elision cannot occur from function parameters (which we already implemented). llvm-svn: 123982
* Refactor the application of type attributes so that attributes fromJohn McCall2011-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | the declaration-specifiers and on the declarator itself are moved to the appropriate declarator chunk. This permits a greatly simplified model for how to apply these attributes, as well as allowing a much more efficient query for the GC attribute. Now all qualifier queries follow the same basic strategy of "local qualifiers, local qualifiers on the canonical type, then look through arrays". This can be easily optimized by changing the canonical qualified-array-type representation. Do not process type attributes as decl attributes on declarations with declarators. When computing the type of a block, synthesize a prototype function declarator chunk if the decl-spec type was not a function. This simplifies the logic for building block signatures. Change the logic which inserts an objc_read_weak on a block literal to only fire if the block has a __weak __block variable, rather than if the return type of the block is __weak qualified, which is not actually a sensible thing to ask. llvm-svn: 122871
* Sundry missing lvalue-to-rvalue conversions. Also leave a TODO for the vitalJohn McCall2010-12-151-0/+4
| | | | | | | future task of performing contextual conversion to size_t in a VLA size expression. :) llvm-svn: 121836
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-151-1/+3
| | | | | | | | | | | | | | | | | | whether the expression contains an unexpanded parameter pack, in the same vein as the changes to the Type hierarchy. Compute this bit within all of the Expr subclasses. This change required a bunch of reshuffling of dependency calculations, mainly to consolidate them inside the constructors and to fuse multiple loops that iterate over arguments to determine type dependence, value dependence, and (now) containment of unexpanded parameter packs. Again, testing is painfully sparse, because all of the diagnostics will change and it is more important to test the to-be-written visitor that collects unexpanded parameter packs. llvm-svn: 121831
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-101-1/+1
| | | | | | | | | | space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. llvm-svn: 121478
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-6/+6
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121121
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-7/+7
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-1/+16
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-7/+5
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-4/+3
| | | | llvm-svn: 120084
* Revert r119838 "Don't warn for empty 'if' body if there is a macro that ↵Argyrios Kyrtzidis2010-11-201-7/+6
| | | | | | | | | | expands to nothing" and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! llvm-svn: 119887
* Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:Argyrios Kyrtzidis2010-11-191-5/+11
| | | | | | | | | if (condition) CALL(0); // empty macro but don't warn for empty body. Fixes rdar://8436021. llvm-svn: 119838
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-101-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Emit error when using a bound member function for something other than ↵Argyrios Kyrtzidis2010-11-011-0/+6
| | | | | | | | calling it. Also avoids IRGen crashes due to accepting invalid code. llvm-svn: 117943
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-2/+2
| | | | | | ambiguous context. llvm-svn: 116567
* Track the location of the context requiring an implicit conversion and use itJohn McCall2010-10-081-2/+9
| | | | | | to white-list conversions required by system headers. rdar://problem/8232669 llvm-svn: 116029
* Factor out enumerator APSInt adjustment intoGabor Greif2010-10-011-11/+17
| | | | | | | | | | | a helper function (AdjustAPSInt) and use that for adjusting the high bounds of case ranges before APSInt comparisons. Fixes http://llvm.org/bugs/show_bug.cgi?id=8135 Some minor refacorings while I am here. llvm-svn: 115355
* Don't warn for an unused label if it has 'unused' attribute. Fixes ↵Argyrios Kyrtzidis2010-09-281-2/+25
| | | | | | rdar://8483139. llvm-svn: 114954
* Implement -Wunused-label.Argyrios Kyrtzidis2010-09-191-0/+1
| | | | llvm-svn: 114315
* Warn when an expression result in a LabelStmt is unused.Argyrios Kyrtzidis2010-09-191-0/+3
| | | | llvm-svn: 114314
* improve the "enumeration value 'g' not handled in switch"Chris Lattner2010-09-161-4/+28
| | | | | | warning to handle multiple enumerators with one warning. llvm-svn: 114093
* Do not warn about empty bodies for 'if' statements if the body is expanded ↵Ted Kremenek2010-09-161-1/+4
| | | | | | | | from a macro. Fixes <rdar://problem/8436021>. llvm-svn: 114049
* Fix indentation.Ted Kremenek2010-09-091-28/+28
| | | | llvm-svn: 113476
* Remove tabs I accidentally introduced.Ted Kremenek2010-09-091-29/+29
| | | | llvm-svn: 113467
* When building SwitchStmts in Sema, record whether all the enum values of a ↵Ted Kremenek2010-09-091-35/+47
| | | | | | | | | | switch(enum) where covered by individual case statements. Flow-based analyses may wish to consult this information, and recording this in the AST allows us to obviate reconstructing this information later when we build the CFG. llvm-svn: 113447
* "I see dead code". IdempotentOperationChecker::isTruncationExtensionAssignmentChris Lattner2010-09-031-1/+0
| | | | | | | | | should probably be removed if it has no purpose, but I just #if'd it out in case it's usefulIdempotentOperationChecker::isTruncationExtensionAssignment should probably be removed if it has no purpose, but I just #if'd it out in case it's useful llvm-svn: 112949
* Devirtualize Sema, kill off DeleteExpr and DeleteStmt, and reformat.John McCall2010-09-031-2/+0
| | | | llvm-svn: 112945
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-2/+2
| | | | | | to the new constants. llvm-svn: 112047
* Split FunctionScopeInfo and BlockScopeInfo into their own header.John McCall2010-08-251-15/+18
| | | | llvm-svn: 112038
* More header elimination. The goal of all this is to allow Parser toJohn McCall2010-08-241-0/+1
| | | | | | | #include Sema.h while keeping all the AST declarations opaque. That may not be reasonably attainable, though. llvm-svn: 111907
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-36/+36
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall2010-08-231-123/+75
| | | | llvm-svn: 111863
* DeclPtrTy -> Decl *John McCall2010-08-211-17/+17
| | | | llvm-svn: 111733
* Typo.Fariborz Jahanian2010-08-121-1/+1
| | | | llvm-svn: 110965
* Patch to issue warning when colllection expresion's typeFariborz Jahanian2010-08-121-0/+21
| | | | | | | does not implement 'countByEnumeratingWithState' API. Implements radar 7634669. llvm-svn: 110964
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
OpenPOWER on IntegriCloud