summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Still more Doxygen documentation fixes:James Dennett2012-06-141-7/+7
| | | | | | | | * Escape #, < and @ symbols where Doxygen would try to interpret them; * Fix several function param documentation where names had got out of sync; * Delete param documentation referring to parameters that no longer exist. llvm-svn: 158472
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-6/+6
| | | | | | | | | | | | | | 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
* Use the SelectorSet typedef more widely throughout Sema.Benjamin Kramer2012-05-271-11/+11
| | | | | | While there make it a SmallPtrSet. llvm-svn: 157532
* A selector match between two Objective-C methods does *not* guaranteeDouglas Gregor2012-05-171-13/+18
| | | | | | | | that the methods have the same number of parameters, although we certainly assumed this in many places. Objective-C can be insane sometimes. Fixes <rdar://problem/11460990>. llvm-svn: 157025
* In the override search for Objective-C methods, protect against ASTs that ↵Douglas Gregor2012-05-171-5/+8
| | | | | | have NULL interfaces behind a category, which can happen in invalid code. Fixes <rdar://problem/11478173>, a recent regression llvm-svn: 157021
* [AST/libclang] Speed up clang_getOverriddenCursors() considerably by ↵Argyrios Kyrtzidis2012-05-091-56/+69
| | | | | | | | | | | | | reserving a bit in ObjCMethodDecl to indicate whether the method does not override any other method, which is the majority of cases. That way we can avoid unnecessary work doing lookups, especially when PCH is involved. rdar://11360082 llvm-svn: 156476
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-7/+7
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Do not keep track of the set of visited Objective-C containers whenDouglas Gregor2012-05-031-7/+8
| | | | | | | | | performing the search for overridden methods. We very rarely see the same container twice, and in those rare cases we still have the fallback of the second SmallPtrSet to eliminate duplicates. Good for ~1.5% -fsyntax-only speedup on the code in <rdar://problem/11004361>. llvm-svn: 156103
* Eliminate Sema::CompareMethodParamsInBaseAndSuper() entirely, byDouglas Gregor2012-05-011-55/+29
| | | | | | | | folding its one check into the normal path for checking overridden Objective-C methods. Good for another 3.6% speedup on the test case in <rdar://problem/11004361>. llvm-svn: 155961
* The semantic checking that verifies whether an Objective-C methodDouglas Gregor2012-05-011-14/+17
| | | | | | | | | | | | | | | | declared in a subclass has consistent parameter types with a method having the same selector in a superclass performs a significant number of lookups into the class hierarchy. In the example in <rdar://problem/11004361>, we spend 4.7% of -fsyntax-only time in these lookups. Optimize away most of the calls to this routine (Sema::CompareMethodParamsInBaseAndSuper) by first checking whether we have ever seen *any* method with that selector (using the global selector table). Since most selectors are unique, we can avoid the cost of this name lookup in many cases, for a 3.3% speedup. llvm-svn: 155958
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-7/+7
| | | | | | | | | | | | | 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
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-061-1/+30
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* objective-c: Don't warn when a category does not implement a methodFariborz Jahanian2012-04-051-2/+2
| | | | | | | declared in its adopted protocol when another category declares it because that category will implement it. // rdar://11186449 llvm-svn: 154132
* Make sure we don't accept an @interface inside another objc containerArgyrios Kyrtzidis2012-03-231-4/+6
| | | | | | just because there was an attribute in front of it. llvm-svn: 153355
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. llvm-svn: 152608
* Fix crash at @implementation with a forward reference as base class.Argyrios Kyrtzidis2012-03-131-0/+2
| | | | | | rdar://11020003 llvm-svn: 152596
* [Sema] -Add an invalid objc category to the DeclContext so that it can beArgyrios Kyrtzidis2012-03-121-0/+5
| | | | | | | | | | | serialized -Don't add methods of invalid objc containers to the global method pool. This protects us from trying to serialize a method whose container was not serialized. Part of rdar://11007039. llvm-svn: 152566
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-15/+15
| | | | | | | | | | (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-1/+1
| | | | | | | | | | @class I; @implementation I(cat) // crashes here @end rdar://10968158 llvm-svn: 151931
* Sema/ObjC: Override search can generate a large search list, bump the base sizeDaniel Dunbar2012-02-291-3/+4
| | | | | | | | of the SmallPtrSet way up to avoid commonly reallocating the buffer size. - I didn't see a good argument against it, so I bumped the limit to cover the max size we see during parsing Cocoa.h. llvm-svn: 151698
* After numerous requests, have Objective-C 'method declared here' notes ↵Ted Kremenek2012-02-271-5/+10
| | | | | | mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035. llvm-svn: 151579
* [libclang] Make sure that all top-level decls in a @implementation areArgyrios Kyrtzidis2012-02-231-0/+19
| | | | | | | | marked as such. Previously we missed tag declarations; fixes rdar://10902015 llvm-svn: 151283
* objc: If a method is not implemented in the category implementation butFariborz Jahanian2012-02-091-26/+38
| | | | | | | | 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
* Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain2012-01-311-3/+3
| | | | llvm-svn: 149451
* Whenever Sema attempts to look in the global method pool, try to loadDouglas Gregor2012-01-251-21/+11
| | | | | | | | | additional data from the external Sema source. This properly copes with modules that are imported after we have already searched in the global method pool for a given selector. For PCH, it's a slight pessimization to be fixed soon. llvm-svn: 148891
* Rework the external Sema source's ReadMethodPool() so that it doesn'tDouglas Gregor2012-01-251-24/+25
| | | | | | | return pre-built lists. Instead, it feeds the methods it deserializes to Sema so that Sema can unique them, which keeps the chains shorter. llvm-svn: 148889
* Factor out the addition of a method into the global method pool, andDouglas Gregor2012-01-251-35/+48
| | | | | | | teach it to always add the new method at the *end* of the list rather than as the second element in the list. llvm-svn: 148886
* objective-c: Ignore with warning forward class declaration whose nameFariborz Jahanian2012-01-241-5/+10
| | | | | | matches a typedef declaring an object type. // rdar://10733000 llvm-svn: 148760
* objc: disallow __block attribute on method params.Fariborz Jahanian2012-01-141-0/+4
| | | | llvm-svn: 148197
* Fix up the calls to CorrectTypo in Sema*ObjC.cpp to use callbackKaelyn Uhrain2012-01-131-17/+38
| | | | | | | objects, and add a basic CorrectionCandidateCallback template class to simplify the fixups. llvm-svn: 148085
* After further discussion, rename attribute ↵Ted Kremenek2012-01-051-1/+1
| | | | | | 'objc_disable_automatic_synthesis' to 'objc_requires_property_definitions'. llvm-svn: 147622
* objc: use objc_suppress_autosynthesis attribute on classesFariborz Jahanian2012-01-031-3/+4
| | | | | | which should not be default synthesized. llvm-svn: 147468
* Eliminate ObjCProtocolDecl's end-of-definition location. It is notDouglas Gregor2012-01-021-1/+0
| | | | | | used anywhere. llvm-svn: 147422
* Move ObjCProtocolDecl::EndLoc into its DefinitionData, and giveDouglas Gregor2012-01-021-1/+1
| | | | | | ObjCProtocolDecl proper source-range information. llvm-svn: 147420
* Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. ↵Douglas Gregor2012-01-011-5/+3
| | | | | | They are no longer needed llvm-svn: 147419
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-13/+5
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Eliminate ASTMutationListener::UpdatedAttributeList, which is noDouglas Gregor2012-01-011-6/+1
| | | | | | longer needed now that we aren't back-patching ObjCProtocolDecls. llvm-svn: 147413
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-37/+45
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Move the data that corresponds to the definition of a protocol into aDouglas Gregor2012-01-011-8/+17
| | | | | | | | | 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-12/+3
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* objc QOI: Don't't warn about mismatch between attributes Fariborz Jahanian2011-12-211-2/+5
| | | | | | | on method declaration and definition if former is in a system header. // rdar://10580333 llvm-svn: 147020
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-15/+9
| | | | llvm-svn: 146722
* Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it onlyDouglas Gregor2011-12-151-9/+13
| | | | | | | | applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). llvm-svn: 146694
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-151-49/+42
| | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
* Move the definition-specific data of ObjCInterfaceDecl into aDouglas Gregor2011-12-151-7/+11
| | | | | | | | | | | | | | | | separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-151-4/+4
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
* objc: diagnose duplicate declaration of methodsFariborz Jahanian2011-12-131-2/+14
| | | | | | in classes. // rdar://10535349 llvm-svn: 146504
* Make sure that we infer __strong, etc. when we instantiate variablesDouglas Gregor2011-12-101-0/+4
| | | | | | under ARC. Fixes <rdar://problem/10530209>. llvm-svn: 146307
* Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!Argyrios Kyrtzidis2011-12-091-1/+1
| | | | llvm-svn: 146213
* Extend warnings for missing '@end'.Erik Verbruggen2011-12-061-15/+32
| | | | | | Fixes PR2709. llvm-svn: 145928
OpenPOWER on IntegriCloud