Commit Graph

333 Commits

Author SHA1 Message Date
Eli Friedman 55179ca5aa Fix typo (found by gcc warning).
llvm-svn: 75325
2009-07-11 00:57:02 +00:00
Steve Naroff 7cae42b07a This patch includes a conceptually simple, but very intrusive/pervasive change.
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.

llvm-svn: 75314
2009-07-10 23:34:53 +00:00
Owen Anderson c10c8d3e2b Update for LLVM API change.
llvm-svn: 75028
2009-07-08 19:05:04 +00:00
Owen Anderson 9f211fb4fa Update for LLVM API change.
llvm-svn: 74986
2009-07-08 01:29:18 +00:00
Fariborz Jahanian 5f21d2f69a Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.

llvm-svn: 74984
2009-07-08 01:18:33 +00:00
Chris Lattner 3dd1b4b6f2 use new and simplified LLVM APIs. Patch by Jay Foad!
llvm-svn: 74585
2009-07-01 04:13:52 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis b4b64ca752 Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

llvm-svn: 74501
2009-06-30 02:34:44 +00:00
Daniel Dunbar c7d0e6525d Simplify, and fix a possible crash (never happens however, because we don't ever
take this path with non-builtin floating point types).

llvm-svn: 74303
2009-06-26 18:32:06 +00:00
Fariborz Jahanian 248c719a68 Patch fixes an obscure bug when 'used' attribute is applied to
variables in ObjC's Next runtime mode. Next runtime also implicitly applies
'used' attribute on some of its meta-data. This results in two 
'llvm.used' arrays to be generated, and one of them is renamed to
'llvm.used1'.

llvm-svn: 74008
2009-06-23 21:47:46 +00:00
Douglas Gregor 78bd61f661 Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
llvm-svn: 73702
2009-06-18 16:11:24 +00:00
Daniel Dunbar 76d864c7e7 Support complex properties, ivars and message expressions.
llvm-svn: 73158
2009-06-10 04:38:50 +00:00
Fariborz Jahanian 7c80959a97 Cleanup/Refactoring of ivar collection. No change in functionality.
llvm-svn: 72827
2009-06-04 01:19:09 +00:00
Fariborz Jahanian a6bed8370e Minor refactoring. Uses an existing API to lookup a class method.
llvm-svn: 72203
2009-05-21 01:03:45 +00:00
Mike Stump 18bb9284ff Reflow some comments.
llvm-svn: 71937
2009-05-16 07:57:57 +00:00
Daniel Dunbar 9a017d7fcf Classes with "+load" methods need to go in the non-lazy class list (or
else the method will not be found by the runtime at class load time).

llvm-svn: 71904
2009-05-15 22:33:15 +00:00
Daniel Dunbar 19573e7d29 Factor code for adding module-level class lists into separate method.
- No functionality change.

llvm-svn: 71898
2009-05-15 21:48:48 +00:00
Fariborz Jahanian 1880136520 Removed 4-letter :) word in comment.
Used simple array for Selector build.

llvm-svn: 71674
2009-05-13 16:19:02 +00:00
Fariborz Jahanian e4128642a7 Fixed typos, used DenseSet for keeping track of
selectors which need use Nonfrgile API for
message dispatch.

llvm-svn: 71578
2009-05-12 20:06:41 +00:00
Fariborz Jahanian 0f44d81a4c Patch to implement ivar synthesis of properties declared in protocols
only and used in class imllementations (objc2 Nonfragile ABI specific).

llvm-svn: 71571
2009-05-12 18:14:29 +00:00
Fariborz Jahanian 5d5ed2d800 Patch to allow Nonfragile ABI to use 32-bit style legacy
message dispage API for all but a few messages. This is 
a runtime performance improvement and there is not meant
to be a functional change.

llvm-svn: 71467
2009-05-11 19:25:47 +00:00
Duncan Sands c76fe8b611 Correct for renaming PaddedSize -> AllocSize in
LLVM.

llvm-svn: 71350
2009-05-09 07:08:47 +00:00
Fariborz Jahanian f3648b8913 Patch to support Gnu runtime's typed selectors.
Patch by David Chisnall.

llvm-svn: 71023
2009-05-05 21:36:57 +00:00
Daniel Dunbar 3f86b9cb06 Remove an unneeded lookup routine.
llvm-svn: 70951
2009-05-05 00:36:57 +00:00
Daniel Dunbar 9b042e06ee Fix the field count in interface record layout (it was incorrectly
compensating for super classes). This was making the reported class
sizes for empty classes very, very wrong.
 - Also, we now report the size info for an empty class like gcc (as
   the offset of the start, not as 0, 0).

 - Add a few more test cases we were mishandling before (padding bit
   field at end of struct, for example).

llvm-svn: 70938
2009-05-04 23:23:09 +00:00
Daniel Dunbar 9252ee1779 Compute interface instanceStart and instanceSize using the record
layout.
 - This is much simpler / more efficient.

 - This also properly computes the size in the presence of bit-fields.

llvm-svn: 70916
2009-05-04 21:26:30 +00:00
Daniel Dunbar 98ba964e5c Don't allow clients to traverse into superclass synthesized properties
via CollectObjCIvars.
 - In places where we need them, we should have the implementation and
   access the properties through it.

This is a fairly substantial functionality change: 
 1. @encode no longer encodes synthesized ivars, ever.

 2. The ivar layout bitmap no longer encodes information for
    synthesized ivars in superclasses. Well, actually I had already
    broken that, but it is intentional now.

We are now differing substantially from llvm-gcc and gcc
here. However, in my opinion this fundamentally *must* work if
non-fragile classes are to work. Without this change, the result of
@encode and the ivar layout depend on the order that the
implementation is seen in a file (if it is in the same file with its
superclass). Since both scenarios should work the same, our behavior
is now consistent with gcc behavior as if an implementation is never
seen following an implementation of its superclass.

Note that #2 is only a functionality change when (A) an
implementation appears in the same translation unit with the
implementation of its superclass, and (B) the superclass has
synthesized ivars. My belief is that this situation does not occur in
practice.

I am not yet sure of the role/semantics of @encode when synthesized
ivars are present... it's use is fairly unsound in a non-fragile world.

llvm-svn: 70822
2009-05-04 04:10:48 +00:00
Daniel Dunbar 62b1070fa2 Inline GetFieldBaseOffset into sole callsite.
llvm-svn: 70813
2009-05-03 23:35:23 +00:00
Daniel Dunbar 5b743915c3 Avoid recomputing field offsets.
llvm-svn: 70812
2009-05-03 23:31:46 +00:00
Daniel Dunbar d22aa4a5e5 Normalize formatting
llvm-svn: 70810
2009-05-03 23:21:22 +00:00
Daniel Dunbar 36e2a1eea3 Use the implementation decl for looking up offset while building the
ivar layout.
 - The layout needs access to synthesized ivars.

llvm-svn: 70798
2009-05-03 21:05:10 +00:00
Daniel Dunbar 3434d492b3 It turns out BuildAggrIvarLayout wasn't even using the shadow struct,
just computing it!

llvm-svn: 70779
2009-05-03 14:22:14 +00:00
Daniel Dunbar 94f46dc056 Lift common subexpression, remove dead "base" variable.
llvm-svn: 70778
2009-05-03 14:17:18 +00:00
Daniel Dunbar 15bd88860c Factor out BuildAggrIvarRecordLayout routine.
llvm-svn: 70777
2009-05-03 14:10:34 +00:00
Daniel Dunbar 7abf83cc86 Lift out GetGCAttrTypeForType routine.
llvm-svn: 70776
2009-05-03 13:55:09 +00:00
Daniel Dunbar 7b89ace186 Add constructors for GC_IVAR and SKIP_SCAN, tighten up uses.
Lift up a size calculation and note some asymmetries.

llvm-svn: 70775
2009-05-03 13:44:42 +00:00
Daniel Dunbar 22007d345f Normalize style, remove a dead assert.
llvm-svn: 70771
2009-05-03 13:32:01 +00:00
Daniel Dunbar 80b4eef686 Use ASTRecordLayout for computing ivar offsets instead of shadow
struct.
 - We still need to do more lookup than necessary because ivars don't
   live in a reasonable DeclContext.

 - The only remaining client of the interface shadow struct is the
   ivar layout bitmap.

llvm-svn: 70756
2009-05-03 13:15:50 +00:00
Daniel Dunbar 961202372f Add a ComputeIvarBaseOffset overload taking an implementation
decl. Only this routine will be suitable for computing the offset of a
synthesized ivar.
 - No functionality change.

llvm-svn: 70696
2009-05-03 12:57:56 +00:00
Daniel Dunbar 12119b959b Compute Objective-C metadata size information from the record layout,
not the shadow structure.

llvm-svn: 70691
2009-05-03 10:46:44 +00:00
Daniel Dunbar ccf6183687 Remove unused argument.
llvm-svn: 70684
2009-05-03 08:56:52 +00:00
Daniel Dunbar 0cec95f86a Coalesce the ivar offset calculation further.
llvm-svn: 70683
2009-05-03 08:55:17 +00:00
Daniel Dunbar d09551a376 Use type from ivar instead of from shadow struct field.
- No functionality change.

llvm-svn: 70674
2009-05-03 07:52:00 +00:00
Fariborz Jahanian e29b4f0785 Remove a warning when this file is compiled optimized.
llvm-svn: 70518
2009-04-30 23:08:58 +00:00
Fariborz Jahanian 18c435a17d API for message dispatch of methods returning floats
to match gcc's closely.

llvm-svn: 70493
2009-04-30 16:31:11 +00:00
Fariborz Jahanian 4b4ef86369 Undid setting of the flag for msg_Send for 32bit code gen.
It seems to effect code gen. Add a FIXME instead.

llvm-svn: 70423
2009-04-29 22:47:27 +00:00
Fariborz Jahanian e55f8660be Export lazy references of .objc_class_name of class names
referenced in a category implementation meta-data
(Next objc 32bit abi).

llvm-svn: 70407
2009-04-29 20:40:05 +00:00
Fariborz Jahanian e27b929809 Type of msgSend message dispatch API is a vararg.
llvm-svn: 70404
2009-04-29 19:14:43 +00:00
Eli Friedman 1c4a175aef Remove getIntegerConstantExprValue in favor of using EvaluateAsInt.
llvm-svn: 70145
2009-04-26 19:19:15 +00:00
Chris Lattner f0b64d73a8 split ObjC and C++ Statements out into their own headers.
llvm-svn: 70105
2009-04-26 01:32:48 +00:00