Commit Graph

765 Commits

Author SHA1 Message Date
Nuno Lopes cc041ea68e fix compiler warnings
llvm-svn: 52089
2008-06-08 10:16:34 +00:00
Eli Friedman c98a7add43 Don't crash emitting an initializer for a static local with union type.
This fix just makes sure to construct the global with the appropriate 
type, and fixes up the one user this affects to compensate.

llvm-svn: 52084
2008-06-08 01:23:18 +00:00
Chris Lattner a5678ccd4a capture whether a CharacterLiteral was wide or not in the AST.
Patch by Mike Stump!

llvm-svn: 52081
2008-06-07 22:35:38 +00:00
Chris Lattner a0173131fa Fix ast dumping to work with long double literals, e.g. we dump:
long double X() { return 1.0L; }

as:

long double X()
(CompoundStmt 0xb06a00 <t.c:2:17, col:32>
  (ReturnStmt 0xb068d0 <col:19, col:26>
    (FloatingLiteral 0xb02cf0 <col:26> 'long double' 1.000000)))

llvm-svn: 52080
2008-06-07 22:13:43 +00:00
Eli Friedman 3ce7b20590 Fix crash with conversion to an address-space-qualified pointer. Bug
reported on cfe-dev by Cédric Venet.

Note that I seriously doubt that this perticular construct is useful, 
though: it's a pointer in an alternate address space pointing into 
unqualified address space.

llvm-svn: 52076
2008-06-07 17:27:51 +00:00
Eli Friedman 7dbab8a6a1 Fix the line endings in the newly added DeclBase.cpp.
llvm-svn: 52075
2008-06-07 16:52:53 +00:00
Sanjiv Gupta 1929242a94 Create debug type descriptors for aggregate/enum types.
llvm-svn: 52070
2008-06-07 04:46:53 +00:00
Ted Kremenek ef17049bac Reclaim memory owned by ObjCForwardProtocolDecls.
llvm-svn: 52063
2008-06-06 21:05:33 +00:00
Eli Friedman fd1e32b1f3 Reorganize this loop a bit so it doesn't crash for empty unions. Fixes
PR2419.

llvm-svn: 52060
2008-06-06 20:12:37 +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
Eli Friedman 01321c3b8c Clean up dead code from SemaInit landing.
llvm-svn: 52054
2008-06-06 19:40:52 +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
Nuno Lopes 9b07b7b099 implement constant expr. sub ptr ptr
llvm-svn: 52049
2008-06-06 16:41:08 +00:00
Devang Patel 8f5645cd51 During interface layout, don't forget super class.
llvm-svn: 52035
2008-06-06 02:14:01 +00:00
Devang Patel e1f10511ba Undo previous check-in.
llvm-svn: 52034
2008-06-06 02:00:35 +00:00
Devang Patel 1216b05d3d During interface layout, don't forget super class.
llvm-svn: 52033
2008-06-06 01:50:12 +00:00
Steve Naroff d32ae8edf2 Oops...remove weird printf:-)
llvm-svn: 52025
2008-06-05 22:58:33 +00:00
Steve Naroff 946166f4e9 Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol
llvm-svn: 52024
2008-06-05 22:57:10 +00:00
Steve Naroff a44099f022 super fix submitted by David Chisnall.
llvm-svn: 52014
2008-06-05 18:14:25 +00:00
Steve Naroff 31e1d41338 Fixed a recent test regression from last night (r51976).
llvm-svn: 52006
2008-06-05 15:03:27 +00:00
Steve Naroff 25449a5221 Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.

llvm-svn: 52005
2008-06-05 14:49:39 +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
Sanjiv Gupta 158143ad54 Emit debug information for global and static variables when -g is specified.
llvm-svn: 51993
2008-06-05 08:59:10 +00:00
Steve Naroff d1c3d1130b Fix trivial crasher and downgrade an error to warning (to match GCC).
llvm-svn: 51976
2008-06-05 04:33:44 +00:00
Steve Naroff cfdf6166fc Support "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the only documentation I could find on it).
/* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>" - nisse@lysator.liu.se.  */

This commit adds the parser magic. The type associated with <p> is still incorrect. Will discuss with Chris.

llvm-svn: 51972
2008-06-05 00:02:44 +00:00
Steve Naroff d5bf26fa26 Fix crash identified by <rdar://problem/5986085>.
llvm-svn: 51969
2008-06-04 23:08:38 +00:00
Devang Patel dbb7263fd9 Add ObjCInterface layout support.
Reuse RecordLayout.

llvm-svn: 51968
2008-06-04 21:54:36 +00:00
Devang Patel 21979193bb Refactoring.
Move field layout code in a ASTRecordLayout member fn.

llvm-svn: 51966
2008-06-04 21:22:16 +00:00
Ted Kremenek 46267c839d Added fixmes.
llvm-svn: 51964
2008-06-04 20:48:08 +00:00
Steve Naroff d9c2607014 Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
llvm-svn: 51963
2008-06-04 20:36:13 +00:00
Eli Friedman 3e1852fa7e Make sure the types are consistent for a void conditional. No visible
difference, but it's better to be consistent.

llvm-svn: 51961
2008-06-04 19:47:51 +00:00
Eli Friedman 2425cd8158 For setting attributes, don't assume there are ParamVarDecls available,
because trying to access non-existent ParamVarDecls can crash. 
Testcase from the original source for PR2414.

llvm-svn: 51960
2008-06-04 19:41:28 +00:00
Nuno Lopes 7bd6e58ddc fix crash when codegening 'cond ? lhs : call-to-void-func()'
llvm-svn: 51958
2008-06-04 19:15:45 +00:00
Nuno Lopes 28bcfec325 fix type of ?: operator. If one of the operator is void, the type should be void as well.
Please confirm this is safe

llvm-svn: 51957
2008-06-04 19:14:12 +00:00
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