summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* IRGen support for functions returning objc objectFariborz Jahanian2010-08-111-9/+0
| | | | | | types. Fixes PR7865. llvm-svn: 110832
* Only run the jump-checker if there's a branch-protected scope *and* there'sJohn McCall2010-08-011-3/+11
| | | | | | | | | | a switch or goto somewhere in the function. Indirect gotos trigger the jump-checker regardless, because the conditions there are slightly more elaborate and it's too marginal a case to be worth optimizing. Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918 llvm-svn: 109962
* Fix namespace polution.Dan Gohman2010-07-261-0/+4
| | | | llvm-svn: 109440
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-4/+1
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Make the "unused result" warning a warning about run-time behavior, soDouglas Gregor2010-07-151-1/+1
| | | | | | that we don't warn when there isn't going to be any computation anyway. llvm-svn: 108442
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-6/+0
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-0/+6
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Do not use CXXZeroValueInitExpr for class types. Instead, useDouglas Gregor2010-07-071-6/+0
| | | | | | | | | CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as appropriate. Fixes PR7556, and provides a slide codegen improvement when copy-initializing a POD class type from a value-initialized temporary. Previously, we weren't eliding the copy. llvm-svn: 107827
* Implement C++ DR299, which allows an implicit conversion from a classDouglas Gregor2010-06-301-1/+2
| | | | | | | | | | | type to an integral or enumeration type in the size of an array new expression, e.g., new int[ConvertibleToInt(10)]; This is a GNU and C++0x extension. llvm-svn: 107229
* Re-improve recovery when the condition of a switch statement does notDouglas Gregor2010-06-291-4/+4
| | | | | | | | have integral or enumeration type, so that we still check the contents of the switch body. My previous patch made this worse; now we're back to where we were previously. llvm-svn: 107223
* Factor the conversion from a switch condition to an integral orDouglas Gregor2010-06-291-112/+16
| | | | | | | | enumeration type out into a separate, reusable routine. The only functionality change here is that we recover a little more aggressively from ill-formed switch conditions. llvm-svn: 107222
* With packed enums, an enumerator's value may be stored in more bitsDouglas Gregor2010-06-291-0/+2
| | | | | | than the enumeration type itself takes. Fixes PR7477. llvm-svn: 107163
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-2/+2
| | | | | | | | | types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. llvm-svn: 106595
* Alter the internal representation of the condition variable inDouglas Gregor2010-06-211-7/+8
| | | | | | | | | | | | | | | | if/while/switch/for statements to ensure that walking the children of these statements actually works. Previously, we stored the condition variable as a VarDecl. However, StmtIterator isn't able to walk from a VarDecl to a set of statements, and would (in some circumstances) walk beyond the end of the list of statements, cause Bad Behavior. In this change, we've gone back to representing the condition variables as DeclStmts. While not as memory-efficient as VarDecls, it greatly simplifies iteration over the children. Fixes the remainder of <rdar://problem/8104754>. llvm-svn: 106504
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-2/+2
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* When deciding whether an expression has the boolean nature, don't look throughJohn McCall2010-06-121-3/+1
| | | | | | explicit casts. Fixes PR7359. llvm-svn: 105871
* If a switch condition is constant, don't warn about missing enum cases.John McCall2010-05-181-18/+69
| | | | | | | | If a switch condition is constant, warn if there's no case for it. Constant switch conditions do come up in reasonable template code. llvm-svn: 104010
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement a simple form of the C++ named return value optimization forDouglas Gregor2010-05-151-1/+2
| | | | | | | | | return statements. We perform NRVO only when all of the return statements in the function return the same variable. Fixes some link failures in Boost.Interprocess (which is relying on NRVO), and probably improves performance for some C++ applications. llvm-svn: 103867
OpenPOWER on IntegriCloud