]> granicus.if.org Git - clang/log
clang
16 years agoReclaim memory owned by ObjCForwardProtocolDecls.
Ted Kremenek [Fri, 6 Jun 2008 21:05:33 +0000 (21:05 +0000)]
Reclaim memory owned by ObjCForwardProtocolDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52063 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReorganize this loop a bit so it doesn't crash for empty unions. Fixes
Eli Friedman [Fri, 6 Jun 2008 20:12:37 +0000 (20:12 +0000)]
Reorganize this loop a bit so it doesn't crash for empty unions.  Fixes
PR2419.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52060 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement "Destroy" and destructor for ObjCClassDecl, allowing us to reclaim its...
Ted Kremenek [Fri, 6 Jun 2008 20:11:53 +0000 (20:11 +0000)]
Implement "Destroy" and destructor for ObjCClassDecl, allowing us to reclaim its memory and the memory of the Decls it owns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52059 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement "Destroy" and destructor for ObjCProtocolDecl, allowing us to reclaim its...
Ted Kremenek [Fri, 6 Jun 2008 19:48:57 +0000 (19:48 +0000)]
Implement "Destroy" and destructor for ObjCProtocolDecl, allowing us to reclaim its memory and the memory of the Decls it owns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52055 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoClean up dead code from SemaInit landing.
Eli Friedman [Fri, 6 Jun 2008 19:40:52 +0000 (19:40 +0000)]
Clean up dead code from SemaInit landing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52054 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBecause of a lack of a clear ownership role between ObjCInterfaceDecls and
Ted Kremenek [Fri, 6 Jun 2008 17:21:42 +0000 (17:21 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52051 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInitial work on additional memory collection for ObjC AST objects. We now
Ted Kremenek [Fri, 6 Jun 2008 16:45:15 +0000 (16:45 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52050 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimplement constant expr. sub ptr ptr
Nuno Lopes [Fri, 6 Jun 2008 16:41:08 +0000 (16:41 +0000)]
implement constant expr. sub ptr ptr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52049 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDuring interface layout, don't forget super class.
Devang Patel [Fri, 6 Jun 2008 02:14:01 +0000 (02:14 +0000)]
During interface layout, don't forget super class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52035 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUndo previous check-in.
Devang Patel [Fri, 6 Jun 2008 02:00:35 +0000 (02:00 +0000)]
Undo previous check-in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52034 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDuring interface layout, don't forget super class.
Devang Patel [Fri, 6 Jun 2008 01:50:12 +0000 (01:50 +0000)]
During interface layout, don't forget super class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52033 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix crash when running with multiple source files. This can be improved.
Ted Kremenek [Fri, 6 Jun 2008 01:47:30 +0000 (01:47 +0000)]
Fix crash when running with multiple source files.  This can be improved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52032 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoOops...remove weird printf:-)
Steve Naroff [Thu, 5 Jun 2008 22:58:33 +0000 (22:58 +0000)]
Oops...remove weird printf:-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52025 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSecond half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition...
Steve Naroff [Thu, 5 Jun 2008 22:57:10 +0000 (22:57 +0000)]
Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52024 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIgnore a few more linker arguments.
Ted Kremenek [Thu, 5 Jun 2008 22:46:24 +0000 (22:46 +0000)]
Ignore a few more linker arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52023 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosuper fix submitted by David Chisnall.
Steve Naroff [Thu, 5 Jun 2008 18:14:25 +0000 (18:14 +0000)]
super fix submitted by David Chisnall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52014 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed a recent test regression from last night (r51976).
Steve Naroff [Thu, 5 Jun 2008 15:03:27 +0000 (15:03 +0000)]
Fixed a recent test regression from last night (r51976).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52006 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void',...
Steve Naroff [Thu, 5 Jun 2008 14:49:39 +0000 (14:49 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52005 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberRef...
Steve Naroff [Thu, 5 Jun 2008 13:55:23 +0000 (13:55 +0000)]
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>").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52001 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEmit debug information for global and static variables when -g is specified.
Sanjiv Gupta [Thu, 5 Jun 2008 08:59:10 +0000 (08:59 +0000)]
Emit debug information for global and static variables when -g is specified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51993 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix trivial crasher and downgrade an error to warning (to match GCC).
Steve Naroff [Thu, 5 Jun 2008 04:33:44 +0000 (04:33 +0000)]
Fix trivial crasher and downgrade an error to warning (to match GCC).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51976 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSupport "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the only docume...
Steve Naroff [Thu, 5 Jun 2008 00:02:44 +0000 (00:02 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51972 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix crash identified by <rdar://problem/5986085>.
Steve Naroff [Wed, 4 Jun 2008 23:08:38 +0000 (23:08 +0000)]
Fix crash identified by <rdar://problem/5986085>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51969 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd ObjCInterface layout support.
Devang Patel [Wed, 4 Jun 2008 21:54:36 +0000 (21:54 +0000)]
Add ObjCInterface layout support.
Reuse RecordLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51968 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate a test and add a FIXME.
Steve Naroff [Wed, 4 Jun 2008 21:38:52 +0000 (21:38 +0000)]
Update a test and add a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51967 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRefactoring.
Devang Patel [Wed, 4 Jun 2008 21:22:16 +0000 (21:22 +0000)]
Refactoring.
Move field layout code in a ASTRecordLayout member fn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51966 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc-analyzer now properly eats the -install_name, -exported_symbols_list, -current_ve...
Ted Kremenek [Wed, 4 Jun 2008 20:49:03 +0000 (20:49 +0000)]
ccc-analyzer now properly eats the -install_name, -exported_symbols_list, -current_version, -compatibility_version, and -sectorder command line arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51965 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded fixmes.
Ted Kremenek [Wed, 4 Jun 2008 20:48:08 +0000 (20:48 +0000)]
Added fixmes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51964 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoParser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
Steve Naroff [Wed, 4 Jun 2008 20:36:13 +0000 (20:36 +0000)]
Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51963 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure the types are consistent for a void conditional. No visible
Eli Friedman [Wed, 4 Jun 2008 19:47:51 +0000 (19:47 +0000)]
Make sure the types are consistent for a void conditional.  No visible
difference, but it's better to be consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51961 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFor setting attributes, don't assume there are ParamVarDecls available,
Eli Friedman [Wed, 4 Jun 2008 19:41:28 +0000 (19:41 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51960 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix crash when codegening 'cond ? lhs : call-to-void-func()'
Nuno Lopes [Wed, 4 Jun 2008 19:15:45 +0000 (19:15 +0000)]
fix crash when codegening 'cond ? lhs : call-to-void-func()'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51958 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix type of ?: operator. If one of the operator is void, the type should be void...
Nuno Lopes [Wed, 4 Jun 2008 19:14:12 +0000 (19:14 +0000)]
fix type of ?: operator. If one of the operator is void, the type should be void as well.
Please confirm this is safe

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51957 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
Fariborz Jahanian [Wed, 4 Jun 2008 19:00:03 +0000 (19:00 +0000)]
Fix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
assigned to less protocol qualified object on LHS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51956 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't assume that the type of a FunctionDecl is a FunctionType; that
Eli Friedman [Wed, 4 Jun 2008 17:58:41 +0000 (17:58 +0000)]
Don't assume that the type of a FunctionDecl is a FunctionType; that
assumption isn't accurate in the presence of typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51951 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake the width and alignment for long double consistent with the
Eli Friedman [Wed, 4 Jun 2008 17:01:45 +0000 (17:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51948 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoclang fix to parallel LLVM r51928
Eli Friedman [Wed, 4 Jun 2008 16:13:19 +0000 (16:13 +0000)]
clang fix to parallel LLVM r51928
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080602/063306.html).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51944 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved LangOptions from TranslationUnit to ASTContext. This induced a variety of...
Ted Kremenek [Wed, 4 Jun 2008 15:55:15 +0000 (15:55 +0000)]
Moved LangOptions from TranslationUnit to ASTContext.  This induced a variety of cleanups in some ASTConsumers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51943 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate Xcode project.
Ted Kremenek [Wed, 4 Jun 2008 15:38:06 +0000 (15:38 +0000)]
Update Xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51941 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoASTContext::typesAreCompatible(): id is compatible with all qualified id types.
Steve Naroff [Wed, 4 Jun 2008 15:07:33 +0000 (15:07 +0000)]
ASTContext::typesAreCompatible(): id is compatible with all qualified id types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51939 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSema::ActOnClassMessage() needs to look through it's local implementation for private...
Steve Naroff [Wed, 4 Jun 2008 14:43:54 +0000 (14:43 +0000)]
Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51938 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove Decl and DeclContext implementations into a new DeclBase.cpp file.
Argyrios Kyrtzidis [Wed, 4 Jun 2008 13:04:04 +0000 (13:04 +0000)]
Move Decl and DeclContext implementations into a new DeclBase.cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51936 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure we look through categories when searching for a classes property.
Steve Naroff [Wed, 4 Jun 2008 04:46:04 +0000 (04:46 +0000)]
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'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51925 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGive the "isa" slot a name!
Steve Naroff [Wed, 4 Jun 2008 03:03:48 +0000 (03:03 +0000)]
Give the "isa" slot a name!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51924 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a few more built-in functions.
Steve Naroff [Tue, 3 Jun 2008 22:16:48 +0000 (22:16 +0000)]
Add a few more built-in functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51921 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPut back my temporary hack until Eli addresses this in a more complete fashion.
Steve Naroff [Tue, 3 Jun 2008 22:06:04 +0000 (22:06 +0000)]
Put back my temporary hack until Eli addresses this in a more complete fashion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51920 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement another property related FIXME:
Steve Naroff [Tue, 3 Jun 2008 21:56:14 +0000 (21:56 +0000)]
Implement another property related FIXME:

Fix <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51919 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRe-fix r51907 in a way which doesn't affect valid code. This essentially
Eli Friedman [Tue, 3 Jun 2008 21:01:11 +0000 (21:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51918 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixup recent "super" regression.
Steve Naroff [Tue, 3 Jun 2008 18:21:00 +0000 (18:21 +0000)]
Fixup recent "super" regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51913 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a builtin. Fixes <rdar://problem/5982037> clang on xcode: error: incompatible...
Steve Naroff [Tue, 3 Jun 2008 17:37:43 +0000 (17:37 +0000)]
Add a builtin. Fixes <rdar://problem/5982037> clang on xcode: error: incompatible operand types ('int' and 'char *').

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51908 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange Expr::isIntegerConstantExpr() to allow for pointer types (for GCC compatibilit...
Steve Naroff [Tue, 3 Jun 2008 17:15:29 +0000 (17:15 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51907 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow implicit pointer/int conversions on ObjCQualifiedIdTypes in Sema::CheckCompareO...
Steve Naroff [Tue, 3 Jun 2008 14:04:54 +0000 (14:04 +0000)]
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'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51902 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFinish up r51900.
Steve Naroff [Tue, 3 Jun 2008 13:21:30 +0000 (13:21 +0000)]
Finish up r51900.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51901 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow for a GCC cast extension.
Steve Naroff [Tue, 3 Jun 2008 12:56:35 +0000 (12:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51900 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agomake rewrite macros insert a space when commenting out macros where the token didn't
Chris Lattner [Tue, 3 Jun 2008 06:10:17 +0000 (06:10 +0000)]
make rewrite macros insert a space when commenting out macros where the token didn't
lead with a space.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51896 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix parser bug/FIXME with @catch.
Steve Naroff [Tue, 3 Jun 2008 05:36:54 +0000 (05:36 +0000)]
Fix parser bug/FIXME with @catch.

<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51895 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier...
Steve Naroff [Mon, 2 Jun 2008 23:03:37 +0000 (23:03 +0000)]
Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51888 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse the correct 'ccc-analyzer' when the build command is a direct invocation of gcc.
Ted Kremenek [Mon, 2 Jun 2008 21:52:47 +0000 (21:52 +0000)]
Use the correct 'ccc-analyzer' when the build command is a direct invocation of gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51883 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agohandle the full assignment-expression grammar when using an
Chris Lattner [Mon, 2 Jun 2008 21:31:07 +0000 (21:31 +0000)]
handle the full assignment-expression grammar when using an
objc message send in an initializer expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51882 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5976164> clang ObjC rewriter: for ... in enumeration inserts...
Steve Naroff [Mon, 2 Jun 2008 20:23:21 +0000 (20:23 +0000)]
Fix <rdar://problem/5976164> clang ObjC rewriter: for ... in enumeration inserts undeclared function (objc_enumerationMutation should be in preamble)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51880 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTeach the CF retain checker about "_init" methods. Fixes: <rdar://problem/5956379>
Ted Kremenek [Mon, 2 Jun 2008 17:14:13 +0000 (17:14 +0000)]
Teach the CF retain checker about "_init" methods.  Fixes: <rdar://problem/5956379>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51872 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse "file_language" for per-language -x options.
Ted Kremenek [Mon, 2 Jun 2008 17:13:40 +0000 (17:13 +0000)]
Use "file_language" for per-language -x options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51871 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix decl attributes cleaning
Nuno Lopes [Sun, 1 Jun 2008 22:53:53 +0000 (22:53 +0000)]
fix decl attributes cleaning
this plugs the leak of attributes and also fixes a crash in the test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51862 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInclude <string> header to allow compiling for MSVC.
Argyrios Kyrtzidis [Sun, 1 Jun 2008 21:23:24 +0000 (21:23 +0000)]
Include <string> header to allow compiling for MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51847 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)
Nuno Lopes [Sun, 1 Jun 2008 18:31:24 +0000 (18:31 +0000)]
fix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51843 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't name the ObjC types if there aren't any ObjC objects in the file.
Eli Friedman [Sun, 1 Jun 2008 16:00:02 +0000 (16:00 +0000)]
Don't name the ObjC types if there aren't any ObjC objects in the file.
Patch by David Chisnall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51840 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFirst cut at setting attributes for functions and calls; this puts us
Eli Friedman [Sun, 1 Jun 2008 15:54:49 +0000 (15:54 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51839 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure _Bool globals have the correct type.
Eli Friedman [Sun, 1 Jun 2008 15:31:44 +0000 (15:31 +0000)]
Make sure _Bool globals have the correct type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51838 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor cleanup to use the ConvertTypeForMem helper.
Eli Friedman [Sun, 1 Jun 2008 15:16:01 +0000 (15:16 +0000)]
Minor cleanup to use the ConvertTypeForMem helper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51837 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove spurious == 0
Anton Korobeynikov [Sun, 1 Jun 2008 15:14:46 +0000 (15:14 +0000)]
Remove spurious == 0

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51836 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSupport for code generation of Objective-C top-level language constructs.
Anton Korobeynikov [Sun, 1 Jun 2008 14:13:53 +0000 (14:13 +0000)]
Support for code generation of Objective-C top-level language constructs.
Implemented by David Chisnall!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51835 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types...
Steve Naroff [Sun, 1 Jun 2008 02:43:50 +0000 (02:43 +0000)]
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>'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51832 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd some more test cases that demonstrate clang is a bit stricter than GCC. These...
Steve Naroff [Sat, 31 May 2008 23:10:15 +0000 (23:10 +0000)]
Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51830 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTeach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes...
Steve Naroff [Sat, 31 May 2008 22:33:45 +0000 (22:33 +0000)]
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 *')

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51828 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTwo identifiers are not the same unless they have the same identifier info.
Chris Lattner [Sat, 31 May 2008 22:01:01 +0000 (22:01 +0000)]
Two identifiers are not the same unless they have the same identifier info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51827 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCalculate alignment for local variables.
Eli Friedman [Sat, 31 May 2008 21:20:41 +0000 (21:20 +0000)]
Calculate alignment for local variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51826 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
Ted Kremenek [Sat, 31 May 2008 20:11:04 +0000 (20:11 +0000)]
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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51825 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5917992> clang ObjC rewriter: #end from #if statement lost in...
Steve Naroff [Sat, 31 May 2008 14:15:04 +0000 (14:15 +0000)]
Fix <rdar://problem/5917992> clang ObjC rewriter: #end from #if statement lost in translation.

Some fancy footwork to accommodate embedded preprocessor directives within an interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51815 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously...
Steve Naroff [Sat, 31 May 2008 05:02:17 +0000 (05:02 +0000)]
Fix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously commented out

This fix involved tightening up needToScanForQualifiers(), which predated ObjCQualifiedIdType.
It also includes a minor tweak to the code that searches for the beginning of the qualified type. If the AST contained the correct beginning of the declaration (i.e. the beginning of the declaration specifiers), this code would be more robust. Since it doesn't, we apply an adhoc heuristic. Note that DeclSpec contains this info...we just don't propagate it to the AST (at present).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51812 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHack RewriteObjC::RewriteObjCStringLiteral() to include the filename in the generated...
Steve Naroff [Sat, 31 May 2008 03:35:42 +0000 (03:35 +0000)]
Hack RewriteObjC::RewriteObjCStringLiteral() to include the filename in the generated code (replacing any non-alphanumeric characters with "_"). This allows header files to contain ObjCStringLiterals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51811 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5965704> clang: bad receiver type 'id const'
Steve Naroff [Sat, 31 May 2008 02:19:15 +0000 (02:19 +0000)]
Fix <rdar://problem/5965704> clang: bad receiver type 'id const'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51809 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCorrectly preserve the order between -F and -I options.
Ted Kremenek [Sat, 31 May 2008 00:27:00 +0000 (00:27 +0000)]
Correctly preserve the order between -F and -I options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51803 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTeach Expr::isLvalue() about ObjC properties. For now, all properties are writable...
Steve Naroff [Fri, 30 May 2008 23:23:16 +0000 (23:23 +0000)]
Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51800 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPR1893: Fix up the type of tentative definitions of incomplete array
Eli Friedman [Fri, 30 May 2008 20:39:54 +0000 (20:39 +0000)]
PR1893: Fix up the type of tentative definitions of incomplete array
types so that they end up the correct size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51787 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix and enable generating general union initializers. Essentially, what
Eli Friedman [Fri, 30 May 2008 19:58:50 +0000 (19:58 +0000)]
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?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51785 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow the type of a global to be different from the type of its
Eli Friedman [Fri, 30 May 2008 19:50:47 +0000 (19:50 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51783 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow a pointer implicitly cast to a bool as a constant expression, as
Eli Friedman [Fri, 30 May 2008 18:14:48 +0000 (18:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51779 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure to allow assigning a pointer to a bool.
Eli Friedman [Fri, 30 May 2008 18:07:22 +0000 (18:07 +0000)]
Make sure to allow assigning a pointer to a bool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51778 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse llvm::cl::desc for description of the -Wimplicit-function-declaration option.
Ted Kremenek [Fri, 30 May 2008 16:42:02 +0000 (16:42 +0000)]
Use llvm::cl::desc for description of the -Wimplicit-function-declaration option.

Patch by Holger Schurig!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51774 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix some strict-aliasing warnings by using Stmt* instead of Expr* in VariableArrayTyp...
Ted Kremenek [Fri, 30 May 2008 16:14:41 +0000 (16:14 +0000)]
Fix some strict-aliasing warnings by using Stmt* instead of Expr* in VariableArrayType, EnumConstantDecl, and VarDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51772 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix constant vector init for initializer lists with an incomplete list
Eli Friedman [Fri, 30 May 2008 12:02:14 +0000 (12:02 +0000)]
Fix constant vector init for initializer lists with an incomplete list
of elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51769 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix crash with -serialize (reported to cfe-dev). The issue was
Eli Friedman [Fri, 30 May 2008 11:28:30 +0000 (11:28 +0000)]
Fix crash with -serialize (reported to cfe-dev). The issue was
essentially that we were destroying the declarations twice.

(Note that we don't use -serialize directly in the testsuite, only
SerializeTest.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51768 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAlways check that the definition of a function has the correct type.
Eli Friedman [Fri, 30 May 2008 11:13:18 +0000 (11:13 +0000)]
Always check that the definition of a function has the correct type.
This fixes a crash on the included testcase (found in NetHack).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51767 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEmit parameter and local variable debug information with -g.
Sanjiv Gupta [Fri, 30 May 2008 10:30:31 +0000 (10:30 +0000)]
Emit parameter and local variable debug information with -g.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51765 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd FIXME to CodeGen struct layout.
Eli Friedman [Fri, 30 May 2008 10:29:32 +0000 (10:29 +0000)]
Add FIXME to CodeGen struct layout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51764 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome additions to constant initializer generation code. Adds
Eli Friedman [Fri, 30 May 2008 10:24:46 +0000 (10:24 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51763 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCleanup/refactoring of Sema struct layout. This patch unifies the struct
Eli Friedman [Fri, 30 May 2008 09:31:38 +0000 (09:31 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51762 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd basic support for properties references (a missing feature).
Steve Naroff [Fri, 30 May 2008 00:40:33 +0000 (00:40 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51719 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix one strict-aliasing warning.
Ted Kremenek [Thu, 29 May 2008 21:52:26 +0000 (21:52 +0000)]
Fix one strict-aliasing warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51707 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago- Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
Steve Naroff [Thu, 29 May 2008 21:12:08 +0000 (21:12 +0000)]
- Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
- #include ExprObjC.h in many places

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51703 91177308-0d34-0410-b5e6-96231b3b80d8