summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriterStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added a field to BlockDeclRefExpr for future use.Fariborz Jahanian2010-06-041-0/+1
| | | | | | No functionality change yet. llvm-svn: 105479
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-0/+1
| | | | | | | | | | | | 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-0/+1
| | | | | | | | | | "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
* pch'ify CXXNewExpr and CXXZeroInitValueExprChris Lattner2010-05-101-2/+38
| | | | llvm-svn: 103390
* pchify CXXTemporary, CXXBindTemporaryExpr, and Chris Lattner2010-05-101-2/+26
| | | | | | CXXExprWithTemporaries. llvm-svn: 103387
* pch'ify default argument definitions and uses.Chris Lattner2010-05-091-0/+15
| | | | llvm-svn: 103376
* pch'ify 'this' and 'throw'Chris Lattner2010-05-091-0/+16
| | | | llvm-svn: 103375
* pch'ify typeid.Chris Lattner2010-05-091-0/+13
| | | | llvm-svn: 103374
* pchify CXXMemberCallExpr correctly. Before it would serializeChris Lattner2010-05-091-0/+6
| | | | | | | and deserialize as a CallExpr which is close, but ends up deserializing with the wrong stmt class. llvm-svn: 103371
* Teach __builtin_offsetof to compute the offsets of members of baseDouglas Gregor2010-04-291-0/+5
| | | | | | | | classes, since we only warn (not error) on offsetof() for non-POD types. We store the base path within the OffsetOfExpr itself, then evaluate the offsets within the constant evaluator. llvm-svn: 102571
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-281-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-3/+6
| | | | | | | | | | 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
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Keep proper source location information for the type in an Objective-CDouglas Gregor2010-04-201-1/+1
| | | | | | @encode expression. llvm-svn: 101907
* Extend ObjCMessageExpr for class method sends with the source locationDouglas Gregor2010-03-081-2/+3
| | | | | | of the class name. llvm-svn: 97943
* Roll r95513 back in.Sam Weinig2010-02-071-0/+15
| | | | llvm-svn: 95515
* Roll out r95513, it seems to have broken self hosting.Sam Weinig2010-02-071-15/+0
| | | | llvm-svn: 95514
* Add PCH support for CXXBoolLiteralExpr and CXXNullPtrLiteralExpr.Sam Weinig2010-02-071-0/+15
| | | | llvm-svn: 95513
* Use IdentifierInfo * instead of std::string for the AsmStmt names.Anders Carlsson2010-01-301-3/+3
| | | | llvm-svn: 94925
* Preserve type source information in compound literal expressions.John McCall2010-01-181-0/+1
| | | | | | Patch by Enea Zaffanella! llvm-svn: 93752
* Add PCH support for CXXStaticCastExpr, CXXDynamicCastExpr, ↵Sam Weinig2010-01-161-0/+38
| | | | | | CXXReinterpretCastExpr, CXXConstCastExpr and CXXFunctionalCastExpr. llvm-svn: 93658
* Preserve type source information in explicit cast expressions.John McCall2010-01-151-1/+1
| | | | | | Patch by Enea Zaffanella. llvm-svn: 93522
* Remember if the AsmStmt came from Microsoft-style inline assembly code.Mike Stump2010-01-041-0/+1
| | | | llvm-svn: 92526
* When value-initializing a class with no user-defined constructors butDouglas Gregor2009-12-161-0/+1
| | | | | | | with a non-trivial default constructor, zero-initialize the storage and then call the default constructor. Fixes PR5800. llvm-svn: 91548
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | than using its own partial implementation of initialization. Switched CheckInitializerTypes over to InitializedEntity/InitializationKind, to help move us closer to InitializationSequence. Added InitializedEntity::getName() to retrieve the name of the entity, for diagnostics that care about such things. Implemented support for default initialization in InitializationSequence. Clean up the determination of the "source expressions" for an initialization sequence in InitializationSequence::Perform. Taught CXXConstructExpr to store more location information. llvm-svn: 91492
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-0/+1
| | | | | | | | | | | | | | | | | 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
* Clean up the AST for while loops and fix several problems withDouglas Gregor2009-11-241-0/+1
| | | | | | | | | | | | | | | | | cleanups for while loops: 1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g., while (shared_ptr<WorkInt> p = getWorkItem()) { // ... } 2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g., while (blah) RAIIObject raii(blah+1); llvm-svn: 89800
* Explicitly store the condition variable within switch statements, andDouglas Gregor2009-11-241-0/+1
| | | | | | | make sure that this variable is destroyed when we exit the switch statement. llvm-svn: 89776
* Explicitly track the condition variable within an "if" statement,Douglas Gregor2009-11-231-0/+1
| | | | | | | | | rather than burying it in a CXXConditionDeclExpr (that occassionally hides behind implicit conversions). Similar changes for switch, while, and do-while will follow, then the removal of CXXConditionDeclExpr. This commit is the canary. llvm-svn: 89717
* Preserve type source information in sizeof/alignof expressions, and pass itJohn McCall2009-11-041-1/+1
| | | | | | through to indexing. llvm-svn: 86018
* Eliminate QualifiedDeclRefExpr, which captured the notion of aDouglas Gregor2009-10-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | qualified reference to a declaration that is not a non-static data member or non-static member function, e.g., namespace N { int i; } int j = N::i; Instead, extend DeclRefExpr to optionally store the qualifier. Most clients won't see or care about the difference (since QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the number of top-level expression types that clients need to cope with, brings the implementation of DeclRefExpr into line with MemberExpr, and simplifies and unifies our handling of declaration references. Extended DeclRefExpr to (optionally) store explicitly-specified template arguments. This occurs when naming a declaration via a template-id (which will be stored in a TemplateIdRefExpr) that, following template argument deduction and (possibly) overload resolution, is replaced with a DeclRefExpr that refers to a template specialization but maintains the template arguments as written. llvm-svn: 84962
* Improve handling of initialization by constructor, by ensuring thatDouglas Gregor2009-09-091-0/+12
| | | | | | | | such initializations properly convert constructor arguments and fill in default arguments where necessary. This also makes the ownership model more clear. llvm-svn: 81394
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-26/+26
| | | | llvm-svn: 81346
* Preliminary AST representation and semantic analysis forDouglas Gregor2009-09-011-0/+1
| | | | | | | | | explicitly-specified template argument lists in member reference expressions, e.g., x->f<int>() llvm-svn: 80646
* Remember to write the qualifier of a MemberExpr to the PCH file when we get ↵Douglas Gregor2009-08-311-0/+1
| | | | | | to C++ PCH llvm-svn: 80643
* Source location information for ? and : in a ConditionalOperator, from Enea ↵Douglas Gregor2009-08-261-0/+2
| | | | | | Zaffanella llvm-svn: 80097
* normalize the CharacterLiteral::getLocation method name, patch Chris Lattner2009-08-241-1/+1
| | | | | | by Enea Zaffanella! llvm-svn: 79924
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-4/+4
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Renamed ClassProp data member of ObjCImplctSetterGetterRefExprFariborz Jahanian2009-08-181-2/+2
| | | | | | | | to InterfaceDecl, as it is unrelated to any property and holds the InterfaceDecl needed for accessing class getter/setter methods using the dot-syntax. llvm-svn: 79371
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-2/+4
| | | | | | | | Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). llvm-svn: 79365
* Add a CastKind enum to CastExpr. Right now it's not used for much but it ↵Anders Carlsson2009-07-311-0/+1
| | | | | | will be :) llvm-svn: 77650
* Allow front-end 'isa' access on object's of type 'id'.Steve Naroff2009-07-241-0/+9
| | | | | | | | Enhance test case to cover 'isa' access on interface types (clang produces an error, GCC produces a warning). Still need back-end CodeGen for ObjCIsaExpr. llvm-svn: 76979
* Read/write a CXXOperatorCallExpr from/to PCH files.Argyrios Kyrtzidis2009-07-141-0/+13
| | | | llvm-svn: 75598
* Fix PR 4489, a PCH crash during de-serialization.Douglas Gregor2009-07-011-1/+0
| | | | llvm-svn: 74664
* Added writing and reading of the ConstQualAdded flag ofFariborz Jahanian2009-06-201-0/+1
| | | | | | BlockDeclRefExpr to PCH. llvm-svn: 73800
* add the location of the ')' in a do/while statement to DoStmt.Chris Lattner2009-06-121-1/+1
| | | | | | This fixes a source range problem reported by Olaf Krzikalla. llvm-svn: 73266
* Template instantiation for IndirectGotoStmt. Now my life is complete.Douglas Gregor2009-05-161-0/+1
| | | | llvm-svn: 71917
* Template instantiation for switch statementsDouglas Gregor2009-05-151-0/+3
| | | | llvm-svn: 71916
* Template instantiation for "for" loopsDouglas Gregor2009-05-151-0/+2
| | | | llvm-svn: 71901
OpenPOWER on IntegriCloud