Commit Graph

263 Commits

Author SHA1 Message Date
Chris Lattner 7c981a79f7 allocate and dellocate objc decl list through AST Context instead of
with new/delete.  With disable-free, this reduces the number of 4/8 byte
mallocs from 4793/1541 to 865/456 and also drops other sizes as well.

This is a very small perf win, nothing major.

llvm-svn: 65171
2009-02-20 21:44:01 +00:00
Chris Lattner 2229872d2f add plumbing to get ASTContext& down to allocation/deallocation points in ObjCList,
but don't start using it yet.  Renamed some methods to be more consistent.

llvm-svn: 65168
2009-02-20 21:35:13 +00:00
Chris Lattner 4d1eb76ada newly factored, we can now move the set and destroy methods out of line.
llvm-svn: 65166
2009-02-20 21:16:26 +00:00
Chris Lattner 2e635f6102 rename ObjCList::clear() -> ObjCList::Destroy(). Require that destroy is called
before the dtor.

llvm-svn: 65156
2009-02-20 21:02:11 +00:00
Chris Lattner f1ccb0cef0 rearrange the contents of DeclObjC to be by-class. Fix some 80 column issues
and other non-semantic changes.

llvm-svn: 65155
2009-02-20 20:59:54 +00:00
Chris Lattner a4af543375 destroy should forward to base class.
llvm-svn: 65151
2009-02-20 20:42:28 +00:00
Chris Lattner d7ba858314 move the @implementation ivar list to being an ObjCList, which prevents
it from being leaked, among other things.

llvm-svn: 65150
2009-02-20 20:41:34 +00:00
Chris Lattner f5b77513b0 remove some slow O(n) methods.
llvm-svn: 65132
2009-02-20 18:18:36 +00:00
Chris Lattner ed89b3ff2f Change ObjCForwardProtocolDecl to use an ObjCList.
llvm-svn: 65131
2009-02-20 18:10:37 +00:00
Chris Lattner 9ee23b7f1a move the interace list of @class to use ObjCList.
llvm-svn: 65129
2009-02-20 18:04:31 +00:00
Chris Lattner a11480defa remove a dead list.
llvm-svn: 65127
2009-02-20 17:53:35 +00:00
Chris Lattner 90669d0500 switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
llvm-svn: 65114
2009-02-20 06:23:21 +00:00
Chris Lattner fa62dc3483 switch the interface ivar list from being explicitly managed to using ObjCList.
llvm-svn: 65113
2009-02-20 06:10:45 +00:00
Chris Lattner 8d10c11606 move more objc destruction out of dtors into Destroy.
llvm-svn: 65112
2009-02-20 06:03:09 +00:00
Chris Lattner 55c8d39695 move some objc decl destruction out of dtors into Destroy method.
llvm-svn: 65111
2009-02-20 05:54:35 +00:00
Argyrios Kyrtzidis 0cf6625ff8 All Decls have a DeclContext now, hooray! Fans of consistency rejoice.
Pass the DeclContext to ObjCIvarDecls as well.

llvm-svn: 64801
2009-02-17 20:20:37 +00:00
Fariborz Jahanian 7a855e33df Remove FindIvarDeclaration. Use lookupInstanceVariable is is functionally
the same.

llvm-svn: 64657
2009-02-16 19:35:27 +00:00
Chris Lattner aab70d2963 wrap long lines.
llvm-svn: 64650
2009-02-16 19:24:31 +00:00
Steve Naroff 13ae6f47cd Remove many references to ASTContext::getAllocator(), replacing them with calls to the recently added placement new (which uses ASTContext's allocator for memory). Also added ASTContext::Deallocate().
This will simplify runtime replacement of ASTContext's allocator. Keeping the allocator private (and removing getAllocator() entirely) is also goodness.

llvm-svn: 63135
2009-01-27 21:25:57 +00:00
Douglas Gregor 6e6ad602e5 Remove ScopedDecl, collapsing all of its functionality into Decl, so
that every declaration lives inside a DeclContext.

Moved several things that don't have names but were ScopedDecls (and,
therefore, NamedDecls) to inherit from Decl rather than NamedDecl,
including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't
store empty DeclarationNames for these things, nor do we try to insert
them into DeclContext's lookup structure.

The serialization tests are temporarily disabled. We'll re-enable them
once we've sorted out the remaining ownership/serialiazation issues
between DeclContexts and TranslationUnion, DeclGroups, etc.

llvm-svn: 62562
2009-01-20 01:17:11 +00:00
Fariborz Jahanian dab04840f0 Patch to allow @dynamic synthesis of property in a category,
with @synthesize being illegal.

llvm-svn: 62515
2009-01-19 18:16:19 +00:00
Ted Kremenek 6ae6513ce2 Fix crasher due to use-after-release: DeclContext now owns all ObjCMethodDecls, and shouldn't be released elsewhere.
llvm-svn: 62113
2009-01-12 22:49:54 +00:00
Fariborz Jahanian 8e1555c7c3 Patch to supprt case of readonly property being
assigned to when it has user declared setter method
defined in the class implementation (but no declaration in
the class itself).

llvm-svn: 62098
2009-01-12 19:55:42 +00:00
Steve Naroff ba3dc38840 Convert property implementation to DeclContext::addDecl().
This completes the ObjCContainerDecl AST cleanup (for now).

llvm-svn: 62037
2009-01-11 12:47:58 +00:00
Steve Naroff 0c0f5bae80 A few property related cleanups to ObjCContainerDecl AST.
llvm-svn: 62034
2009-01-11 01:06:09 +00:00
Fariborz Jahanian 8630b2d992 Explicit declaration of property setters over-ride
prohibition of 'readonly' properties in an assignment.

llvm-svn: 62028
2009-01-10 18:43:55 +00:00
Fariborz Jahanian 519976c4e9 This patch removes mergeProperties and does the property lookup
in designated protocols lazily.

llvm-svn: 62007
2009-01-09 21:04:52 +00:00
Douglas Gregor ffca3a21f1 Provide a new kind of iterator, the specific_decl_iterator, that
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.

llvm-svn: 61994
2009-01-09 17:18:27 +00:00
Steve Naroff b3a8798253 Move property API's up to ObjCContainerDecl (removing a lot of duplicate code).
Add isa/cast/dyncast support for ObjCContainerDecl.
Renamed classprop_iterator/begin/end to prop_iterator/begin/end (the class prefix was confusing).
More simplifications to Sema::ActOnAtEnd()...
Added/changed some FIXME's as a result of the above work.

llvm-svn: 61988
2009-01-09 15:36:25 +00:00
Daniel Dunbar f4c6616d9d Fix crash on null deference when searching for readwrite properties in
categories.
 - Also, simplify nesting via early return.

llvm-svn: 61968
2009-01-09 01:04:21 +00:00
Douglas Gregor c25d7a7fe0 Addressed the issue in <rdar://problem/6479085>, where we failed to
rewrite @class declarations that showed up within linkage
specifications because those @class declarations never made it any
place where the rewriter could find them.

Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can
live in the appropriate top-level or transparent DeclContext near the
top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C
declarations now show up in a traversal of the declarations in a
DeclContext (they didn't before!). This way, the rewriter finds all
Objective-C declarations within linkage specifications.

llvm-svn: 61966
2009-01-09 00:49:46 +00:00
Ted Kremenek 0667123ba1 Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and destroy all contained ObjCMethodDecls in one sweep. This fixes a use-after-free error found by valgrind.
llvm-svn: 61943
2009-01-08 20:49:27 +00:00
Steve Naroff e538c5f3ae Removed ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.
Moved logic to Sema::ProcessPropertyDecl().

llvm-svn: 61936
2009-01-08 20:15:03 +00:00
Steve Naroff 11b387fee0 Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).
Convert clients to use the standard getDeclContext() API.

Doug, thanks for the review!

llvm-svn: 61935
2009-01-08 19:41:02 +00:00
Steve Naroff 35c62ae632 This is a large/messy diff that unifies the ObjC AST's with DeclContext.
- ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts.
- ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext).
- ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-)
- Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective.
- Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch().
- Simplified Sema::ActOnAtEnd() considerably. Still more work to do.
- Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl.
- Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl.

This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction.

llvm-svn: 61929
2009-01-08 17:28:14 +00:00
Steve Naroff 639de9ccd9 ObjC AST cleanups/simplifications (phase 1).
Add ObjCContainerDecl class and have ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl inherit from it.

llvm-svn: 61866
2009-01-07 17:57:40 +00:00
Fariborz Jahanian 8b2d1294db Fixed a bug showed up the meta-data for protocol
instance methods by building print-class-info.m,
whose output is now identical to what gcc puts out.

llvm-svn: 61339
2008-12-22 20:41:58 +00:00
Steve Naroff d96f7cca5f Fix http://llvm.org/bugs/show_bug.cgi?id=3189.
llvm-svn: 61202
2008-12-18 15:50:41 +00:00
Fariborz Jahanian f327e89dab This patch will build the Records lazily per Steve's comments.
Note that one test duplicate-ivar-check.m will fail because I 
need to re-implement duplicate ivar checking.

llvm-svn: 61154
2008-12-17 21:40:49 +00:00
Fariborz Jahanian 7ca027a101 Added comment to Steve's patch to clarify the case.
llvm-svn: 61144
2008-12-17 18:25:24 +00:00
Steve Naroff 596e137c84 Fix <rdar://problem/6450964> clang on xcode: Assertion failed: (RecordForDecl && "lookupFieldDeclForIvar no storage for class").
This was a recent regression caused by r61043 (related to code gen. for ivar references).

Fariborz, please review. I have some other concerns related to code generation for ivars that we can discuss later.

llvm-svn: 61134
2008-12-17 14:13:49 +00:00
Fariborz Jahanian a599c1352b Diagnose that ivars in current and super class may not
be duplicates and a test case.

llvm-svn: 61068
2008-12-16 01:08:35 +00:00
Fariborz Jahanian 48ee658562 Name of addLayoutToClass is confusing as no layout calculation
is done. Layout is calculated lazily at code gen type.
This patch changes the name.

llvm-svn: 61054
2008-12-15 21:58:08 +00:00
Fariborz Jahanian b517e90662 Code gen. for ivar references; including bitfield
ivars.

llvm-svn: 61043
2008-12-15 20:35:07 +00:00
Fariborz Jahanian cd489a822c Removed setRecordForDecl. Added a FIXME.
llvm-svn: 61038
2008-12-15 18:04:20 +00:00
Fariborz Jahanian b1378f9b0f Patch for ObjCIvarRefExpr containing the field
matching the storage layout for this ivar

llvm-svn: 60996
2008-12-13 22:20:28 +00:00
Fariborz Jahanian 0222553d1c Add storage layout to ObjC classes.
llvm-svn: 60993
2008-12-13 20:28:25 +00:00
Douglas Gregor 91f84216f7 Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
  * Make DeclContext the central data structure for storing and
    looking up declarations within existing declarations, e.g., members
    of structs/unions/classes, enumerators in C++0x enums, members of
    C++ namespaces, and (later) members of Objective-C
    interfaces/implementations. DeclContext uses a lazily-constructed
    data structure optimized for fast lookup (array for small contexts,
    hash table for larger contexts). 

  * Implement C++ qualified name lookup in terms of lookup into
    DeclContext.

  * Implement C++ unqualified name lookup in terms of
    qualified+unqualified name lookup (since unqualified lookup is not
    purely lexical in C++!)

  * Limit the use of the chains of declarations stored in
    IdentifierInfo to those names declared lexically.

  * Eliminate CXXFieldDecl, collapsing its behavior into
    FieldDecl. (FieldDecl is now a ScopedDecl).

  * Make RecordDecl into a DeclContext and eliminates its
    Members/NumMembers fields (since one can just iterate through the
    DeclContext to get the fields).

llvm-svn: 60878
2008-12-11 16:49:14 +00:00
Fariborz Jahanian ea831ee11c Prevent bogus warning on unimplemented setter/getter when user
has added declaration of these methods in its @interface.

llvm-svn: 60803
2008-12-09 22:43:22 +00:00
Fariborz Jahanian 3d8552a75d Support for implementation of property in the case where
the synthesis is in an implementation of s subclass of
a super class where the property has been declared.

llvm-svn: 60792
2008-12-09 20:23:04 +00:00
Steve Naroff 5fd31b17df ObjCInterfaceDecl::lookupInstanceMethod() needs to look through a categories protocols.
Fixes <rdar://problem/6418640> clang on prokit: error: incompatible type returning 'id', expected 'NSSize'

llvm-svn: 60716
2008-12-08 20:57:28 +00:00
Fariborz Jahanian d2c2ad515e Use of properties declared in protocols in the category
via the category's protocol list1s, with appropriate
diagnsostics and a test case.

llvm-svn: 60634
2008-12-06 23:03:39 +00:00
Fariborz Jahanian 9c196795e6 Fixed a comment.
llvm-svn: 60611
2008-12-05 22:36:19 +00:00
Fariborz Jahanian fbbaf6afae This test checks for duplicate implementation of the same
property. It also checks for duplicate use of the same ivar
in two different iproperty implementations. It also caught
an error for a test case used in CodeGen :).

llvm-svn: 60610
2008-12-05 22:32:48 +00:00
Fariborz Jahanian 015a48d1db This patch corrects problem in searching for a setter/getter method for
a property. Previous scheme of seaching in interface's list of methods
would not work because this list is not yet constructed. This is in preparation
for doing semantic check on viability of setter/getter method declarations.

llvm-svn: 60386
2008-12-02 00:19:12 +00:00
Fariborz Jahanian 829b908b74 Refactored checking on readonly property into a method.
llvm-svn: 60050
2008-11-25 21:48:26 +00:00
Chris Lattner 86d7d91366 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.

llvm-svn: 59936
2008-11-24 03:54:41 +00:00
Chris Lattner e4b95698df Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.

llvm-svn: 59933
2008-11-24 03:33:13 +00:00
Douglas Gregor 77324f3854 Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.

llvm-svn: 59441
2008-11-17 14:58:09 +00:00
Daniel Dunbar c4adb70968 Fix "possibly uninitialized" warning.
llvm-svn: 55406
2008-08-27 05:13:46 +00:00
Daniel Dunbar e7ecbc539e Add addPropertyMethods implementations for
ObjC{Category,Protocol}Decl.
 - No functionality change.

llvm-svn: 55404
2008-08-27 02:09:39 +00:00
Daniel Dunbar 5e558bcf26 Add ObjCPropertyDecl::isReadOnly.
Respect isReadOnly when generating synthesized method decls.

llvm-svn: 55364
2008-08-26 07:16:44 +00:00
Daniel Dunbar 6962f5a73b constify ObjC*::getClassMethod,getInstanceMethod
No (intended) functionality change.

llvm-svn: 55362
2008-08-26 06:53:45 +00:00
Daniel Dunbar e36c39f3bf Missed a file; part of:
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: 55357
2008-08-26 06:08:30 +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 222ab49928 Fix return type for setter method.
llvm-svn: 55353
2008-08-26 02:53:23 +00:00
Daniel Dunbar ad3cdc2ba7 Synthesize property setter method as we do for getter.
- Also, fix Parser to construct proper SetterName selector (should be
   lifted out of parser though).

llvm-svn: 55352
2008-08-26 02:32:45 +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
Ted Kremenek 0e857200bb Added ObjCAtDefsFieldDecl to represent FieldDecls created by @defs.
This fixes an ownership issue where FieldDecls could be owned both by an ObjCInterfaceDecl and a RecordDecl.

llvm-svn: 55037
2008-08-20 03:26:33 +00:00
Daniel Dunbar 221fa94e40 More #include cleaning
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and
   SourceLocation.h)
 - Move ASTContext constructor into implementation

llvm-svn: 54627
2008-08-11 04:54:23 +00:00
Ted Kremenek 73295fab89 When constructing an ObjCIvarDecl object in Sema, provide its visibility up front instead of setting it afterwards.
This change also fixes a subtle bug where the access control of an ivar would be initialized to garbage if we didn't have an explicit visibility specifier (e.g., @private).

llvm-svn: 53955
2008-07-23 18:04:17 +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 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
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
Steve Naroff de7d0f69ba Two fixes:
- Make sure ObjCIvarDecl propagates the bitfield width.
- RewriteObjC::SynthesizeIvarOffsetComputation(): Avoid using the __OFFSETOF__ mumbo jumbo for bitfields (since it isn't legal C). This fixes <rdar://problem/5986079> clang ObjC rewriter: bitfields and ivar access don't mix.

llvm-svn: 53694
2008-07-16 18:22:22 +00:00
Ted Kremenek ef17049bac Reclaim memory owned by ObjCForwardProtocolDecls.
llvm-svn: 52063
2008-06-06 21:05:33 +00:00
Ted Kremenek 71fff8b4de Implement "Destroy" and destructor for ObjCClassDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
llvm-svn: 52059
2008-06-06 20:11:53 +00:00
Ted Kremenek 2e34af659a Implement "Destroy" and destructor for ObjCProtocolDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
llvm-svn: 52055
2008-06-06 19:48:57 +00:00
Ted Kremenek 5144fe2287 Because of a lack of a clear ownership role between ObjCInterfaceDecls and
ObjCPropertyDecls, have TranslationUnit destroy ObjCPropertyDecls. This is a
horrible hack, and must be removed eventually.

llvm-svn: 52051
2008-06-06 17:21:42 +00:00
Ted Kremenek 09a0d04ea0 Initial work on additional memory collection for ObjC AST objects. We now
have Destroy methods of ObjcMethodDecl and ObjCInterfaceDecl which recursively
destroy their owned Decls and Stmts.  There are a few cases where it is not
clear what to do (FIXMEs included in the patch).

llvm-svn: 52050
2008-06-06 16:45:15 +00:00
Steve Naroff f9c65246dd Fix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberReferenceExpr.
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").

llvm-svn: 52001
2008-06-05 13:55:23 +00:00
Steve Naroff 5ccccf0326 Make sure we look through categories when searching for a classes property.
Fixes <rdar://problem/5984338> clang on xcode: property implementation must have its declaration in interface 'PBXOpenQuicklyModule'

llvm-svn: 51925
2008-06-04 04:46:04 +00:00
Nuno Lopes de9746cd45 fix free/delete mismatch problem in add/mergeProperties (found by valgrind)
llvm-svn: 50945
2008-05-10 10:31:54 +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 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 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 a591a12ea5 Allow property in base class to be implemented in a
derived class.

llvm-svn: 50074
2008-04-21 23:57:08 +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 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
Fariborz Jahanian d634dfae0f Fixed a comment.
llvm-svn: 49819
2008-04-16 21:11:25 +00:00
Fariborz Jahanian 9d981eb9ae This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.

llvm-svn: 49817
2008-04-16 21:08:45 +00:00
Fariborz Jahanian 0152a1a5db New AST representation for each objc2's property declaration.
llvm-svn: 49699
2008-04-14 23:36:35 +00:00
Fariborz Jahanian 4572b45574 AST generation for objc2's property declarations.
llvm-svn: 49565
2008-04-11 23:40:25 +00:00
Steve Naroff 5a4611cdda Add class and super class location info to ObjCInterfaceDecl...
llvm-svn: 49553
2008-04-11 19:35:35 +00:00
Chris Lattner 713e6592be Fix a bug I introduced in my const'ification patch.
llvm-svn: 49262
2008-04-06 05:25:03 +00:00
Chris Lattner 0a5ff0d34a This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!

llvm-svn: 49261
2008-04-06 04:47:34 +00:00
Chris Lattner 157dd0811e fix a number of const qualification bugs.
llvm-svn: 49257
2008-04-06 04:11:27 +00:00
Chris Lattner c5ffed4a66 Introduce ContextDecl, patch by Argiris Kirtzidis!
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema

llvm-svn: 49208
2008-04-04 06:12:32 +00:00
Chris Lattner ed0e16404c clean up property memory allocation to move it into the ast classes
like the rest of the classes.

llvm-svn: 48434
2008-03-17 01:19:02 +00:00
Chris Lattner 41eec3d097 make property addition work list all other "add" methods. Do
the allocation in the class, not in sema.

llvm-svn: 48433
2008-03-16 21:23:50 +00:00
Chris Lattner 219b3e9c6c add the last two Create methods for decls, woo!
llvm-svn: 48432
2008-03-16 21:17:37 +00:00
Chris Lattner 36ac1cae1f add two more Create methods.
llvm-svn: 48428
2008-03-16 20:53:07 +00:00
Chris Lattner d77aff8232 simplify the way ObjCCategoryDecl's get their referenced protocols list
specified.  Previously, the ctor would allocate memory for the list and then
it would get filled in later.  Move the allocation+filling in to be more 
consistent with other stuff, e.g. the addMethods method.

llvm-svn: 48427
2008-03-16 20:47:45 +00:00
Chris Lattner 1dd77af9ce Add create methods for ObjCCategoryDecl, ObjCForwardProtocolDecl, ObjCClassDecl.
llvm-svn: 48426
2008-03-16 20:34:23 +00:00
Chris Lattner acc04a9261 minor cleanups, make getNumInstanceMethods always return unsigned.
llvm-svn: 48423
2008-03-16 20:19:15 +00:00
Chris Lattner f87ca0a7d1 Give ObjCProtocolDecl a Create method.
llvm-svn: 48410
2008-03-16 01:23:04 +00:00
Chris Lattner 96c501ef7e Add create methods for ObjCIvarDecl and ObjCInterfaceDecl
llvm-svn: 48408
2008-03-16 01:15:50 +00:00
Chris Lattner c557947488 remove some dead arguments to ObjCMethodDecl.
llvm-svn: 48406
2008-03-16 00:58:16 +00:00
Chris Lattner 8d8829e225 Give ObjCMethodDecl a Create method.
llvm-svn: 48405
2008-03-16 00:49:28 +00:00
Chris Lattner 893751970a Split objc decl implementation out into DeclObjC.cpp
llvm-svn: 48404
2008-03-16 00:19:01 +00:00