Commit Graph

544 Commits

Author SHA1 Message Date
Chandler Carruth 8509824cdb Move CodeGenOptions.h *back* into Frontend. This should have been done when the
dependency edge was reversed such that CodeGen depends on Frontend.

llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Fariborz Jahanian 021510e96f Patch adds support for copying of those
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772). 

llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Fariborz Jahanian 3336de141a zero-cost exception API for NeXt runtime.
rethrow inside @catch block must use objc_exception_rethrow
API. Fixes radar 8037512. Test will be added to LLVM
test suite.

llvm-svn: 104964
2010-05-28 17:34:43 +00:00
John McCall 78a151138a Push a return-value slot throughout ObjC message-send codegen. Will be
critical for ObjC++ correctness;  hard to test independently of various
required Sema changes, though.

llvm-svn: 104422
2010-05-22 01:48:05 +00:00
John McCall 96fa4845f7 Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

llvm-svn: 103973
2010-05-17 21:00:27 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
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
2010-05-15 11:32:37 +00:00
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Daniel Dunbar 0c00537583 IRgen/NeXT: Put the synthesized _objc_super, _message_ref_t decls in a valid DeclContext, to satisfy the invariants that should hold on a RecordDecl.
llvm-svn: 102624
2010-04-29 16:29:11 +00:00
Fariborz Jahanian 0dec1e0d56 IRGen for initialization/destruction of
ivar class objects (NeXt runtime).
(radar 7900343).

llvm-svn: 102533
2010-04-28 21:28:56 +00:00
David Chisnall 01aa46795e Changed signature of GenerateMessageSend() function to pass the ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere.
Emitted some metadata on message sends to allow a later pass to do some speculative inlining of class methods (GNU runtime).  Speculative inlining of instance methods requires type feedback to be useful (work in progress), but for class methods it works quite nicely.  

llvm-svn: 102514
2010-04-28 19:33:36 +00:00
Douglas Gregor 46a572b871 Make the static type of the exception variable in an Objective-C
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.

llvm-svn: 102341
2010-04-26 16:46:50 +00:00
Daniel Dunbar 710cb20cd6 IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:
- Fix some places that had the alignment hard coded.
 - Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice.

This should be equivalent for x86_64, but fixes the alignment for ARM.

llvm-svn: 102314
2010-04-25 20:39:32 +00:00
Daniel Dunbar 5e63927d41 IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI.
llvm-svn: 102312
2010-04-25 20:39:01 +00:00
Daniel Dunbar fca18c1b41 NeXT: Clean up dispatch method policy selection.
- Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.

 - Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.

 - No intended functionality change.

llvm-svn: 102255
2010-04-24 17:56:46 +00:00
Douglas Gregor 96c79498fb Improve the AST representation of Objective-C @try/@catch/@finally
statements. Instead of the @try having a single @catch, where all of
the @catch's were chained (using an O(n^2) algorithm nonetheless),
@try just holds an array of its @catch blocks. The resulting AST is
slightly more compact (not important) and better represents the actual
language semantics (good).

llvm-svn: 102221
2010-04-23 22:50:49 +00:00
Daniel Dunbar e3883874c5 NeXT/EH: When generating the rethrow code for a finally block, make sure to
chain outwards when inside a nested exception scope.
 - A real test for this is going into LLVM test-suite.

llvm-svn: 102204
2010-04-23 19:12:32 +00:00
Daniel Dunbar 5a6b3e0865 NeXT/EH: Tidy up EH code a bit, don't emit the catch block EH handler if it is unreachable.
llvm-svn: 102203
2010-04-23 19:12:24 +00:00
Fariborz Jahanian 63408e848b Support for -fno-constant-cfstrings option - wip.
llvm-svn: 102112
2010-04-22 20:26:39 +00:00
Fariborz Jahanian fd34b0ac84 Check for darwin befoer cheking for version.
(related to radar 7866951).

llvm-svn: 101799
2010-04-19 18:38:31 +00:00
Fariborz Jahanian dfb3983525 Force clang to produce legacy api for messaging
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951

llvm-svn: 101791
2010-04-19 17:53:30 +00:00
Chris Lattner a299f2c872 fix integrated assembler with i386 objc code.
llvm-svn: 101660
2010-04-17 18:26:20 +00:00
Benjamin Kramer b11416d061 Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.
The next step is to print the name directly into the stream, avoiding a temporary std::string copy.

llvm-svn: 101632
2010-04-17 09:33:03 +00:00
Daniel Dunbar 9c78d63fbc IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it is now an immutable object.
Also, add some checking of various invariants that should hold on the CGBitFieldInfo access.

llvm-svn: 101345
2010-04-15 05:09:32 +00:00
Daniel Dunbar bb13845c5f IRgen: Eliminate now unused fields from CGBitFieldInfo.
llvm-svn: 101344
2010-04-15 05:09:28 +00:00
Daniel Dunbar d51c1a6e09 IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
IRgen record layout, which this code doesn't need to depend on.

llvm-svn: 101257
2010-04-14 17:02:21 +00:00
Daniel Dunbar b935b9370d IRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy" with which a bit-field should be accessed.
- For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts).

 - Design comments appreciated.

llvm-svn: 101178
2010-04-13 20:58:55 +00:00
Fariborz Jahanian 5a8c2034a4 Add some API code for future work.
llvm-svn: 101052
2010-04-12 18:18:10 +00:00
Daniel Dunbar c75c8bd757 IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
llvm-svn: 100745
2010-04-08 02:59:45 +00:00
Daniel Dunbar 196ea449ed IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.
llvm-svn: 100513
2010-04-06 01:07:44 +00:00
Daniel Dunbar dc406b8e92 IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
- Unfortunately, this requires some horrible code in CGObjCMac which always
   allocats a CGBitFieldInfo because we don't currently build a proper layout
   for Objective-C classes. It needs to be cleaned up, but I don't want the
   bit-field cleanups to be blocked on that.

llvm-svn: 100474
2010-04-05 21:36:35 +00:00
Daniel Dunbar cd3d5e76ce IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
llvm-svn: 100433
2010-04-05 16:20:44 +00:00
Daniel Dunbar b76c4cd5ec Add a FIXME and reduce nesting.
llvm-svn: 100432
2010-04-05 16:20:33 +00:00
Daniel Dunbar 7e5aba433d IRgen/NeXT: Remove my refactoring-enabling asserts, and add a FIXME.
llvm-svn: 100237
2010-04-02 22:29:40 +00:00
Daniel Dunbar 8c7f981833 IRgen/Obj-C: Eliminate FindIvarInterface, now that ivar's are in the right DeclContexts (-2 FIXMEs). We still have an annoying linear scan + hidden dependency on how Obj-C layout is done.
- This is also an algorithmic improvement in IRgen for Obj-C, although it probably doesn't matter in practice.

llvm-svn: 100228
2010-04-02 21:14:02 +00:00
Daniel Dunbar 031d4d40d0 CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
llvm-svn: 100188
2010-04-02 15:43:29 +00:00
Daniel Dunbar 034299ef25 IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
- I did a cursory check that this was perf neutral, FWIW.

llvm-svn: 99978
2010-03-31 01:09:11 +00:00
Rafael Espindola c50c27cca8 the big refactoring bits of PR3782.
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.

llvm-svn: 99920
2010-03-30 20:24:48 +00:00
John McCall 2da83a3a38 Use the power of types to track down another canonicalization bug in
the ABI-computation interface.  Fixes <rdar://problem/7691046>.

llvm-svn: 97197
2010-02-26 00:48:12 +00:00
Fariborz Jahanian aef662206b Patch removes IVars list from ObjCInterfaceDecl and
instead relies on their DeclContext for iteration, etc.

llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Douglas Gregor d505812422 Eliminate a bunch of unnecessary ASTContexts from members functions of
Decl subclasses. No functionality change.

llvm-svn: 95841
2010-02-11 01:19:42 +00:00
Daniel Dunbar 3241d400c8 Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

llvm-svn: 95787
2010-02-10 18:49:11 +00:00
John McCall ab26cfa58d Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior:  attributes
written on return types that don't apply there are applied to the function
instead, etc.  Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks).  Consistently consume CC/noreturn
information throughout codegen;  enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Daniel Dunbar 45858d2d59 Revert "Numerous changes to selector handling:", this breaks a whole bunch of
working code, for no apparent reason.

llvm-svn: 95244
2010-02-03 20:11:42 +00:00
David Chisnall 92b762e256 Numerous changes to selector handling:
- Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon.  This also simplifies the code generated by the GNU runtime a bit.  

- Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant.

- Recognise @selector() expressions as valid static initialisers (as GCC does).

- Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants.  These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load.

- Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector.  This is needed for generating typed selectors from @selector() expressions (as GCC does).  Ideally, this information should be stored in the Selector, but that would be an invasive change.  We should eventually add checks for common uses of @selector() expressions.  Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this:

- (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL)
           withObject: (id)object;

Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature.  We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes.

- Made @selector() expressions emit type info if available and the runtime supports it.

Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac.  This currently just assert()s.

llvm-svn: 95189
2010-02-03 02:09:30 +00:00
Daniel Dunbar ca5e3eb7f7 NeXT: Add support for -fobjc-legacy-dispatch.
llvm-svn: 95005
2010-02-01 21:07:33 +00:00
David Chisnall 481e3a87fe Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Benjamin Kramer d20ef75b91 Remove some dead variables clang-analyzer found.
llvm-svn: 92162
2009-12-25 15:43:36 +00:00
Anders Carlsson 61a401caec Pass ReturnValueSlot to EmitCall. No functionality change yet.
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Fariborz Jahanian 9ac0a04b29 Patch to fix 32-bit @try failure with internal assertion when compiling
an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).

llvm-svn: 91335
2009-12-14 21:35:01 +00:00
Fariborz Jahanian 751c1e7b24 patch to add a property from a protocol to a class that adopts the protocol.
(fixes radar 7466494).

llvm-svn: 91227
2009-12-12 21:26:21 +00:00
Fariborz Jahanian a6227fd896 (objc2 nonfragile-abi specific). If the translation unit includes an implementation
of a subclass (direct or indirect) of a weak_import root class, emit a weak reference 
for the root class's metaclass (should complete radar 6815425).

llvm-svn: 90249
2009-12-01 18:25:24 +00:00
Daniel Dunbar c76493a65d Don't pass false (default) for isVolatile parameter to CreateLoad.
llvm-svn: 90098
2009-11-29 21:23:36 +00:00
Fariborz Jahanian 95ace55701 This patch finalizes implementatin of weak_import
objective-c2 classes (radar 6815425).

llvm-svn: 89157
2009-11-17 22:42:00 +00:00
Fariborz Jahanian 3ad8dcfd55 More cases for weak_import objective-c2 classes.
(still radar 6815425).

llvm-svn: 89152
2009-11-17 22:02:21 +00:00
Fariborz Jahanian 6726055375 More support for weak_import objective-c2 class.
(radar 6815425).

llvm-svn: 89146
2009-11-17 21:37:35 +00:00
Fariborz Jahanian da2efb091d Generate the old API when sending message to super
in a category implementation (objc 32bit api related).

llvm-svn: 88741
2009-11-14 02:18:31 +00:00
Fariborz Jahanian eb80c98a72 Fix a code gen bug in i386-apple-darwin (objc fragile abi), sending
message to 'super'. Fixes radar 7205866.

llvm-svn: 87017
2009-11-12 20:14:24 +00:00
Daniel Dunbar d238681113 Avoid std::string concatenation.
llvm-svn: 84458
2009-10-19 01:21:19 +00:00
Daniel Dunbar 07d0785dbb PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

llvm-svn: 84447
2009-10-18 21:17:35 +00:00
Daniel Dunbar 349e6fbfce Twinify CGObjCMac, this simplifies the code and should reduce std::string
trashing.

llvm-svn: 84439
2009-10-18 20:48:59 +00:00
Duncan Sands cef56992b0 There is now only one version of eh.selector and eh.typeid.for.
Fix the clang build.

llvm-svn: 84107
2009-10-14 16:13:30 +00:00
Benjamin Kramer abd5b90e4c Simplify pointer creation with the new Type::getInt*Ptr methods.
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Fariborz Jahanian 7a95d72b10 Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).

llvm-svn: 82724
2009-09-24 22:25:38 +00:00
John McCall 8ccfcb51ee Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.

llvm-svn: 82705
2009-09-24 19:53:00 +00:00
John McCall 9dd450bb78 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.

llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Nick Lewycky 41eaf0ac57 Make clang stop relying on ConstantStruct::get's default value for isPacked
which will be going away (ie. it's becoming a required parameter) later today.

llvm-svn: 82323
2009-09-19 20:00:52 +00:00
Daniel Dunbar df0e62d0a1 IRgen/ObjC: Correctly construct the function info for variadic message sends.
This fixes some bad -O0 codegen and the unnecessary clearing of al on entry to objc_msgSend for most message sends.

<rdar://problem/7102824> [irgen] unnecessary xorb on calls to objc_msgSend on x86_64

llvm-svn: 82118
2009-09-17 04:01:40 +00:00
Daniel Dunbar aff9fcaa02 IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
llvm-svn: 82117
2009-09-17 04:01:22 +00:00
Fariborz Jahanian de1d324dce patch for generating objc'2 objc_assign_ivar. WIP.
llvm-svn: 82090
2009-09-16 23:11:23 +00:00
Fariborz Jahanian 10e9bffde3 Fixes a regression in objc GC layout bitmap involving
block pointer ivars.

llvm-svn: 81535
2009-09-11 17:39:05 +00:00
Fariborz Jahanian d1f1ff3978 Get the size of object to pass to objc_memmove_collectable()
from correct field of TypeInfo.

llvm-svn: 81446
2009-09-10 16:20:31 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Benjamin Kramer b178ab2155 Remove unnecessary #include <sstream>.
llvm-svn: 81147
2009-09-07 11:12:05 +00:00
Daniel Dunbar d027a92431 Use a SetVector for tracking some Obj-C metadata, to ensure deterministic
output.
 - Also, cleanup code to output inline asm references.

llvm-svn: 81139
2009-09-07 00:20:42 +00:00
Fariborz Jahanian 879d726608 Re-implemented generation of objc_memmove_collectable
API for copying GC'able aggregates (Next runtime only).

llvm-svn: 80607
2009-08-31 19:33:16 +00:00
Anders Carlsson 12e022ddbf Fix ivar layout map generation (hopefully).
llvm-svn: 79968
2009-08-25 02:07:02 +00:00
Fariborz Jahanian a6a3494c1d Remove #ifdef'out code.
llvm-svn: 79956
2009-08-24 23:16:37 +00:00
Fariborz Jahanian 7c07d5fed8 Remove ivarlayout bitmap optimization, instead if all zeros,
put out the bitmap when all objects are scanned.

llvm-svn: 79947
2009-08-24 21:55:06 +00:00
Torok Edwin db7149246f Fix build of clang with gcc-4.4: #include <cstdio> was missing.
llvm-svn: 79916
2009-08-24 13:25:12 +00:00
Argyrios Kyrtzidis 60ed560428 Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema interfaces.
DeclaratorDecl contains a DeclaratorInfo* to keep type source info.
Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl.
EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo.

Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet.

llvm-svn: 79392
2009-08-19 01:27:57 +00:00
Owen Anderson c36edfede5 Update for LLVM API change.
llvm-svn: 78957
2009-08-13 23:27:53 +00:00
Owen Anderson 41a750271b Update for LLVM API change.
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Owen Anderson 758428f4e3 Update for LLVM API change.
llvm-svn: 78259
2009-08-05 23:18:46 +00:00
Daniel Dunbar a1d8bcd33e When generating cleanup blocks for Obj-C @finally, mark them as catch all blocks
from the perspective of LLVM exception handling. Otherwise the C++ personality
function may decide not to run them, if it only detects cleanup handlers.
 - Test case for this is exceptions.m in llvm-test.

llvm-svn: 77999
2009-08-03 21:20:07 +00:00
Daniel Dunbar 59e476b1b9 Formatting fixes (trailing whitespace, 80-cols, indentation).
llvm-svn: 77972
2009-08-03 17:06:42 +00:00
Owen Anderson 0b75f23b94 Update for LLVM API change.
llvm-svn: 77722
2009-07-31 20:28:54 +00:00
Owen Anderson fe4e34707c Update for LLVM API change.
llvm-svn: 77686
2009-07-31 17:39:36 +00:00
Mike Stump 658fe02d17 Canonicalize else spacing.
llvm-svn: 77629
2009-07-30 22:28:39 +00:00
Douglas Gregor 716dabbb1b Eliminate an unused-variable warning
llvm-svn: 77518
2009-07-29 22:40:58 +00:00
Owen Anderson 9793f0e4d7 Update for LLVM API change.
llvm-svn: 77514
2009-07-29 22:16:19 +00:00
Ted Kremenek c23c7e6a51 Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsRecordType() -> Type::getAs<RecordType>()
  Type::getAsPointerType() -> Type::getAs<PointerType>()
  Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
  Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
  Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
  Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsTagType() -> Type::getAs<TagType>()
  
And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.

llvm-svn: 77510
2009-07-29 21:53:49 +00:00
Owen Anderson ade90fd1ba Update for LLVM API change.
llvm-svn: 77492
2009-07-29 18:54:39 +00:00
Owen Anderson 47034e1733 Update for LLVM API change.
llvm-svn: 77349
2009-07-28 18:33:04 +00:00
Chris Lattner 1d0f16f22a add some fixme's
llvm-svn: 77343
2009-07-28 18:25:06 +00:00
Fariborz Jahanian e309b48a22 Patch for objc's zero-const exception to not assume
that @catch(...) cathces all exceptions (c++ objects
are not cought by that).

llvm-svn: 77270
2009-07-27 23:12:41 +00:00
Owen Anderson 0e0189d64d Update for LLVM API change.
llvm-svn: 77267
2009-07-27 22:29:56 +00:00
Owen Anderson b7a2fe6f81 Update for LLVM API change.
llvm-svn: 77012
2009-07-24 23:12:58 +00:00
Anders Carlsson e2c6baf629 Don't use getLLVMFieldNo for bitfields when constructing the ivar layout maps for GC.
llvm-svn: 76978
2009-07-24 17:23:54 +00:00
Daniel Dunbar c46a079957 Fix declaration of obc_enumerationMutation function, for GNU runtime.
llvm-svn: 76959
2009-07-24 07:40:24 +00:00
Owen Anderson a265a3876c Update for LLVM API change.
llvm-svn: 76599
2009-07-21 18:06:41 +00:00
Anders Carlsson 27b50135ee Rename NextOffset to DataSize, which better matches the Itanium C++ ABI
llvm-svn: 76339
2009-07-18 21:26:44 +00:00
Anders Carlsson 15b73deeea Revert r75641.
llvm-svn: 76327
2009-07-18 19:43:29 +00:00
Chris Lattner f56501ce48 fix objc codegen to not have its own list of things that eventually get into llvm.used, just
populate CGM's list directly.

llvm-svn: 76266
2009-07-17 23:57:13 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Ted Kremenek e3fb4b6524 Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.

llvm-svn: 76098
2009-07-16 19:58:26 +00:00
Steve Naroff 79d1215d83 Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.

llvm-svn: 76076
2009-07-16 15:41:00 +00:00
Owen Anderson 170229f68d Update for LLVM API change, and contextify a bunch of related stuff.
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Anders Carlsson 466fd0a16d Rename RecordLayout.h to ASTRecordLayout.h
llvm-svn: 75641
2009-07-14 17:29:11 +00:00
Owen Anderson ae86c19e68 Update for LLVM API change.
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Daniel Dunbar 9d82da40ec Generate correct prototype for objc_enumerationMutation.
- This was a latent bug exposed by the recent objc type changes.

llvm-svn: 75383
2009-07-11 20:32:50 +00:00
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