Commit Graph

729 Commits

Author SHA1 Message Date
Fariborz Jahanian 6e59392e4b Fix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
assigned to less protocol qualified object on LHS.

llvm-svn: 51956
2008-06-04 19:00:03 +00:00
Eli Friedman 67b827900e Make the width and alignment for long double consistent with the
hardcoded data layout in getTargetDescription.  Hopefully fixes a test 
failure.

Of course, this should be fixed properly, but that's a bigger fix.

llvm-svn: 51948
2008-06-04 17:01:45 +00:00
Eli Friedman c0b54901f4 clang fix to parallel LLVM r51928
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080602/063306.html).

llvm-svn: 51944
2008-06-04 16:13:19 +00:00
Ted Kremenek b147ad1051 Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.
llvm-svn: 51943
2008-06-04 15:55:15 +00:00
Steve Naroff c68e382ba9 ASTContext::typesAreCompatible(): id is compatible with all qualified id types.
llvm-svn: 51939
2008-06-04 15:07:33 +00:00
Steve Naroff f4308aac53 Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.
llvm-svn: 51938
2008-06-04 14:43:54 +00:00
Argyrios Kyrtzidis 6301884dc0 Move Decl and DeclContext implementations into a new DeclBase.cpp file.
llvm-svn: 51936
2008-06-04 13:04:04 +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
Steve Naroff cff2688180 Give the "isa" slot a name!
llvm-svn: 51924
2008-06-04 03:03:48 +00:00
Steve Naroff b115be707d Put back my temporary hack until Eli addresses this in a more complete fashion.
llvm-svn: 51920
2008-06-03 22:06:04 +00:00
Steve Naroff 13c360cec4 Implement another property related FIXME:
Fix <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union

llvm-svn: 51919
2008-06-03 21:56:14 +00:00
Eli Friedman 149614bfe7 Re-fix r51907 in a way which doesn't affect valid code. This essentially
moves the check for the invalid construct to a point where it doesn't 
affect other uses of isIntegerConstantExpr, and we can warn properly 
when the extension is used.  This makes it a bit more complicated, but 
it's a lot cleaner.

Steve, please tell me if this check is sufficient to handle the 
relevant system header.  I know it's enough to handle the testcase, but 
I don't know what exactly the original looks like.

llvm-svn: 51918
2008-06-03 21:01:11 +00:00
Steve Naroff ec62418fc5 Fixup recent "super" regression.
llvm-svn: 51913
2008-06-03 18:21:00 +00:00
Steve Naroff aaf5108d26 Change Expr::isIntegerConstantExpr() to allow for pointer types (for GCC compatibility). Note FIXME.
Fix <rdar://problem/5977870> clang on xcode: error: arrays with static storage duration must have constant integer length

llvm-svn: 51907
2008-06-03 17:15:29 +00:00
Steve Naroff b788d9bd27 Allow implicit pointer/int conversions on ObjCQualifiedIdTypes in Sema::CheckCompareOperands() and Sema::CheckAssignmentConstraints().
Fixes <rdar://problem/5980804> clang on xcode: error: incompatible type sending 'id<XDUMLType>', expected 'NSCellType'.

llvm-svn: 51902
2008-06-03 14:04:54 +00:00
Steve Naroff 0b225dac9b Finish up r51900.
llvm-svn: 51901
2008-06-03 13:21:30 +00:00
Steve Naroff 1ba306cde5 Allow for a GCC cast extension.
Fixes part of <rdar://problem/5980829> clang on xcode: used type 'NSRange' where arithmetic or pointer type is required.

llvm-svn: 51900
2008-06-03 12:56:35 +00:00
Steve Naroff b877e2c3ca Fix parser bug/FIXME with @catch.
<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch)

llvm-svn: 51895
2008-06-03 05:36:54 +00:00
Steve Naroff ebf4cb4841 Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'
llvm-svn: 51888
2008-06-02 23:03:37 +00:00
Chris Lattner fd2fe8270e handle the full assignment-expression grammar when using an
objc message send in an initializer expression.

llvm-svn: 51882
2008-06-02 21:31:07 +00:00
Ted Kremenek 0b6b0e7157 Teach the CF retain checker about "_init" methods. Fixes: <rdar://problem/5956379>
llvm-svn: 51872
2008-06-02 17:14:13 +00:00
Nuno Lopes 3fe4651e2e fix decl attributes cleaning
this plugs the leak of attributes and also fixes a crash in the test

llvm-svn: 51862
2008-06-01 22:53:53 +00:00
Argyrios Kyrtzidis 28172cb812 Include <string> header to allow compiling for MSVC.
llvm-svn: 51847
2008-06-01 21:23:24 +00:00
Nuno Lopes 363212b3fa fix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)
llvm-svn: 51843
2008-06-01 18:31:24 +00:00
Eli Friedman 412c66839e Don't name the ObjC types if there aren't any ObjC objects in the file.
Patch by David Chisnall.

llvm-svn: 51840
2008-06-01 16:00:02 +00:00
Eli Friedman f6b091f73a First cut at setting attributes for functions and calls; this puts us
much closer to passing the gcc struct layout tests.

It might be possible to refactor this a bit, but I'm not sure there's 
actually enough common code for that to be useful.

To get the calling convention completely correct, a bit of 
platform-specific code is necessary even for x86-Linux. On x86-Linux, the
alignment of function parameters is extremely strange; as far as I can tell,
it's always 4 except for SSE vectors or structs containing SSE vectors.  I'm 
continuing to investigate this.

llvm-svn: 51839
2008-06-01 15:54:49 +00:00
Eli Friedman 10c2417570 Make sure _Bool globals have the correct type.
llvm-svn: 51838
2008-06-01 15:31:44 +00:00
Eli Friedman 149a57f7d4 Minor cleanup to use the ConvertTypeForMem helper.
llvm-svn: 51837
2008-06-01 15:16:01 +00:00
Anton Korobeynikov 3b6dd58ee7 Remove spurious == 0
llvm-svn: 51836
2008-06-01 15:14:46 +00:00
Anton Korobeynikov 1200aca763 Support for code generation of Objective-C top-level language constructs.
Implemented by David Chisnall!

llvm-svn: 51835
2008-06-01 14:13:53 +00:00
Steve Naroff e643e12313 Tweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types on the RHS.
This eliminates a bogus warning identified in the test below.

This fixes <rdar://problem/5968256> clang on xcode: error: incompatible type initializing 'NSObject<XCSelectionSource> *', expected 'id<NSObject,XCSelectionSource>'

llvm-svn: 51832
2008-06-01 02:43:50 +00:00
Steve Naroff 524011f389 Teach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes a bogus error.
<rdar://problem/5967036> clang on xcode: error: incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream *')

llvm-svn: 51828
2008-05-31 22:33:45 +00:00
Eli Friedman 252e5f1b29 Calculate alignment for local variables.
llvm-svn: 51826
2008-05-31 21:20:41 +00:00
Ted Kremenek 380df93fd6 Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).

Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls.  This is a workaround for: <rdar://problem/5966749>

llvm-svn: 51825
2008-05-31 20:11:04 +00:00
Steve Naroff a326bae77a Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
llvm-svn: 51809
2008-05-31 02:19:15 +00:00
Steve Naroff 66002283e6 Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.
llvm-svn: 51800
2008-05-30 23:23:16 +00:00
Eli Friedman 6859a1b961 PR1893: Fix up the type of tentative definitions of incomplete array
types so that they end up the correct size.

llvm-svn: 51787
2008-05-30 20:39:54 +00:00
Eli Friedman 34994cbcbf Fix and enable generating general union initializers. Essentially, what
this does is reconstruct the type for structs and arrays if the type 
wouldn't be compatible otherwise.

The assertion about packing in the struct type reconstruction code 
sucks, but I don't see any obvious way to fix it.  Maybe we need a general
utility method to take a list of types and alignments and try to construct an
unpacked type if possible?

llvm-svn: 51785
2008-05-30 19:58:50 +00:00
Eli Friedman c18d9d53bb Allow the type of a global to be different from the type of its
associated declaration. This is a prerequisite to handling
general union initializations; for example, an array of unions involving 
pointers has to be turned into a struct because the elements can have 
incompatible types.

I refactored the code a bit to make it more readable; now, the logic for 
definitions is all in EmitGlobalVarInit.

The second parameter for GetAddrOfGlobalVar is now dead; I'll remove it 
separately.

By itself, this patch should not cause any visible changes.

llvm-svn: 51783
2008-05-30 19:50:47 +00:00
Eli Friedman 66572afde4 Allow a pointer implicitly cast to a bool as a constant expression, as
required by the standard (the standard doesn't know anything about 
implicit casts).

Disallow pointers cast to non-integral arithmetic types as constant 
expressions.  This was previously allowed by accident. 

llvm-svn: 51779
2008-05-30 18:14:48 +00:00
Eli Friedman 3360d898ec Make sure to allow assigning a pointer to a bool.
llvm-svn: 51778
2008-05-30 18:07:22 +00:00
Ted Kremenek 8595668eca Fix some strict-aliasing warnings by using Stmt* instead of Expr* in VariableArrayType, EnumConstantDecl, and VarDecl.
llvm-svn: 51772
2008-05-30 16:14:41 +00:00
Eli Friedman f7fe41656c Fix constant vector init for initializer lists with an incomplete list
of elements.

llvm-svn: 51769
2008-05-30 12:02:14 +00:00
Eli Friedman 617ba48fd5 Always check that the definition of a function has the correct type.
This fixes a crash on the included testcase (found in NetHack).

llvm-svn: 51767
2008-05-30 11:13:18 +00:00
Sanjiv Gupta 18de624ca0 Emit parameter and local variable debug information with -g.
llvm-svn: 51765
2008-05-30 10:30:31 +00:00
Eli Friedman 711665c309 Add FIXME to CodeGen struct layout.
llvm-svn: 51764
2008-05-30 10:29:32 +00:00
Eli Friedman a2eaffc747 Some additions to constant initializer generation code. Adds
bit-field initialization; ugly code, X86-only, but it works, at least 
for basic stuff.  Separates/adds union initialization; currently disabled,
though, because the struct/array code needs modifications to support 
elements of the wrong type.

Fixes PR2381 and PR2309 with the bit-field initialization.  And NetHack 
compiles and appears to work with a few tweaks (to work around the lack 
of transparent_union support, and clang being a bit strict about
conflicting declarations).

llvm-svn: 51763
2008-05-30 10:24:46 +00:00
Eli Friedman 3df5efe83e Cleanup/refactoring of Sema struct layout. This patch unifies the struct
and union codepaths and fixes some minor bugs.

I'm reasonably confident this is accurate, at least for X86.  I'll 
correct any bugs as I find them; I haven't found any for a while, 
though.

llvm-svn: 51762
2008-05-30 09:31:38 +00:00
Steve Naroff ec94403018 Add basic support for properties references (a missing feature).
While it is far from complete, it does fix the following <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union

llvm-svn: 51719
2008-05-30 00:40:33 +00:00
Ted Kremenek 5fc6dc070c Fix one strict-aliasing warning.
llvm-svn: 51707
2008-05-29 21:52:26 +00:00