Commit Graph

77 Commits

Author SHA1 Message Date
Daniel Dunbar c7dfbfd544 Prevent invalid warnings about incomplete implementations for methods
which are inherited from base clases or protocols.

llvm-svn: 55790
2008-09-04 20:01:15 +00:00
Daniel Dunbar 4684f37333 Add synthesized property methods to protocols and categories in Sema.
- It is not clear that this is the right approach, but this is at
   least consistent with how interfaces are handled.

 - This means NeXT now emits the correct metadata for properties in
   protocols.

 - This currently introduces a spurious warning involving inherited
   properties in protocols or categories; however, it also fixes some
   situations where we were failing to emit a warning. I will scrub
   this code tomorrow and fix this issue as well as number of other
   missed warnings / error situations that appear to exist.

llvm-svn: 55407
2008-08-27 05:40:03 +00:00
Daniel Dunbar 279d1ccc57 Move implicit Obj-C param creation into ObjCMethodDecl.
- Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter

No (intended) functionality change.

llvm-svn: 55356
2008-08-26 06:07:48 +00:00
Daniel Dunbar 3b4fdb0951 Rename ObjCPropertyImplDecl::PropertyImplKind (consistency)
- Change enum name to Kind.
 - Change enum constants to English strings.

Also, fix getPropertyImplementation (which probably should be renamed)

llvm-svn: 55354
2008-08-26 04:47:31 +00:00
Daniel Dunbar 73a73f52fd Fix attributes on Obj-C interfaces & methods.
- Drop MethodAttrs parameter to ObjCMethodDecl
 - Call ProcessDeclAttributeList for interface & method decls.

llvm-svn: 55068
2008-08-20 18:02:42 +00:00
Steve Naroff eb03dace87 Sema::ActOnStartProtocolInterface(): Make sure the protocol decl has a valid start location.
The following case resulted in an invalid start location:

// start location not being set for ObjCProtocolDecl AST (when a forward reference is in scope).
@protocol Buggy;

@protocol Buggy 
@optional
- whatever;
@end

llvm-svn: 54740
2008-08-13 16:39:22 +00:00
Daniel Dunbar 56fdb6ae69 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.

llvm-svn: 54632
2008-08-11 06:23:49 +00:00
Daniel Dunbar 34fb67272c Minor #include cleaning
- Drop TokenKinds.h from Action.h
 - Move DeclSpec.h from Sema.h into individual Sema .cpp files

llvm-svn: 54625
2008-08-11 03:27:53 +00:00
Chris Lattner 35ffe331b9 remove two uses of getCanonicalType I missed.
llvm-svn: 54114
2008-07-27 00:05:05 +00:00
Chris Lattner 574dee6cac change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)

llvm-svn: 54105
2008-07-26 22:17:49 +00:00
Chris Lattner ac87ef5dcc remove a helper method.
llvm-svn: 54101
2008-07-26 20:50:02 +00:00
Chris Lattner df59f5aa3c Pull protocol resolution of out ActOnStartClassInterface, this is also the
last client of the old ParseObjCProtocolReferences, so it also removes it.

llvm-svn: 54094
2008-07-26 04:13:19 +00:00
Chris Lattner b1f3c948ee refactor protocol resolution out of ActOnStartCategoryInterface
llvm-svn: 54093
2008-07-26 04:07:02 +00:00
Chris Lattner 3bbae00f50 pull protocol resolution out into ActOnStartProtocolInterface.
This temporarily duplicates ParseObjCProtocolReferences, but it
will be removed in the future.

llvm-svn: 54092
2008-07-26 04:03:38 +00:00
Chris Lattner 9c1842b612 simplify some code.
llvm-svn: 54091
2008-07-26 03:47:43 +00:00
Chris Lattner 908d39e45e remove duplicate error message.
llvm-svn: 54090
2008-07-26 03:40:25 +00:00
Steve Naroff 542cd5d3f9 Move fix in r54013 from the parser to sema.
llvm-svn: 54032
2008-07-25 17:57:26 +00:00
Chris Lattner d7352d6801 minor cleanup to the actions interface to pass around SmallVectorImpl instead
of a specific smallvector size.

Fix protocol lists to pass down proper location info, so we get diagnostics
like this:

t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                  ^

instead of this:

t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                           ^


Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation>

llvm-svn: 53883
2008-07-21 22:17:28 +00:00
Chris Lattner 390d39ac7e move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.

llvm-svn: 53876
2008-07-21 21:32:27 +00:00
Chris Lattner 102ccc4f8c add forward definition protocols to the protocol list for a class.
llvm-svn: 53864
2008-07-21 18:35:17 +00:00
Chris Lattner 461d3f8eb8 references to completely undeclared protocols should be errors.
References to forward definitions should be warnings.

llvm-svn: 53863
2008-07-21 18:34:02 +00:00
Chris Lattner d004505b74 introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.

llvm-svn: 53856
2008-07-21 18:19:38 +00:00
Chris Lattner 65056c48a7 rename setReferencedProtocolList -> addReferencedProtocols to
be consistent with ObjCInterfaceDecl.

llvm-svn: 53852
2008-07-21 17:23:15 +00:00
Argyrios Kyrtzidis b3fa8639e1 Change 'MDecl' to 'MD' to fix redefinition compiler error in MSVC++.
llvm-svn: 53849
2008-07-21 09:18:38 +00:00
Chris Lattner ca1e848588 Switch initialization of the protocol list for an interface decl to use
the standard "set these as the list of protocols" interface instead of a 
strange "set this as the size and then set each one to the value" interface.
The problem with the later is that it a) is completely different from 
everything else, b) is awkward, and c) doesn't handle the case when a
referenced protocol is invalid: it set it to null.

This meant that all clients downstream would have to handle null protocols
in the protocol list, and empirically they didn't.  Fix this by not setting
invalid protocols in the referenced protocol list, fixing the crash on 
test/Sema/objc-interface-1.m

While I'm at it, clean up some locations so that we produce:

t.m:1:25: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
~~~~~~~~~~~~~~~~~~~~~   ^

instead of:

t.m:1:1: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^

llvm-svn: 53846
2008-07-21 07:06:49 +00:00
Seo Sanghyeon d27410b580 Fix warnings
llvm-svn: 53141
2008-07-05 02:01:25 +00:00
Argyrios Kyrtzidis 853fbea313 Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
llvm-svn: 52852
2008-06-28 06:07:14 +00:00
Argyrios Kyrtzidis 8a73d1f327 The assert at Sema::ObjCActOnStartOfMethodDef should check CurMethodDecl instead of CurFunctionDecl.
llvm-svn: 52719
2008-06-25 14:24:09 +00:00
Chris Lattner 5696e7badf Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!

llvm-svn: 52422
2008-06-17 18:05:57 +00:00
Steve Naroff 946166f4e9 Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol
llvm-svn: 52024
2008-06-05 22:57:10 +00:00
Steve Naroff 31e1d41338 Fixed a recent test regression from last night (r51976).
llvm-svn: 52006
2008-06-05 15:03:27 +00:00
Steve Naroff 25449a5221 Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.

llvm-svn: 52005
2008-06-05 14:49:39 +00:00
Steve Naroff d1c3d1130b Fix trivial crasher and downgrade an error to warning (to match GCC).
llvm-svn: 51976
2008-06-05 04:33:44 +00:00
Steve Naroff 4c290c7c0b Make sure the source location for @property points the the @-sign (not the decl spec).
Also added a FIXME related to how we represent @properties in the ObjCInterfaceDecl AST.

llvm-svn: 51450
2008-05-22 23:24:08 +00:00
Fariborz Jahanian 8983f17ba0 Synthesized getter/setter method declarations need not have
an implementation. This fixes couple of failing prperty tests
caused by my previous patch.

llvm-svn: 50830
2008-05-07 20:53:44 +00:00
Fariborz Jahanian ec6e4c8096 This patch introduces declaration of getter methods for ObjC2's
properties. Couple of property tests will fail with this patch.
Will fix them next.

llvm-svn: 50818
2008-05-07 17:43:59 +00:00
Fariborz Jahanian 09367d68ff Patch to refactor setter/getter names of property attributes into Selector
(was IdentifierInfo * before). This will make method declartations whole
lot easier.

llvm-svn: 50747
2008-05-06 18:09:04 +00:00
Fariborz Jahanian 8d91686b0d percolate @optional/@required protocols down to ASTs for
properties declared in the protocol.

llvm-svn: 50662
2008-05-05 18:51:55 +00:00
Fariborz Jahanian 98a6c4fa77 This patch is about merging ObjC2's properties declared in class
protocols into class's property list and performing semantics
on them for while doing so.

llvm-svn: 50587
2008-05-02 19:17:30 +00:00
Fariborz Jahanian f303bdabdf Patch to match and issue diagnostics on property type mismatch.
llvm-svn: 50532
2008-05-01 18:05:01 +00:00
Fariborz Jahanian 7cf18862c2 More ObjC2 property semantics work. Work in progress.
llvm-svn: 50508
2008-05-01 00:03:38 +00:00
Argyrios Kyrtzidis ed1eec4812 Use PushOnScopeChains to introduce a decl into scope.
llvm-svn: 50320
2008-04-27 13:30:35 +00:00
Fariborz Jahanian 0a070ff570 Patch to diagnose inconsistancies between properties declared in current and
its super class. This patch is incomplete.

llvm-svn: 50228
2008-04-24 19:58:34 +00:00
Fariborz Jahanian 6efdf1ddab Patch to build AST for property implementation declarations and
to print declaration from its AST.

llvm-svn: 50117
2008-04-23 00:06:01 +00:00
Fariborz Jahanian c6bec7b6dc More semantics checks of properties. Property implementation can implicitly use
ivar of same name. 
Better diagnostics to bring home this point.

llvm-svn: 50065
2008-04-21 21:57:36 +00:00
Fariborz Jahanian f2a7d7c949 Support for @dynamic AST build.
More property semantics checking.
First test case for ObjC2's property implementation.

llvm-svn: 50057
2008-04-21 21:05:54 +00:00
Fariborz Jahanian a054e99fa8 Continuation of work on ObjC2's properties.
Added iterators, methods to find property and categories.
Use them in doing semantic analysis on property implementation
declarations. Fixed typos.

llvm-svn: 50050
2008-04-21 19:04:53 +00:00
Fariborz Jahanian d83bdd3841 Fixed a bug in categories and properties.
llvm-svn: 49883
2008-04-18 00:30:47 +00:00
Fariborz Jahanian ffe97a3925 Initial work for property implementation declarations.
Mostly semantic checking in this patch. This is on going
and incomplete.

llvm-svn: 49882
2008-04-18 00:19:30 +00:00
Fariborz Jahanian 8e36cddde0 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.

llvm-svn: 49862
2008-04-17 18:25:18 +00:00