summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/RewriteObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Break Frontend's dependency on Rewrite, Checker and CodeGen in shared ↵Daniel Dunbar2010-06-151-5778/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | library configuration Currently, all AST consumers are located in the Frontend library, meaning that in a shared library configuration, Frontend has a dependency on Rewrite, Checker and CodeGen. This is suboptimal for clients which only wish to make use of the frontend. CodeGen in particular introduces a large number of unwanted dependencies. This patch breaks the dependency by moving all AST consumers with dependencies on Rewrite, Checker and/or CodeGen to their respective libraries. The patch therefore introduces dependencies in the other direction (i.e. from Rewrite, Checker and CodeGen to Frontend). After applying this patch, Clang builds correctly using CMake and shared libraries ("cmake -DBUILD_SHARED_LIBS=ON"). N.B. This patch includes file renames which are indicated in the patch body. Changes in this revision of the patch: - Fixed some copy-paste mistakes in the header files - Modified certain aspects of the coding to comply with the LLVM Coding Standards llvm-svn: 106010
* Refactoring of block-pointer type rewrite.Fariborz Jahanian2010-05-251-37/+25
| | | | llvm-svn: 104614
* Patch to rewrite block pointers as arguments toFariborz Jahanian2010-05-251-2/+57
| | | | | | methods. (Radar 7987817). llvm-svn: 104608
* Fix a rewriting bug where a local static objective-cFariborz Jahanian2010-05-241-0/+6
| | | | | | pointer is copied into a block. Fixes radar 7924024. llvm-svn: 104526
* Fix an objective-c rewriter bug when pre-processed file's Fariborz Jahanian2010-05-241-3/+5
| | | | | | | class declaration's @end is not followed by a new-line. (radar 7946975). llvm-svn: 104512
* Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointedJohn McCall2010-05-171-7/+7
| | | | | | out. The remaining ones are okay. llvm-svn: 103973
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-8/+8
| | | | llvm-svn: 103517
* Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor2010-04-261-1/+1
| | | | | | | | thing. Audit all uses of Type::isStructure(), changing those calls to isStructureOrClassType() as needed (which is alsmost everywhere). Fixes the remaining failure in Boost.Utility/Swap. llvm-svn: 102386
* Make the static type of the exception variable in an Objective-CDouglas Gregor2010-04-261-1/+1
| | | | | | | @catch a VarDecl. The dynamic type is still a ParmVarDecl, but that will change soon. No effective functionality change. llvm-svn: 102341
* Add BasePath arguments to all cast expr constructors.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102258
* CastExpr should not hold a pointer to the base path. More cleanup.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102249
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-13/+11
| | | | | | | | | | 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
* Add an InheritancePath parameter to the ImplicitCastExpr constructor.Anders Carlsson2010-04-231-4/+4
| | | | llvm-svn: 102218
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-204/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 track of the actual storage specifier written on a variable orDouglas Gregor2010-04-191-17/+30
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Use ASTVector instead of std::vector for the Exprs in InitListExpr. PerformanceTed Kremenek2010-04-131-6/+8
| | | | | | | measurements of '-fsyntax-only' on combine.c (403.gcc) shows no real performance change, but now the vector isn't leaked. llvm-svn: 101195
* make the rewriter add a #ifndef around the #define of __attribute__.Chris Lattner2010-04-131-0/+2
| | | | | | | Without it, there is no reason for a compiler that supports it to emit the dead static globals that the rewriter labels attribute(used). llvm-svn: 101149
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-26/+25
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Let SourceManager::getBufferData return StringRef instead of a pair of two ↵Benjamin Kramer2010-03-161-7/+6
| | | | | | const char*. llvm-svn: 98630
* Give SourceManager a Diagnostic object with which to report errors,Douglas Gregor2010-03-161-15/+3
| | | | | | and start simplifying the interfaces in SourceManager that can fail. llvm-svn: 98594
* Introduce a new BufferResult class to act as the return type ofDouglas Gregor2010-03-151-3/+14
| | | | | | | | | | | | | | SourceManager's getBuffer() (and similar) operations. This abstract can be used to force callers to cope with errors in getBuffer(), such as missing files and changed files. Fix a bunch of callers to use the new interface. Add some very basic checks for file consistency (file size, modification time) into ContentCache::getBuffer(), although these checks don't help much until we've updated the main callers (e.g., SourceManager::getSpelling()). llvm-svn: 98585
* Add tentative support for accessing local variables withFariborz Jahanian2010-03-111-7/+63
| | | | | | | external linkage (static, extern, etc.) in blocks in rewriter. wip. llvm-svn: 98265
* Change the 'super' messaging API in the rewriter.Fariborz Jahanian2010-03-101-23/+62
| | | | | | Fixes radar 7738452. llvm-svn: 98190
* Patch to get around a rewriter bug rewriting storage classFariborz Jahanian2010-03-041-6/+15
| | | | | | on a block API struct definition. llvm-svn: 97754
* Fixes a bug whereby static const block var has static Fariborz Jahanian2010-03-041-0/+17
| | | | | | moved incorrectly. (radar 7714443). llvm-svn: 97734
* Cast a pointer to 'long long' to satisfy all compilation models.Fariborz Jahanian2010-03-021-1/+3
| | | | | | Satisfies radar 7703202. llvm-svn: 97532
* More rewriter of nested blocks fun stuff.Fariborz Jahanian2010-03-011-19/+28
| | | | | | Radar 7696893. llvm-svn: 97520
* Prevent rewriter crash when variable type is missing.Fariborz Jahanian2010-02-261-0/+4
| | | | | | Fixes radar 7692183. llvm-svn: 97281
* Minor cleanup of the rewriter.Fariborz Jahanian2010-02-261-18/+22
| | | | llvm-svn: 97280
* Removed some unused code in rewriter.Fariborz Jahanian2010-02-261-28/+2
| | | | llvm-svn: 97274
* Fix rewriting of byref variables in nested blocks.Fariborz Jahanian2010-02-261-2/+9
| | | | | | Fixes radar 7692350. llvm-svn: 97254
* Rewriting of imported variable from outerFariborz Jahanian2010-02-261-0/+1
| | | | | | | blocks's argument in the inner block requires special treatment. Fixes radar 7692419. llvm-svn: 97244
* Support rewriting of property synthesis with retain/copyFariborz Jahanian2010-02-261-25/+98
| | | | | | attributes. Fixes radar 7214439. llvm-svn: 97203
* Implement nasty rewriting of nested blocks when innerFariborz Jahanian2010-02-241-4/+76
| | | | | | | blocks use variables not used in any of the outer blocks. (Fixes radar 7682149). llvm-svn: 97073
* Fix rewriting of a method when return type isFariborz Jahanian2010-02-241-0/+4
| | | | | | a block pointer type. Fixes radar 7682149. llvm-svn: 97008
* Fixes a rewriting of qualified-id type which exposed a biggerFariborz Jahanian2010-02-231-5/+0
| | | | | | rewriting problem. Fixes radar 7680953. llvm-svn: 96987
* Fixes a rewriting of byref variable when its initializer isFariborz Jahanian2010-02-221-13/+29
| | | | | | itself rewritten. Radar 7669784. llvm-svn: 96798
* Eliminate the default arguments to ASTContext::getFunctionType(),Douglas Gregor2010-02-211-13/+37
| | | | | | | | fixing up a few callers that thought they were propagating NoReturn information but were in fact saying something about exception specifications. llvm-svn: 96766
* Revert: "Change InitListExpr to allocate the array for holding references"Ted Kremenek2010-02-191-10/+6
| | | | | | | | This was causing buildbot breakage. This reverts commit d46e952cc8cb8d9eed8657d9a0b267910a0f745a. llvm-svn: 96652
* Change InitListExpr to allocate the array for holding referencesTed Kremenek2010-02-191-6/+10
| | | | | | | | | | | | | | | | to initializer expressions in an array allocated using ASTContext. This plugs a memory leak when ASTContext uses a BumpPtrAllocator to allocate memory for AST nodes. In my mind this isn't an ideal solution; it would be nice to have a general "vector"-like class that allocates memory using ASTContext, but whose guts could be separated from the methods of InitListExpr itself. I haven't gone and taken this approach yet because it isn't clear yet if we'll eventually want an alternate solution for recylcing memory using by InitListExprs as we are constructing the ASTs. llvm-svn: 96642
* Patch removes IVars list from ObjCInterfaceDecl andFariborz Jahanian2010-02-191-3/+3
| | | | | | instead relies on their DeclContext for iteration, etc. llvm-svn: 96638
* __typeof should be able to handle block pointer types whenFariborz Jahanian2010-02-181-1/+1
| | | | | | rewriting. Fixes radar 7659483. llvm-svn: 96549
* Minor rewriter cleanup and a test for a block rewriting bug.Fariborz Jahanian2010-02-161-1/+1
| | | | llvm-svn: 96361
* Fix rewriter bug when function call inside block with block parameter Fariborz Jahanian2010-02-161-4/+41
| | | | | | causes C++ compile error (radar 7651312). llvm-svn: 96352
* Fix a broken rewritin of @implementation keyword.Fariborz Jahanian2010-02-151-1/+1
| | | | | | (fixes radar 7649577). llvm-svn: 96270
* Pass StringRefs to InsertText/ReplaceText in RewriteObjC and remove a ton of ↵Benjamin Kramer2010-02-141-120/+91
| | | | | | unnecessary length arguments. llvm-svn: 96164
* Fixes a rewriter bug rewriting function decl.Fariborz Jahanian2010-02-121-2/+14
| | | | | | | with block-pointer-type as one or more of its arguments. Fixes radar 7638400. llvm-svn: 95992
* Fixes a rewriting bug where order of constructor expression arguments did ↵Fariborz Jahanian2010-02-111-15/+28
| | | | | | | | | | not match order of constructor arguments (all block API specific). This was exposed only in a large block literal expression in a large file where PtrSet container size execceded its limit and required reallocation. Fixes radar 7638294 llvm-svn: 95936
* Allocate the SubExprs array in ObjCMessageExpr using the allocator ↵Ted Kremenek2010-02-111-2/+2
| | | | | | associated with ASTContext. This fixes yet another leak (<rdar://problem/7639260>). llvm-svn: 95930
* Eliminate a bunch of unnecessary ASTContexts from members functions ofDouglas Gregor2010-02-111-2/+2
| | | | | | Decl subclasses. No functionality change. llvm-svn: 95841
OpenPOWER on IntegriCloud