summaryrefslogtreecommitdiffstats
path: root/clang/Driver/RewriteObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move <root>/Driver into <root>/tools/clang-cc.Daniel Dunbar2009-03-241-4588/+0
| | | | | | Again, I tried to update cmake but it is untested. llvm-svn: 67605
* Implement template instantiation for several more kinds of expressions:Douglas Gregor2009-03-131-2/+2
| | | | | | | | | | | | - C++ function casts, e.g., T(foo) - sizeof(), alignof() More importantly, this allows us to verify that we're performing overload resolution during template instantiation, with argument-dependent lookup and the "cached" results of name lookup from the template definition. llvm-svn: 66947
* API fix: All "bodies" for functions, Objective-C methods, blocks, are assumed toTed Kremenek2009-03-121-4/+8
| | | | | | | | be CompoundStmts. I think this is a valid assumption, and felt that the API should reflect it. Others please validate this assumption to make sure I didn't break anything. llvm-svn: 66814
* Fix <rdar://problem/6640991> Exception handling executes wrong clause ↵Steve Naroff2009-03-031-4/+4
| | | | | | | | | | | (Daniel, please verify). Also necessary to fix: <rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements llvm-svn: 65964
* Create a new TypeNodes.def file that enumerates all of the types,Douglas Gregor2009-02-261-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | giving them rough classifications (normal types, never-canonical types, always-dependent types, abstract type representations) and making it far easier to make sure that we've hit all of the cases when decoding types. Switched some switch() statements on the type class over to using this mechanism, and filtering out those things we don't care about. For example, CodeGen should never see always-dependent or non-canonical types, while debug info generation should never see always-dependent types. More switch() statements on the type class need to be moved over to using this approach, so that we'll get warnings when we add a new type then fail to account for it somewhere in the compiler. As part of this, some types have been renamed: TypeOfExpr -> TypeOfExprType FunctionTypeProto -> FunctionProtoType FunctionTypeNoProto -> FunctionNoProtoType There shouldn't be any functionality change... llvm-svn: 65591
* C99 DR #316 implies that the function parameter types that are knownDouglas Gregor2009-02-251-1/+2
| | | | | | | | | | only from a function definition (that does not have a prototype) are only used to determine the compatible with other declarations of that same function. In particular, when referencing the function we pretend as if it does not have a prototype. Implement this behavior, which fixes PR3626. llvm-svn: 65460
* remove some more methods from objc decls, using the iteratorChris Lattner2009-02-201-12/+14
| | | | | | interfaces more consistently. llvm-svn: 65138
* remove some slow O(n) methods.Chris Lattner2009-02-201-9/+11
| | | | llvm-svn: 65132
* move the interace list of @class to use ObjCList.Chris Lattner2009-02-201-5/+3
| | | | llvm-svn: 65129
* privatize all of the string literal memory allocation/creationChris Lattner2009-02-181-13/+13
| | | | | | stuff behind a private static function. llvm-svn: 64898
* change the StringLiteral AST node to track all of the SourceLocations of Chris Lattner2009-02-181-13/+7
| | | | | | | | the various PPTokens that are pasted together to make it. In the course of working on this, I discovered ParseObjCStringLiteral which needs some work. I'll tackle it next. llvm-svn: 64892
* CallExpr now uses ASTContext's allocate to allocate/delete its array of ↵Ted Kremenek2009-02-091-12/+18
| | | | | | subexpressions. llvm-svn: 64162
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-106/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Move StringLiteral to allocate its internal string data using the allocator inTed Kremenek2009-02-061-15/+22
| | | | | | | | | | | ASTContext. This required changing all clients to pass in the ASTContext& to the constructor of StringLiteral. I also changed all allocations of StringLiteral to use new(ASTContext&). Along the way, I updated a bunch of new()'s in StmtSerialization.cpp to use the allocator from ASTContext& (not complete). llvm-svn: 63958
* lower the interface to getLineNumber like we did forChris Lattner2009-02-041-1/+2
| | | | | | | | getColumnNumber. This fixes a FIXME in SourceManager::getPresumedLoc because we now just decompose the sloc once. llvm-svn: 63701
* Fix <rdar://problem/6521757> clang ObjC rewriter: Mixed Mac and Windows line ↵Steve Naroff2009-02-031-4/+9
| | | | | | endings after rewrite. llvm-svn: 63657
* RewriteObjC::RewriteBlockDeclRefExpr(): Add parens to enforce precedence. ↵Steve Naroff2009-02-021-2/+9
| | | | | | | | This fixes <rdar://problem/6529468> clang ObjC rewriter: Need parenthesis around dereferences in rewritten Blocks. Also changed RewriteObjC::SynthesizeBlockFunc() to declare a pointer to the block argument even when there are no user-supplied arguments to the block. llvm-svn: 63522
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* Add #line to make the Visual Studio compiler happy.Steve Naroff2009-01-211-1/+2
| | | | | | Fixes <rdar://problem/6507668> clang ObjC rewriter: put #line statement at top of rewritten file llvm-svn: 62706
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-19/+19
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-5/+5
| | | | | | | | | | | | | | | "FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. llvm-svn: 62407
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-1/+1
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Cleanup DeclContext::addDecl and DeclContext::insert interface, from Piotr RakDouglas Gregor2009-01-121-8/+4
| | | | llvm-svn: 62122
* A few property related cleanups to ObjCContainerDecl AST.Steve Naroff2009-01-111-12/+10
| | | | llvm-svn: 62034
* Provide a new kind of iterator, the specific_decl_iterator, thatDouglas Gregor2009-01-091-3/+3
| | | | | | | | | filters the decls seen by decl_iterator with two criteria: the dynamic type of the declaration and a run-time predicate described by a member function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl considerably. It has no measurable performance impact. llvm-svn: 61994
* Don't crash when our FunctionDecl has a non-identifier nameDouglas Gregor2009-01-091-1/+2
| | | | llvm-svn: 61970
* Addressed the issue in <rdar://problem/6479085>, where we failed toDouglas Gregor2009-01-091-8/+6
| | | | | | | | | | | | | | | rewrite @class declarations that showed up within linkage specifications because those @class declarations never made it any place where the rewriter could find them. Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can live in the appropriate top-level or transparent DeclContext near the top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C declarations now show up in a traversal of the declarations in a DeclContext (they didn't before!). This way, the rewriter finds all Objective-C declarations within linkage specifications. llvm-svn: 61966
* Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).Steve Naroff2009-01-081-1/+1
| | | | | | | | Convert clients to use the standard getDeclContext() API. Doug, thanks for the review! llvm-svn: 61935
* This is a large/messy diff that unifies the ObjC AST's with DeclContext.Steve Naroff2009-01-081-2/+1
| | | | | | | | | | | | | | | - ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts. - ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext). - ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-) - Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective. - Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch(). - Simplified Sema::ActOnAtEnd() considerably. Still more work to do. - Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl. - Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl. This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction. llvm-svn: 61929
* Fix <rdar://problem/6465284> clang ObjC rewriter: objc_super messed up again.Steve Naroff2008-12-231-16/+33
| | | | llvm-svn: 61384
* Fix <rdar://problem/6463613> clang ObjC rewriter: assertion failure ↵Steve Naroff2008-12-221-0/+2
| | | | | | rewriting @selector?. llvm-svn: 61351
* Remove rewriter dependency on 'nil' macro (used when rewriting for(...))Steve Naroff2008-12-171-2/+2
| | | | llvm-svn: 61135
* Tweaks to allow us to rewrite with -x=objective-c++ enabled.Steve Naroff2008-12-171-0/+11
| | | | llvm-svn: 61113
* Fix <rdar://problem/6445502> clang ObjC rewriter: _Block_release has wrong ↵Steve Naroff2008-12-161-11/+9
| | | | | | parameter type in preamble llvm-svn: 61088
* Fix <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead ↵Steve Naroff2008-12-121-2/+2
| | | | | | of Block_destroy. llvm-svn: 60962
* Rename a local predicate to avoid confusion with Type::isBlockPointerType().Steve Naroff2008-12-111-17/+17
| | | | llvm-svn: 60899
* Fixup generated code for imported block decl refs.Steve Naroff2008-12-111-4/+4
| | | | | | Found while investigating <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy. llvm-svn: 60898
* Fix <rdar://problem/6435842> clang ObjC rewriter: #include Block.h, ↵Steve Naroff2008-12-111-4/+0
| | | | | | Block_private.h or come up with #define to prevent double-definition llvm-svn: 60890
* Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and ↵Steve Naroff2008-12-111-8/+11
| | | | | | blocks don't work together llvm-svn: 60887
* Actually distinguish between RecordDecl::field_iterator and ↵Douglas Gregor2008-12-111-1/+1
| | | | | | RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls. llvm-svn: 60883
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-15/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Fix regression caused by fixing <rdar://problem/6429113> clang ObjC ↵Steve Naroff2008-12-101-1/+1
| | | | | | rewriter: crash rewriting file with Blocks and properties llvm-svn: 60839
* Fix <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with ↵Steve Naroff2008-12-091-6/+48
| | | | | | | | Blocks and properties More fancy footwork to cope with rewriting property 'setters'. llvm-svn: 60760
* Fix a couple uninitialized variables from my previous commit.Steve Naroff2008-12-081-1/+3
| | | | llvm-svn: 60713
* Fix <rdar://problem/6423452> clang ObjC rewriter: Don't use ↵Steve Naroff2008-12-081-28/+30
| | | | | | __declspec(dllimport) for Blocks functions, as they are linked statically. llvm-svn: 60704
* Handle chained/nested property 'getters' (obj.p1.p2.p3).Steve Naroff2008-12-081-10/+58
| | | | | | This is a follow-up to fixing <rdar://problem/6213955> clang ObjC rewriter: rewriter doesn't appear to support @property and @synthesize. llvm-svn: 60700
* Fixed <rdar://problem/6213808> clang ObjC rewriter: @finally is not always ↵Steve Naroff2008-12-051-1/+23
| | | | | | executed llvm-svn: 60593
* Finish up support for <rdar://problem/6213955> clang ObjC rewriter: rewriter ↵Steve Naroff2008-12-041-19/+54
| | | | | | doesn't appear to support @property and @synthesize. llvm-svn: 60565
* Several things...Steve Naroff2008-12-041-20/+76
| | | | | | | | | | | - Implement RewritePropertySetter(). While the routine is simple, there were some tricky changes to RewriteFunctionBodyOrGlobalInitializer(), the main rewriter loop. It also required some additional instance data to distinguish setters from getters, as well as some changes to RewritePropertyGetter(). - Implement FIXME: for pretty printing ObjCPropertyRefExpr's. - Changed ObjCPropertyRefExpr::getSourceRange() to point to the end of the property name (not the beginning). Also made a minor name change from "Loc"->"IdLoc" (to make it clear the Loc does not point to the "."). llvm-svn: 60540
* More support for rewriting property getter/setters.Steve Naroff2008-12-031-1/+44
| | | | llvm-svn: 60450
OpenPOWER on IntegriCloud