summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate Sema::CompareProperties(), which was walking over a pile ofDouglas Gregor2013-01-211-6/+2
| | | | | | | | | lexical declarations looking for properties when we could more efficiently check for property mismatches at property declaration time. Good for ~1% of -fsyntax-only time when most of the properties we're checking against come from an AST file. llvm-svn: 173079
* Eliminate the oddly-named Sema::ComparePropertiesInBaseAndSuper, whichDouglas Gregor2013-01-211-1/+0
| | | | | | | | | | did a redundant traversal of the lexical declarations in the superclass. Instead, when we declare a new property, look into the superclass to see whether we're redeclaring the property. Goot for 1% of -fsyntax-only time on Cocoa.h and a little less than 3% on my modules test case. llvm-svn: 173073
* When checking the parameter types of an Objective-C method, don'tDouglas Gregor2013-01-181-2/+0
| | | | | | | decay the parameter type immediately; let CheckParameter() do its job. Fixes <rdar://problem/12071218>. llvm-svn: 172780
* Treat hidden Objective-C protocol definitions as if they wereDouglas Gregor2013-01-171-1/+3
| | | | | | | 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-51/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Teach global selector lookup to ignore hidden methods, which occurDouglas Gregor2013-01-161-47/+65
| | | | | | | when the methods are declared in a submodule that has not yet been imported. Part of <rdar://problem/10634711>. llvm-svn: 172635
* When checking availability attributes for consistency between anDouglas Gregor2013-01-151-2/+1
| | | | | | | | overriding and overridden method, allow the overridden method to have a narrower contract (introduced earlier, deprecated/obsoleted later) than the overriding method. Fixes <rdar://problem/12992023>. llvm-svn: 172567
* objective-C: when searching for declarations in protocolFariborz Jahanian2013-01-071-0/+5
| | | | | | | list of classes, etc., make sure to look into protocol definitions. // rdar://12958878 llvm-svn: 171777
* Don't complain about incomplete implementations for methods that areDouglas Gregor2012-12-111-1/+10
| | | | | | unavailable due to availability attributes. <rdar://problem/12798237> llvm-svn: 169903
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-8/+8
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* objective-C: Do not issue deprecated warning about implementationFariborz Jahanian2012-11-171-2/+15
| | | | | | | of a deprecated method in original class (or category), only in overrides. // rdar://12717705 llvm-svn: 168270
* Objective-C: check that when a category method is being implemented,Fariborz Jahanian2012-10-231-8/+20
| | | | | | | method type in cateogry matches the implementation. // rdar://12519216 llvm-svn: 166518
* Allow objc_requires_super to be used to check class methods as well.Jordan Rose2012-10-191-12/+16
| | | | | | | | | | | | | Also, unify ObjCShouldCallSuperDealloc and ObjCShouldCallSuperFinalize. The two have identical behavior and will never be active at the same time. There's one last simplification now, which is that if we see a call to [super foo] and we are currently in a method named 'foo', we will /unconditionally/ clear the ObjCShouldCallSuper flag, rather than check first to see if we're in a method where calling super is required. There's no reason to pay the extra lookup price here. llvm-svn: 166285
* From Vassil Vassilev: enable Sema to deal with multiple ExternalSemaSources.Axel Naumann2012-10-181-1/+1
| | | | llvm-svn: 166208
* Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.Jordan Rose2012-10-101-9/+9
| | | | | | | | | | | | | 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
* remove duplicate code.Fariborz Jahanian2012-09-131-3/+0
| | | | llvm-svn: 163833
* Move back the stuff about missing ownership attribute warningFariborz Jahanian2012-09-131-0/+27
| | | | | | | to SemaDeclObjC and apply some simplification per John's comment. // rdar://12280826 llvm-svn: 163824
* Move no explicit ownership warning to SemaType.cpp.Fariborz Jahanian2012-09-131-27/+0
| | | | | | // rdar://12280826 llvm-svn: 163813
* objective-C arc: don't issue no explicit ownership warning whenFariborz Jahanian2012-09-121-7/+9
| | | | | | | __autoreleasing is explicitely added to param type. // rdar://12280826 llvm-svn: 163738
* More tweaking and test cases for call to superFariborz Jahanian2012-09-101-1/+4
| | | | | | annotations. // rdar://6386358 llvm-svn: 163525
* objective-C: introduce __attribute((objc_requires_super)) on methodFariborz Jahanian2012-09-071-3/+8
| | | | | | | | in classes. Use it to flag those method implementations which don't contain call to 'super' if they have 'super' class and it has the method with this attribute set. This is wip. // rdar://6386358 llvm-svn: 163434
* Dont cast away const needlessly. Found by gcc48 -Wcast-qual.Roman Divacky2012-09-061-4/+4
| | | | llvm-svn: 163325
* objective-C ARC: under -Wexplicit-ownership-type diagnose thoseFariborz Jahanian2012-08-301-0/+26
| | | | | | | method parameter types which are reference to an objective-C pointer to object with no explicit ownership. // rdar://10907090 llvm-svn: 162959
* objective-C: Do not warn if align attribute on methodFariborz Jahanian2012-08-241-5/+29
| | | | | | | declaration is not provided. It is only necessary on the method implementation. // rdar://11593375 llvm-svn: 162628
* objective-C: refactor/simplify parsing of delayedFariborz Jahanian2012-08-081-28/+4
| | | | | | | method/c-funcs defined in objc class implementation. No intended functionality change. llvm-svn: 161540
* PR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.Richard Smith2012-08-081-6/+6
| | | | llvm-svn: 161537
* Fix an assertion failure instantiating a constexpr function from within a ↵Eli Friedman2012-08-011-2/+2
| | | | | | -dealloc method. PR13401. llvm-svn: 161135
* objective-c arc: ARC IRGen correctly assumes resultFariborz Jahanian2012-07-301-1/+18
| | | | | | | | | | type of generated call to super dealloc is 'void' and asserts if user's dealloc is not of 'void type. This rule must be enforced in clang front-end (with a fixit) if this is not the case, instead of asserting in CodeGen. // rdar://11987838 llvm-svn: 160993
* Attaching comments to declarations during parsing: handle more Objective-C ↵Dmitri Gribenko2012-07-131-0/+1
| | | | | | declarations. llvm-svn: 160156
* Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko2012-07-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
* objective-c: don't involve properties when checkingFariborz Jahanian2012-07-051-1/+2
| | | | | | | | under -Wsuper-class-method-mismatch for method mismatches in current and suprt class. // rdar://11793793 llvm-svn: 159784
* Remove a redundant assignment to the FDecl variable from *inside* it'sChandler Carruth2012-07-031-1/+1
| | | | | | | | | | | initializer. I really feel like Clang should warn about this, but I can't describe a good reason. GCC will warn on this in some cases under -Wsequence-point, but it actually seems like a false positive for that warning.... llvm-svn: 159631
* objective-c: just as we have done for method definitions,Fariborz Jahanian2012-07-021-5/+29
| | | | | | | | c-functions declared in implementation should have their parsing delayed until the end so, they can access forward declared private methods. // rdar://10387088 llvm-svn: 159626
* Restructure how the driver communicates information about theJohn McCall2012-06-201-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* 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
OpenPOWER on IntegriCloud