summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-76/+105
| | | | | | | | | | | | return value optimization. Sema marks return statements with their NRVO candidates (which may or may not end up using the NRVO), then, at the end of a function body, computes and marks those variables that can be allocated into the return slot. I've checked this locally with some debugging statements (not committed), but there won't be any tests until CodeGen comes along. llvm-svn: 103865
* Recognize when the named return value optimization applies in aDouglas Gregor2010-05-151-45/+37
| | | | | | | | | | "return" statement and mark the corresponding CXXConstructExpr as elidable. Teach CodeGen that eliding a temporary is different from eliding an object construction. This is just a baby step toward NRVO. llvm-svn: 103849
* Fixed DISABLE_SMART_POINTERS breakageDouglas Gregor2010-05-061-2/+4
| | | | llvm-svn: 103198
* Rework our handling of temporary objects within the conditions ofDouglas Gregor2010-05-061-49/+37
| | | | | | | | | | | | | | | | | | | if/switch/while/do/for statements. Previously, we would end up either: (1) Forgetting to destroy temporaries created in the condition (!), (2) Destroying the temporaries created in the condition *before* converting the condition to a boolean value (or, in the case of a switch statement, to an integral or enumeral value), or (3) In a for statement, destroying the condition's temporaries at the end of the increment expression (!). We now destroy temporaries in conditions at the right times. This required some tweaking of the Parse/Sema interaction, since the parser was building full expressions too early in many places. Fixes PR7067. llvm-svn: 103187
* Refactor Objective-C @catch parameter checking by detangling it fromDouglas Gregor2010-04-261-17/+5
| | | | | | | | function-parameter checking and splitting it into the normal ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch parameter rather than the ill-fitting ParmVarDecl. llvm-svn: 102347
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-10/+10
| | | | | | | | | | statements. Instead of the @try having a single @catch, where all of the @catch's were chained (using an O(n^2) algorithm nonetheless), @try just holds an array of its @catch blocks. The resulting AST is slightly more compact (not important) and better represents the actual language semantics (good). llvm-svn: 102221
* Implement PR6845. We allow matching constraints to have differentChris Lattner2010-04-231-41/+60
| | | | | | | | input and output types when the smaller value isn't mentioned in the asm string. Extend this support from integers to also allowing fp values to be mismatched (if not mentioned in the asm string). llvm-svn: 102188
* Template instantiation for the Objective-C "fast enumeration"Douglas Gregor2010-04-221-3/+6
| | | | | | | | | | statement, i.e., for (element in collection) { // do something } llvm-svn: 102138
* Template instantiation for Objective-C++ @synchronized statements.Douglas Gregor2010-04-221-1/+2
| | | | llvm-svn: 102134
* Implement template instantiation for Objective-C++ @throw statements.Douglas Gregor2010-04-221-14/+24
| | | | llvm-svn: 102133
* make our existing "switch on bool" warning work for C. SinceChris Lattner2010-04-161-1/+1
| | | | | | | the result of comparisons are 'int' in C, it doesn't work to test just the result type of the expression. llvm-svn: 101576
* Collapse the three separate initialization paths inDouglas Gregor2010-04-161-1/+5
| | | | | | | | | | | | | | | | | | TryStaticImplicitCast (for references, class types, and everything else, respectively) into a single invocation of InitializationSequence. One of the paths (for class types) was the only client of Sema::TryInitializationByConstructor, which I have eliminated. This also simplified the interface for much of the cast-checking logic, eliminating yet more code. I've kept the representation of C++ functional casts with <> 1 arguments the same, despite the fact that I hate it. That fix will come soon. To satisfy my paranoia, I've bootstrapped + tested Clang with these changes. llvm-svn: 101549
* Devote a special diagnostic to the typoJohn McCall2010-04-061-0/+17
| | | | | | | (void*) someFunction(5, 10, 15, 20); where the cast is presumably meant to be to 'void'. llvm-svn: 100574
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-3/+3
| | | | | | the C-only "optimization". llvm-svn: 100022
OpenPOWER on IntegriCloud