summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.John McCall2010-06-041-2/+2
| | | | | | This is never null, but the associated type might be. llvm-svn: 105503
* Clang missing warning about conflicting declaration vs. definition Fariborz Jahanian2010-05-211-0/+4
| | | | | | for variable arguments list methods. (radar 8006060). llvm-svn: 104407
* Various small fixes for construction/destruction of Objective-C++Douglas Gregor2010-05-201-3/+3
| | | | | | | | | | instance variables: - Use isRecordType() rather than isa<RecordType>(), so that we see through typedefs in ivar types. - Mark the destructor as referenced - Perform C++ access control on the destructor llvm-svn: 104206
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-12/+12
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement new default property synthesis rules. Essentially, no longerFariborz Jahanian2010-05-141-1/+3
| | | | | | | | | user directive is needed to force a property implementation. It is decided based on those propeties which are declared in the class (or in its protocols) but not those which must be default implemented by one of its super classes. Implements radar 7923851. llvm-svn: 103787
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-051-7/+7
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* Diagnose unused exception parameters under a different warning groupDouglas Gregor2010-05-031-1/+3
| | | | | | | | (-Wunused-exception-parameter) than normal variables, since it's more common to name and then ignore an exception parameter. This warning is neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>. llvm-svn: 102931
* More of Sema to implement initialization ofFariborz Jahanian2010-04-281-24/+23
| | | | | | ivar of c++ object types. llvm-svn: 102500
* Move CollectIvarsToConstructOrDestruct to SemaFariborz Jahanian2010-04-271-0/+52
| | | | | | | from AST, consider ivar array of objects (per Doug's comment). llvm-svn: 102446
* Implement template instantiation for Objective-C @catchDouglas Gregor2010-04-261-0/+2
| | | | | | statements. This is the last of the Objective-C statements. llvm-svn: 102356
* Refactor Objective-C @catch parameter checking by detangling it fromDouglas Gregor2010-04-261-5/+87
| | | | | | | | function-parameter checking and splitting it into the normal ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch parameter rather than the ill-fitting ParmVarDecl. llvm-svn: 102347
* Make the static type of the exception variable in an Objective-CDouglas Gregor2010-04-261-1/+1
| | | | | | | @catch a VarDecl. The dynamic type is still a ParmVarDecl, but that will change soon. No effective functionality change. llvm-svn: 102341
* Rework Parser-Sema interface for Objective-C @catch exception objectDouglas Gregor2010-04-231-0/+7
| | | | | | | | | arguments. Rather than having the parser call ActOnParamDeclarator (which is a bit of a hack), call a new ActOnObjCExceptionDecl action. We'll be moving more functionality into this handler to perform earlier checking of @catch. llvm-svn: 102222
OpenPOWER on IntegriCloud