Commit Graph

303 Commits

Author SHA1 Message Date
Steve Naroff 8d9cc9ebc1 Remove ASTContext::getObjCQualifiedIdType().
Convert clients to use ASTContext::getObjCObjectPointerType().

llvm-svn: 74424
2009-06-29 16:22:52 +00:00
Anders Carlsson 082acded44 Implement enough of the 'auto' keyword so we can claim to support N2546.
llvm-svn: 74307
2009-06-26 18:41:36 +00:00
Anders Carlsson 7d209570b6 Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.
llvm-svn: 74175
2009-06-25 15:00:34 +00:00
Anders Carlsson ad6bd35b46 C++ decltype support (N2343)
llvm-svn: 74118
2009-06-24 21:24:56 +00:00
Anders Carlsson 81df7b89de Add a DecltypeType type.
llvm-svn: 74099
2009-06-24 19:06:50 +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
Steve Naroff fb4330f255 First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).

This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). 

No functionality change.

llvm-svn: 73649
2009-06-17 22:40:22 +00:00
Douglas Gregor 758a869b14 Support dependent extended vector types and template instantiation
thereof. Patch by Anders Johnsen!

llvm-svn: 73641
2009-06-17 21:51:59 +00:00
Anders Carlsson 90036dc96a Keep track of whether a type parameter type is a parameter pack.
llvm-svn: 73452
2009-06-16 00:30:48 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Chris Lattner ecd79c6353 move GetBuiltinType from Builtin::Context to ASTContext.
llvm-svn: 73316
2009-06-14 00:45:47 +00:00
Eli Friedman a6638ca3a3 Delete method which is now trivial.
llvm-svn: 73043
2009-06-08 05:08:54 +00:00
Eli Friedman 9e81b02ec5 Don't allow defining a block with a non-prototype type. Remove a
hack which introduces some strange inconsistencies in compatibility 
for block pointers.

Note that unlike an earlier revision proposed on cfe-commits, this patch 
still allows declaring block pointers without a prototype.

llvm-svn: 73041
2009-06-08 04:24:21 +00:00
Eli Friedman 9ffd4a9b96 Move CharIsSigned from TargetInfo to LangOptions.
llvm-svn: 72928
2009-06-05 07:05:05 +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 b68215c4de Place the GC attribute on the same relative pointer
position to make it consistant and to match gcc's behavior,
by placing it at the inner-most pointer.

llvm-svn: 72784
2009-06-03 17:15:17 +00:00
Fariborz Jahanian 991a2b1933 Diagnose misuse of __strong attribute in a redeclaration.
llvm-svn: 72737
2009-06-02 20:58:58 +00:00
Fariborz Jahanian 6ab4375f87 Issue diagnostics on __weak attribute mismatch.
Fixes an error recovery issue which caused a crash.

llvm-svn: 72733
2009-06-02 18:32:00 +00:00
Eli Friedman 5aa28de4fe Fix a silly typo in my previous objc_gc merging patch.
llvm-svn: 72723
2009-06-02 07:45:37 +00:00
Eli Friedman 091a9ac014 Cleaned-up version of gc attribute type merging. I still don't like it
very much, but I have a feeling we're never going to have an 
implementation that makes sense because of compatibility issues.

llvm-svn: 72715
2009-06-02 05:28:56 +00:00
Fariborz Jahanian 2d725b19da This patch attempts to fix the merging of __strong/__weak attributes
in merge_types. It is incomplete. We probably want to issue 
a warning if user attempts to change the attribute from __weak to
__strong or vice-vera. It also assumes that a __weak/__strong
attribute can not be specified with other (currently one) type
attriute. 

llvm-svn: 72711
2009-06-02 01:40:22 +00:00
Eli Friedman dcca6333c6 Disable type merging with gc attributes. This has a number of nasty
properties at the moment:

1. It allows stuff like "__strong id x; __weak id x;".

2. For constructs like "__strong id x; id x;", subsequent references to 
x lose the objc_gc attribute.

3. This incorrectly allows merges involving the address_space attribute.

4. Constructs like "id x; /* some code using x */ __weak id x;" don't 
apply the objc_gc attribute consistently to all uses of x.

The first three can probably be fixed relatively easily; the fourth 
would be extremely difficult to fix.

llvm-svn: 72683
2009-06-01 01:22:52 +00:00
Douglas Gregor 7de5966d76 Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.

llvm-svn: 72590
2009-05-29 20:38:28 +00:00
Eli Friedman be7e42b27f Add an assertion so that we don't accidentally build constant arrays of
VLAs.

llvm-svn: 72587
2009-05-29 20:17:55 +00:00
Sebastian Redl 5068f77ac7 Reintroduce the home for exception specs, and make Sema fill it. However, keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere.
llvm-svn: 72498
2009-05-27 22:11:52 +00:00
Sebastian Redl a81b0b7ef5 Add a big test case for I-C-Es in C++, and a fix to make it work. The fix might not be the right way to do it.
llvm-svn: 72490
2009-05-27 19:34:06 +00:00
Steve Naroff 4fc95aa0d4 Convert ObjC qualified type clients over to using iterators.
This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType.

No functionality change.

llvm-svn: 72475
2009-05-27 16:21:00 +00:00
Douglas Gregor a30d046059 Simplify printing of the statistics for types.
llvm-svn: 72415
2009-05-26 14:40:08 +00:00
Eli Friedman 7ab09572c6 Extend getPreferredTypeAlign to handle _Complex double and long long
correctly.

llvm-svn: 72401
2009-05-25 21:27:19 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Anders Carlsson 32440a0f48 Use the Itanium ABI for member pointers. Add a missing 'break' statement and a test case
llvm-svn: 71972
2009-05-17 02:06:04 +00:00
Chris Lattner e2df3f9fe5 Fix rdar://6880874 - [sema] crash on array types with different index sizes
llvm-svn: 71634
2009-05-13 04:12:56 +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
Douglas Gregor 5e4e50c280 The canonical declaration of a NULL declaration is NULL
llvm-svn: 71409
2009-05-10 22:59:12 +00:00
Douglas Gregor e362cea568 Implement the semantics of the injected-class-name within a class
template. The injected-class-name is either a type or a template,
depending on whether a '<' follows it. As a type, the
injected-class-name's template argument list contains its template
parameters in declaration order.

As part of this, add logic for canonicalizing declarations, and be
sure to canonicalize declarations used in template names and template
arguments. 

A TagType is dependent if the declaration it references is dependent.

I'm not happy about the rather complicated protocol needed to use
ASTContext::getTemplateSpecializationType.

llvm-svn: 71408
2009-05-10 22:57:19 +00:00
Sebastian Redl 576fd424df Implement C++0x nullptr.
llvm-svn: 71405
2009-05-10 18:38:11 +00:00
Daniel Dunbar 81ded69511 Remove -fobjc-tight-layout, seems to work!
llvm-svn: 71184
2009-05-07 21:58:26 +00:00
Douglas Gregor 6bc50585e3 Start canonicalizing template names. This is not yet complete, but it
improves type identity with dependent types.

llvm-svn: 71152
2009-05-07 06:41:52 +00:00
Sebastian Redl f08aa62c80 Back out r70506 (exception spec in AST) again. We won't have exception specs until we've had a lot more discussion.
llvm-svn: 71125
2009-05-06 23:27:55 +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 e993ba6fca Add -fobjc-tight-layout.
- This implements gcc style Objective-C interface layout (I
   think). Currently it is always off, there is no functionality
   change unless this is passed.
   
   For the curious, the deal is that gcc lays out the fields of a
   subclass as if they were part of the superclass. That is, the
   subclass fields immediately follow the super class fields instead
   of being padded to the alignment of the superclass structure.

 - Currently gcc uses the tight layout in 32-bit and 64-bit modes, and
   llvm-gcc uses it in 32-bit only, for reasons which aren't clear
   yet. We probably want to switch to matching gcc, once this makes it
   through testing... my hope is that we can also fix llvm-gcc in
   order to maintain compatibility between the compilers.

llvm-svn: 70827
2009-05-04 05:16:21 +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 e49e9c3a52 Remove ASTContext::addRecordToClass.
llvm-svn: 70780
2009-05-03 14:27:48 +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 7bee415836 Fix a possible memory error, the record layout entry could be
invalidated by layout out the super class, we cannot cache the map
entry.

llvm-svn: 70693
2009-05-03 11:41:43 +00:00
Daniel Dunbar 2b65fe3a32 Implement the interface/implementation layout distinction.
- These routines should now be independent of the Sema state.

 - This is nearly zero functionality change, the distinction only
   matters in the non-fragile ABI, and the consumers that care about
   this distinction should be using getASTObjCImplementationLayout.

llvm-svn: 70692
2009-05-03 11:16:44 +00:00
Daniel Dunbar 02f7f5f6d6 Split out getASTObjCImplementationLayout
- The difference from getASTObjCInterfaceLayout is that the computes
   the layout including synthesized ivars.

 - No functionality change, they currently both compute the same thing
   -- whether that includes synthesized ivars or not depends on when
   they get called!!!

llvm-svn: 70690
2009-05-03 10:38:35 +00:00
Sebastian Redl aae83b4596 Make a home for exception specs in the AST. Now Sema can hook them up.
llvm-svn: 70506
2009-04-30 19:20:55 +00:00
Douglas Gregor ef462e6bb0 Properly compute the alignment of typedefs that make use of the
"aligned" attribute. Previously, we were skipping over these
attributes when we jumped directly to the canonical type. Now,
ASTContext::getTypeInfo walks through typedefs and other
"non-canonical" types manually, looking for "aligned" attributes on
typedefs.

As part of this change, I moved the GNU-specific logic (such as
determining the alignment of void or of a function pointer) out of the
expression evaluator and into ASTContext::getTypeInfo.

llvm-svn: 70497
2009-04-30 17:32:17 +00:00
Chris Lattner 0a415ec50c int128_t is apparently 128-bit aligned on all 64-bit targets, and
not supported on 32-bit targets, so we can define it to be 128-bit
aligned there too :)

llvm-svn: 70465
2009-04-30 02:55:13 +00:00