summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When looking for overridden ObjC methods, don't ignore 'hidden' ones.Argyrios Kyrtzidis2013-03-291-12/+17
| | | | | | | | | | | | When using modules we should not ignore overridden methods from categories that are hidden because the module is not visible. This will give more consistent results (when imports change) and it's more correct since the methods are indeed overridden even if they are not "visible" for lookup purposes. rdar://13350796 llvm-svn: 178374
* Objective-C: Tighten the rules when warningFariborz Jahanian2013-03-211-0/+66
| | | | | | | | | | is issused for on overriding 'readwrite' property which is not auto-synthesized. Buttom line is that if hueristics determine that there will be a user implemented setter, no warning will be issued. // rdar://13388503 llvm-svn: 177662
* Objective-C: Fixes a comment.Fariborz Jahanian2013-03-121-1/+1
| | | | llvm-svn: 176878
* Ensure that DIType is regenerated after we visit an implementationAdrian Prantl2013-03-061-20/+33
| | | | | | | | | | that adds ivars to an interface. Fixes rdar://13175234 This is an update to r176116 that performs a smart caching of interfaces. llvm-svn: 176584
* Temporarily revert r176116 for compile-time performance regression.Adrian Prantl2013-02-271-33/+20
| | | | | | This reverts commit ea95e4587fd13606fbf63b10a07a7d02026aa39c. llvm-svn: 176151
* Ensure that DIType is regenerated after we visited an implementation that ↵Adrian Prantl2013-02-261-20/+33
| | | | | | adds ivars to an interface. Fixes rdar://13175234 llvm-svn: 176116
* objective-C: synthesize properties in order of theirFariborz Jahanian2013-02-141-4/+8
| | | | | | | | declarations to synthesize their ivars in similar determinstic order so they are laid out in a determinstic order. // rdar://13192366 llvm-svn: 175214
* objective-C: Make order of ivars which are synthesizedFariborz Jahanian2013-02-131-7/+40
| | | | | | | | in the course of property synthesis deterministic (ordered by their type size), instead of having hashtable order (as it is currently). // rdar://13192366 llvm-svn: 175100
* Ensure that type definitions present in just-loaded modules areDouglas Gregor2013-02-091-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | visible. The basic problem here is that a given translation unit can use forward declarations to form pointers to a given type, say, class X; X *x; and then import a module that includes a definition of X: import XDef; We will then fail when attempting to access a member of X, e.g., x->method() because the AST reader did not know to look for a default of a class named X within the new module. This implementation is a bit of a C-centric hack, because the only definitions that can have this property are enums, structs, unions, Objective-C classes, and Objective-C protocols, and all of those are either visible at the top-level or can't be defined later. Hence, we can use the out-of-date-ness of the name and the identifier-update mechanism to force the update. In C++, we will not be so lucky, and will need a more advanced solution, because the definitions could be in namespaces defined in two different modules, e.g., // module 1 namespace N { struct X; } // module 2 namespace N { struct X { /* ... */ }; } One possible implementation here is for C++ to extend the information associated with each identifier table to include the declaration IDs of any definitions associated with that name, regardless of context. We would have to eagerly load those definitions. llvm-svn: 174794
* Treat hidden Objective-C protocol definitions as if they wereDouglas Gregor2013-01-171-0/+27
| | | | | | | undefined, and don't find methods or protocols within those protocol definitions. This completes <rdar://problem/10634711>. llvm-svn: 172686
* Rework the traversal of Objective-C categories and extensions toDouglas Gregor2013-01-161-59/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. llvm-svn: 172665
* comment parsing: when property accessors don't have commentFariborz Jahanian2013-01-121-0/+5
| | | | | | | of their own (or are syntheszed), use prperty's comment. for them. // rdar://12791315 llvm-svn: 172278
* Minor refactoring of my last patchFariborz Jahanian2013-01-071-13/+12
| | | | | | related to // rdar://12958878 llvm-svn: 171792
* objective-C: when searching for declarations in protocolFariborz Jahanian2013-01-071-4/+8
| | | | | | | list of classes, etc., make sure to look into protocol definitions. // rdar://12958878 llvm-svn: 171777
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-7/+9
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-011-1/+22
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* Address Jordan's review: comments, spaces.Anna Zaks2012-10-311-2/+5
| | | | llvm-svn: 167091
* Factor CollectClassPropertyImplementations out of Sema into ASTAnna Zaks2012-10-181-0/+26
| | | | | | This would make it possible for the analyzer to use the function. llvm-svn: 166210
* ObjCMethodDecl::findPropertyDecl: bail out early if not an instance method.Jordan Rose2012-10-111-1/+1
| | | | | | | | | Currently, Objective-C does not support class properties, even though it allows calling class methods with dot syntax. No intended functionality change; purely optimization. llvm-svn: 165716
* [Doc parsing] This patch searches overridden objc/c++Fariborz Jahanian2012-10-101-0/+2
| | | | | | | | | | methods looking for documentation on a particular base class inherited by any method that overrides the base class. In case of redeclaration, as when objc method is defined in the implementation, it also looks up for documentation in class/class extension being redeclared. llvm-svn: 165643
* Move Sema::PropertyIfSetterOrGetter to ObjCMethodDecl::findPropertyDecl.Jordan Rose2012-10-101-0/+42
| | | | | | | | Then, switch users of PropertyIfSetterOrGetter and LookupPropertyDecl (the latter by name) over to findPropertyDecl. This actually makes -Wreceiver-is-weak a bit stronger than it was before. llvm-svn: 165628
* Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.Jordan Rose2012-10-101-4/+3
| | | | | | | | | | | | | This more accurately reflects its use: this flag is set when a method matches the getter or setter name for a property in the same class, and does not actually specify whether or not the definition of the method will be synthesized (either implicitly or explicitly with @synthesize). This renames the setter and backing field as well, and changes the (soon-to-be-obsolete?) XML dump format to use 'property_accessor' instead of 'synthesized'. llvm-svn: 165626
* Move the functionality that looks for ObjC overridden methods fromArgyrios Kyrtzidis2012-10-091-0/+174
| | | | | | | | ASTContext to the ObjCMethodDecl, and have the more generic ASTContext::getOverriddenMethods() use the ObjCMethodDecl::getOverriddenMethods() function. llvm-svn: 165518
* When we load a function or method body from an AST file, we checkDouglas Gregor2012-10-091-0/+4
| | | | | | | | | | whether that function/method already has a body (loaded from some other AST file), as introduced in r165137. Delay this check until after the redeclaration chains have been wired up. While I'm here, make the loading of method bodies lazy. llvm-svn: 165513
* Make getDefaultSynthIvarName() a member of ObjCPropertyDecl.Anna Zaks2012-09-271-0/+11
| | | | llvm-svn: 164789
* Mark ObjCInterfaceDecl::lookupPrivateMethod as const.Anna Zaks2012-07-301-1/+1
| | | | llvm-svn: 160989
* Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.Anna Zaks2012-07-271-1/+20
| | | | | | | | | | | | | Also, fix a subtle bug, which occurred due to lookupPrivateMethod defined in DeclObjC.h not looking up the method inside parent's categories. Note, the code assumes that Class's parent object has the same methods as what's in the Root class of a the hierarchy, which is a heuristic that might not hold for hierarchies which do not descend from NSObject. Would be great to fix this in the future. llvm-svn: 160885
* Remove HasSynthBitfield and all callers/writers/etc. Also removeEric Christopher2012-07-191-9/+3
| | | | | | | | previous ResetObjCLayout calls since this is now handled in Sema. Part of rdar://11842763 llvm-svn: 160527
* [AST/libclang] Fix the selector locations that are reported for aArgyrios Kyrtzidis2012-06-161-1/+8
| | | | | | | | | | | | | | | | | | | | | | method definition that has its '{' attached to the method name without a space. With a method like: -(id)meth{ ..... } the logic in ObjCMethodDecl that determined the selector locations got confused because it was initialized based on an end location for '{' but that end location changed to '}' after the method was finished. Fix this by having an immutable end location for the declarator and for getLocEnd() get the end location from the body itself. Fixes rdar://11659739. llvm-svn: 158583
* Documentation cleanup: escape Objective-C @keywords in Doxygen comments.James Dennett2012-06-151-3/+3
| | | | llvm-svn: 158565
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-11/+11
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-11/+11
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* objective-c: Don't warn when a category does not implement a methodFariborz Jahanian2012-04-051-10/+12
| | | | | | | declared in its adopted protocol when another category declares it because that category will implement it. // rdar://11186449 llvm-svn: 154132
* [Sema] Prefer to use ObjCInterfaceDecl's protocol_begin()/protocol_end() ↵Argyrios Kyrtzidis2012-03-131-9/+5
| | | | | | | | | iterators instead of ObjCInterfaceDecl::getReferencedProtocols(), because the iterators are safe to use even if the caller did not check that the interface is a definition. llvm-svn: 152597
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* [Sema] Fix crash-on-invalid-code issue:Argyrios Kyrtzidis2012-03-021-0/+4
| | | | | | | | | | @class I; @implementation I(cat) // crashes here @end rdar://10968158 llvm-svn: 151931
* objective-c: provide fixit hint when atomic property does notFariborz Jahanian2012-02-291-1/+3
| | | | | | | have matching user defined setter/getter and a warning is issued. In this case, a fixit note is displayed. // rdar://10267155 llvm-svn: 151766
* modern objc translator. Finish off first cut of theFariborz Jahanian2012-02-201-4/+10
| | | | | | | modern meta-data translation by commenting out private ivar declarations in user source. Also, added several tests. llvm-svn: 150985
* objc: If a method is not implemented in the category implementation butFariborz Jahanian2012-02-091-15/+17
| | | | | | | | has been declared in its primary class, superclass, or in one of their protocols, no need to issue unimplemented method. // rdar://10823023 llvm-svn: 150206
* Switch the ObjC*Decl raw_stream overloads to take a reference, for ↵Benjamin Kramer2012-02-071-4/+4
| | | | | | consistency with NamedDecls. llvm-svn: 149981
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-1/+1
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* When deserializing the definition of a C++ class/ObjC class/ObjCDouglas Gregor2012-01-151-6/+0
| | | | | | | | | | | | | | | protocol, record the definition pointer in the canonical declaration for that entity, and then propagate that definition pointer from the canonical declaration to all other deserialized declarations. This approach works well even when deserializing declarations that didn't know about the original definition, which can occur with modules. A nice bonus from this definition-deserialization approach is that we no longer need update records when a definition is added, because the redeclaration chains ensure that the if any declaration is loaded, the definition will also get loaded. llvm-svn: 148223
* When creating declarations that are deserialized from an module file,Douglas Gregor2012-01-051-6/+70
| | | | | | | go through a central allocation routine Decl::AllocateDeserializedDecl(). No actual functionality change (yet). llvm-svn: 147614
* Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. ↵Douglas Gregor2012-01-011-10/+4
| | | | | | They are no longer needed llvm-svn: 147419
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-24/+0
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-7/+22
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Introduce the core infrastructure needed to model redeclaration chainsDouglas Gregor2012-01-011-1/+7
| | | | | | | | | | | | | | | for Objective-C protocols, including: - Using the first declaration as the canonical declaration - Using the definition as the primary DeclContext - Making sure that all declarations have a pointer to the definition data, and that we know which declaration is the definition - Serialization support for redeclaration chains and for adding definitions to already-serialized declarations. However, note that we're not taking advantage of much of this code yet, because we're still re-using ObjCProtocolDecls. llvm-svn: 147410
* Move the data that corresponds to the definition of a protocol into aDouglas Gregor2012-01-011-1/+11
| | | | | | | | | separately-allocated DefinitionData structure. Introduce various functions that will help with the separation of declarations from definitions (isThisDeclarationADefinition(), hasDefinition(), getDefinition()). llvm-svn: 147408
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-22/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* objective-c: Use class definition AST in several situations whenFariborz Jahanian2011-12-231-0/+4
| | | | | | | building related objc ASTs which require a class definition AST. These were uncovered when testing objc rewriter. llvm-svn: 147210
OpenPOWER on IntegriCloud