summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor2011-03-231-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
* Place duplicate argument declaration in inFariborz Jahanian2011-03-121-3/+4
| | | | | | | method prototypes under the -Wduplicate-method-arg and turn it off by default. llvm-svn: 127552
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-15/+23
| | | | llvm-svn: 127225
* Support a new InheritableAttr subclass, InheritableParamAttr, which isJohn McCall2011-03-021-9/+2
| | | | | | | used for attributes that are okay to inherit when written on a parameter. Dependent on LLVM r126827. llvm-svn: 126828
* Warn when type modifiers on objc method declarations inFariborz Jahanian2011-02-211-20/+50
| | | | | | | protocols do not match with method implementation. // rdar://7076235 llvm-svn: 126162
* Switch labels over to using normal name lookup, instead of their Chris Lattner2011-02-181-1/+0
| | | | | | | own weird little DenseMap. Hey look, we now emit unused label warnings deterministically, amazing. llvm-svn: 125813
* Check for deprecated implementation unconditionally.Fariborz Jahanian2011-02-161-5/+1
| | | | | | Warning and its note will be ignored in default case. llvm-svn: 125621
* Fix typo (per Chris's comment).Fariborz Jahanian2011-02-161-1/+1
| | | | llvm-svn: 125619
* Refactoring of code to issue warning on implementedFariborz Jahanian2011-02-151-31/+28
| | | | | | deprecated class and methods in objective-c. llvm-svn: 125573
* Warn if method for a deprecated method is implemented.Fariborz Jahanian2011-02-151-1/+40
| | | | | | | | | Warn if class for a deprecated class is implemented. Warn if category for a deprecated class is implemented. All under control of -Wdeprecated-implementations. // rdar://8973810. llvm-svn: 125545
* Fix scoping of method declarations and issue Fariborz Jahanian2011-02-091-3/+20
| | | | | | | warning when same parameter name used multiple times. // rdar://8877730 llvm-svn: 125229
* -Wselector should warn on implemented selectors onlyFariborz Jahanian2011-02-041-1/+5
| | | | | | | | when selector metadata is generated, which is triggered by at least on class implementation. This is to match gcc's behavior. // rdar://8851684. llvm-svn: 124909
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-4/+4
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Add -fobjc-default-synthesized-properties flagTed Kremenek2010-12-231-2/+4
| | | | | | | | | | | | to allow us to explicitly control whether or not Objective-C properties are default synthesized. Currently this feature only works when using the -fobjc-non-fragile-abi2 flag (so there is no functionality change), but we can now turn off this feature without turning off all the features coupled with -fobjc-non-fragile-abi2. llvm-svn: 122519
* Fix a major inconsistency in the representation of Objective-CDouglas Gregor2010-12-211-8/+5
| | | | | | | | | | | | | | | | | | | | classes, categories, protocols, and class extensions, where the methods and properties of these entities would be inserted into the DeclContext in an ordering that doesn't necessarily reflect source order. The culprits were Sema::ActOnMethodDeclaration(), which did not perform the insertion of the just-created method declaration into the DeclContext for these Objective-C entities, and Sema::ActOnAtEnd(), which inserted all method declarations at the *end* of the DeclContext. With this fix in hand, clean up the code-completion actions for property setters/getters that worked around this brokenness in the AST. Fixes <rdar://problem/8062781>, where this problem manifested as poor token-annotation information, but this would have struck again in many other places. llvm-svn: 122347
* Warn when message is sent to receiver ofFariborz Jahanian2010-12-211-1/+15
| | | | | | | | unknown type and there is a possibility that at runtime method is resolved to a deprecated or unavailable method. Addreses // rdar://8769853 llvm-svn: 122294
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-3/+5
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Enhance my implementation of //rdar ://8747333 in r121597 to allowFariborz Jahanian2010-12-111-19/+32
| | | | | | | | for declaration of property setter/getter in forward class extensions and also skip over propeties which are @dynamic. llvm-svn: 121617
* Any property declared in a class extension might have userFariborz Jahanian2010-12-101-2/+23
| | | | | | | | | | | declared setter or getter in current class extension or one of the other class extensions. Mark them as synthesized as property will be synthesized when property with same name is seen in the @implementation. This prevents bogus warning about unimplemented methods to be issued for these methods. Fixes // rdar://8747333 llvm-svn: 121597
* Improve diagnostics reporting of un-implementedFariborz Jahanian2010-10-291-2/+6
| | | | | | | methods in protocols when protocols are in system headers and thus ignored. //rdar: //8227199 llvm-svn: 117739
* Implement the newest status quo for method override checking. The idea nowJohn McCall2010-10-281-60/+89
| | | | | | | | | | | | | is that we need more information to decide the exact conditions for whether one ObjCObjectPointer is an acceptable return/parameter override for another, so we're going to disable that entire class of warning for now. The "forward developement" warning category, -Wmethod-signatures, can receive unrestricted feature work, and when we're happy with how it acts, we'll turn it on by default. This is a pretty conservative change, and nobody's totally content with it. llvm-svn: 117524
* Pending further discussion, re-enable warnings for Objective CJohn McCall2010-10-261-10/+20
| | | | | | | | | | | covariant/contravariant overrides and implementations, but do so under control of a new flag (-Wno-objc-covariant-overrides, which yes does cover contravariance too). *At least* the covariance cases will probably be enabled by default shortly, but that's not totally uncontroversial. llvm-svn: 117346
* Only warn for mismatched types in Objective-C methods when they are ↵David Chisnall2010-10-251-4/+94
| | | | | | | | | | incompatible, not when they are simply different. Now we test whether the difference in types breaks the principle of substitutability, rather than whether they are different. A common idiom in Objective-C is to provide a definition of a method in a subclass that returns a more-specified version of an object than the superclass. This does not violate the principle of substitutability, because you can always use the object returned by the subclass anywhere that you could use the type returned by the superclass. It was, however, generating warnings with clang, leading people to believe that semantically correct code was incorrect and requiring less accurate type specification and explicit down-casts (neither of which is a good thing to encourage). This change ensures that any method definition has parameter and return types that make it accept anything that something conforming to the declaration may pass and return something that the caller will expect, but allows stricter definitions. llvm-svn: 117271
* Method implemented in class's implementation may implementFariborz Jahanian2010-10-081-0/+9
| | | | | | | | | one declared in class's extension and not one declared in class's superclass. This supresses a bogus warning on method type mismatch. Fixes //rdar: // 8530080 llvm-svn: 116118
* Add message to attribute(deprecated).Fariborz Jahanian2010-10-061-3/+7
| | | | | | | attribute(unavailable) to do next. // rdar:// 6734520. llvm-svn: 115842
* Method declaration and its implementation must match in all their types.Fariborz Jahanian2010-10-051-6/+3
| | | | | | | Previously, compiler warned only if it was unsafe if types did not match. Fixes // rdar: //7933061 llvm-svn: 115683
* Diagnose use of incomplete type on method argument type ofFariborz Jahanian2010-09-171-1/+7
| | | | | | | method definitions instead of crashing in code gen. Fixes radar 8421082. llvm-svn: 114223
* Split ObjCInterfaceDecl::ReferencedProtocols into two lists: ↵Ted Kremenek2010-09-011-6/+7
| | | | | | | | | | | | | ReferencedProtocols and AllReferencedProtocols. ReferencedProtocols (and thus protocol_begin(), protocol_end()) now only contains the list of protocols that were directly referenced in an @interface declaration. 'all_referenced_protocol_[begin,end]()' now returns the set of protocols that were referenced in both the @interface and class extensions. The latter is needed for semantic analysis/codegen, while the former is needed to maintain the lexical information of the original source. Fixes <rdar://problem/8380046>. llvm-svn: 112691
* Rename DeclContext::getLookupContext to getRedeclContext and change its ↵Sebastian Redl2010-08-311-1/+1
| | | | | | semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them. llvm-svn: 112563
* De-memberify the VarDecl and FunctionDecl StorageClass enums.John McCall2010-08-261-2/+2
| | | | | | This lets us remove Sema.h's dependency on Expr.h and Decl.h. llvm-svn: 112156
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* Split FunctionScopeInfo and BlockScopeInfo into their own header.John McCall2010-08-251-1/+2
| | | | llvm-svn: 112038
* Remove the DenseSet dependency from Sema.h.John McCall2010-08-251-0/+2
| | | | llvm-svn: 112030
* More header elimination. The goal of all this is to allow Parser toJohn McCall2010-08-241-0/+1
| | | | | | | #include Sema.h while keeping all the AST declarations opaque. That may not be reasonably attainable, though. llvm-svn: 111907
* Abstract out passing around types and kill off ActionBase.John McCall2010-08-241-1/+1
| | | | llvm-svn: 111901
* DeclPtrTy -> Decl *John McCall2010-08-211-59/+55
| | | | llvm-svn: 111733
* objective-c ivar refactoring patch. IterationsFariborz Jahanian2010-08-201-33/+9
| | | | | | | | over ivars for a varienty of puposes is now consolidated into two small routines; DeepCollectObjCIvars and ShallowCollectObjCIvars. llvm-svn: 111679
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-1/+1
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* More PCH -> AST renaming.Sebastian Redl2010-08-181-2/+2
| | | | llvm-svn: 111472
* Generate Attr subclasses with TableGen.Alexis Hunt2010-08-181-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. llvm-svn: 111455
* Instead of modifying the ObjC AST to not modify existing declarations, teach ↵Sebastian Redl2010-08-131-3/+14
| | | | | | chained PCH to overwrite declarations from earlier PCH files in dependent ones. Tell Sema to note when it changes AST nodes so that they have to be reserialized. Finally, the ObjCProtocolDecls created in forward decls, like the ObjCInterfaceDecls in @class forward decls, are not lexically part of the decl context; only the definition is. llvm-svn: 110989
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
* Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,Douglas Gregor2010-08-111-99/+60
| | | | | | | | and create separate decl nodes for forward declarations and the definition," which appears to be causing significant Objective-C breakage. llvm-svn: 110803
* Implements gcc's -Wstrict-selector-match.Fariborz Jahanian2010-08-091-10/+26
| | | | | | (radar 8127244). llvm-svn: 110622
* - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for ↵Sebastian Redl2010-08-091-60/+99
| | | | | | | | | | forward declarations and the definition. - Eagerly create ObjCInterfaceTypes for declarations. - The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another. - Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated. llvm-svn: 110610
* Fix an Objective-C crasher, PR7839.Douglas Gregor2010-08-071-1/+2
| | | | llvm-svn: 110515
* Simplify global method pool implementation in Sema. No functionality change.Sebastian Redl2010-08-021-123/+47
| | | | llvm-svn: 110078
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-1/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* atch for implementation of objective-c's -WselectorFariborz Jahanian2010-07-221-30/+55
| | | | | | | warning flag in clang. Little more to do for a PCH issue. Radar 6507158. llvm-svn: 109129
* Patch to provide separate ASTs for multiple ObjC class extension Fariborz Jahanian2010-06-221-28/+20
| | | | | | declarations (implements radar 7928731). llvm-svn: 106597
OpenPOWER on IntegriCloud