]> granicus.if.org Git - clang/log
clang
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

16 years agoUpdate to follow recent LLVM changes
Anton Korobeynikov [Thu, 29 May 2008 17:42:01 +0000 (17:42 +0000)]
Update to follow recent LLVM changes

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

16 years agoImplement support for -w, which silences all warnings. PR2384.
Chris Lattner [Thu, 29 May 2008 15:36:45 +0000 (15:36 +0000)]
Implement support for -w, which silences all warnings. PR2384.

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

16 years agoMore complete/correct implementation of the comparison operators for
Eli Friedman [Thu, 29 May 2008 15:17:49 +0000 (15:17 +0000)]
More complete/correct implementation of the comparison operators for
constant expressions.

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

16 years agoFix an extremely subtle bug with pointer comparisons: they have to be
Eli Friedman [Thu, 29 May 2008 15:09:15 +0000 (15:09 +0000)]
Fix an extremely subtle bug with pointer comparisons: they have to be
unsigned because it's possible (at least in theory) to have
have both positive and negative pointers pointing to the same object.

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

16 years agoRearrange EmitLValueForField a bit to work properly for _Bool bitfields
Eli Friedman [Thu, 29 May 2008 11:33:25 +0000 (11:33 +0000)]
Rearrange EmitLValueForField a bit to work properly for _Bool bitfields
in unions (we don't want to do the union-specific bitcast for
bit-fields).

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

16 years agoAdd codegen support for a few more kinds of initializer constant
Eli Friedman [Thu, 29 May 2008 11:22:45 +0000 (11:22 +0000)]
Add codegen support for a few more kinds of initializer constant
expressions.

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

16 years agoAdd CodeGen support for alignment on globals, both for unusual natural
Eli Friedman [Thu, 29 May 2008 11:10:27 +0000 (11:10 +0000)]
Add CodeGen support for alignment on globals, both for unusual natural
alignment and alignment attributes.

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

16 years agoA couple minor fixes to make debug info usable for arbitrary code: don't
Eli Friedman [Thu, 29 May 2008 11:08:17 +0000 (11:08 +0000)]
A couple minor fixes to make debug info usable for arbitrary code: don't
emit incomplete types, because they crash llc, and always use the
logical location as the current location so we don't crash doing invalid
queries on CurLoc.

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

16 years agoTentative declarations are supposed to have common linkage, not weak.
Eli Friedman [Thu, 29 May 2008 11:03:17 +0000 (11:03 +0000)]
Tentative declarations are supposed to have common linkage, not weak.
This change makes clang generate the same thing as llvm-gcc.

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

16 years agoAlways use packed structs. This isn't really very nice, but there's
Eli Friedman [Thu, 29 May 2008 10:58:49 +0000 (10:58 +0000)]
Always use packed structs.  This isn't really very nice, but there's
nothing fundamentally wrong with it. Emitting unpacked structs where
possible is more work for almost no practical benefit.  We'll probably
want to fix it at some point anyway, but it's low priority.

The issue with long double in particular is that LLVM thinks an X86 long
double is 10 bytes, while clang considers it for all purposes to be
either 12 or 16 bytes, depending on the platform, even in a packed
struct.

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

16 years agoImplementation of stdarg.h.
Eli Friedman [Thu, 29 May 2008 10:40:55 +0000 (10:40 +0000)]
Implementation of stdarg.h.

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

16 years agoFix rewrite rope to keep the leaf list up-to-date as it erases leaves
Chris Lattner [Wed, 28 May 2008 18:45:56 +0000 (18:45 +0000)]
Fix rewrite rope to keep the leaf list up-to-date as it erases leaves
from the rope.  rdar://5952468

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

16 years agogive location info to another paren expr.
Chris Lattner [Wed, 28 May 2008 16:38:23 +0000 (16:38 +0000)]
give location info to another paren expr.

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

16 years agoadd an assertion
Chris Lattner [Wed, 28 May 2008 16:35:02 +0000 (16:35 +0000)]
add an assertion

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

16 years agoFix a couple crashes on invalid input.
Chris Lattner [Tue, 27 May 2008 23:32:43 +0000 (23:32 +0000)]
Fix a couple crashes on invalid input.

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

16 years agoWhen the build command is xcodebuild, set the magical environment variable LDPLUSPLUS...
Ted Kremenek [Tue, 27 May 2008 23:18:07 +0000 (23:18 +0000)]
When the build command is xcodebuild, set the magical environment variable LDPLUSPLUS to g++ to ensure that C++ object files are linked with g++ instead of gcc.

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

16 years agoCorrectly check to see if we are analyzing C++ files (skip).
Ted Kremenek [Tue, 27 May 2008 23:17:16 +0000 (23:17 +0000)]
Correctly check to see if we are analyzing C++ files (skip).

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

16 years agoCheck first member alignment and uses packed struct if required.
Devang Patel [Tue, 27 May 2008 22:45:40 +0000 (22:45 +0000)]
Check first member alignment and uses packed struct if required.

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

16 years agoFix test case
Devang Patel [Tue, 27 May 2008 22:44:22 +0000 (22:44 +0000)]
Fix test case

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

16 years agoAdd the copysign builtins; I ran into a program that wanted
Eli Friedman [Tue, 27 May 2008 15:59:57 +0000 (15:59 +0000)]
Add the copysign builtins; I ran into a program that wanted
__builtin_copysign.

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

16 years agoA few more cases for aggregate values.
Eli Friedman [Tue, 27 May 2008 15:51:49 +0000 (15:51 +0000)]
A few more cases for aggregate values.

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

16 years agoImplementation of __builtin_ctlz.
Eli Friedman [Tue, 27 May 2008 15:32:46 +0000 (15:32 +0000)]
Implementation of __builtin_ctlz.

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

16 years agoAssume statement expressions have side effects; this gets rid of a lot
Eli Friedman [Tue, 27 May 2008 15:24:04 +0000 (15:24 +0000)]
Assume statement expressions have side effects; this gets rid of a lot
of extra warnings in the Python source.

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

16 years agoThe cache is working again; re-enable it.
Eli Friedman [Tue, 27 May 2008 08:43:22 +0000 (08:43 +0000)]
The cache is working again; re-enable it.

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

16 years agoGet the type right for wide string literals; it's wchar_t, not char.
Eli Friedman [Tue, 27 May 2008 07:57:14 +0000 (07:57 +0000)]
Get the type right for wide string literals; it's wchar_t, not char.

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

16 years agoAdd FIXME.
Eli Friedman [Tue, 27 May 2008 05:09:49 +0000 (05:09 +0000)]
Add FIXME.

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

16 years agoDon't swap function decls, and add them to the scope as they are
Eli Friedman [Tue, 27 May 2008 05:07:37 +0000 (05:07 +0000)]
Don't swap function decls, and add them to the scope as they are
encountered.  Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.

Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.

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

16 years agoAdd a more reliable check for whether a static declaration has already
Eli Friedman [Tue, 27 May 2008 04:58:01 +0000 (04:58 +0000)]
Add a more reliable check for whether a static declaration has already
been used.  In preparation for the fix to PR2360, but also a minor bug
in its own right.

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

16 years agoStop leaking the main Sema object. (Leak found using valgrind.)
Eli Friedman [Tue, 27 May 2008 04:23:47 +0000 (04:23 +0000)]
Stop leaking the main Sema object. (Leak found using valgrind.)

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

16 years agoStop leaking the target data. (Leak found with valgrind.)
Eli Friedman [Tue, 27 May 2008 04:22:24 +0000 (04:22 +0000)]
Stop leaking the target data.  (Leak found with valgrind.)

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

16 years agoGeneralize the float type generation code, and specifically fix the
Eli Friedman [Tue, 27 May 2008 04:20:05 +0000 (04:20 +0000)]
Generalize the float type generation code, and specifically fix the
codegen of X86 long double.

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

16 years agoImplementation of gcc mode attribute; this is significant because
Eli Friedman [Tue, 27 May 2008 03:33:27 +0000 (03:33 +0000)]
Implementation of gcc mode attribute; this is significant because
it fixes PR2204.  Not too much to say about the implementation; it works
in a similar way to the vector size attribute.

At some point, we need to modify the targets to provide information
about the appropriate types.

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

16 years agoRewrite struct/union layout. This is mostly cleanup; this might also fix
Eli Friedman [Tue, 27 May 2008 03:14:44 +0000 (03:14 +0000)]
Rewrite struct/union layout. This is mostly cleanup; this might also fix
a few bugs, but I don't know of any in particular. This has good effects
besides cleanup, though: it also should make it easier to implement the
aligned and packed attributes, and also target-specific struct layouts,
because the code won't have to be duplicated in codegen.

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

16 years agoStop leaking the TUDecl.
Eli Friedman [Tue, 27 May 2008 03:08:09 +0000 (03:08 +0000)]
Stop leaking the TUDecl.

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

16 years agoChange diagnostic per suggestion, to make it a bit clearer what is
Eli Friedman [Tue, 27 May 2008 02:01:50 +0000 (02:01 +0000)]
Change diagnostic per suggestion, to make it a bit clearer what is
happening.

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

16 years agoEmit memmove, not memcpy, for structure copies; this is unfortunately
Eli Friedman [Mon, 26 May 2008 12:59:39 +0000 (12:59 +0000)]
Emit memmove, not memcpy, for structure copies; this is unfortunately
required for correctness in cases of copying a struct to itself or to
an overlapping struct (itself for cases like *a = *a, and overlapping
is possible with unions).

Hopefully, this won't end up being a perf issue; LLVM *should* be able
to optimize memmove to memcpy in a lot of cases, and for small copies
the generated code *should* be mostly comparable. (In reality, LLVM
is currently horrible at optimizing memmove, but that's a bug, not a
fundamental issue.)

gcc currently generates wrong code; that's
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667.

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

16 years agoFix for PR2001. I'm not really fond of it, but it is correct (unless
Eli Friedman [Sun, 25 May 2008 14:13:57 +0000 (14:13 +0000)]
Fix for PR2001. I'm not really fond of it, but it is correct (unless
someone tries to make a bitfield volatile?).

Not sure how to write a test; any suggestions?

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

16 years agoCount the number of initializable members correctly in structs/unions
Eli Friedman [Sun, 25 May 2008 14:03:31 +0000 (14:03 +0000)]
Count the number of initializable members correctly in structs/unions
with unnamed members.

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

16 years agoDiagnose implicit init list for empty aggregate, like struct {}. Fixes
Eli Friedman [Sun, 25 May 2008 13:49:22 +0000 (13:49 +0000)]
Diagnose implicit init list for empty aggregate, like struct {}.  Fixes
PR2151 (by not creating the empty implicit init list).

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

16 years agoMove the error checking for variable-sized objects so we don't
Eli Friedman [Sun, 25 May 2008 13:22:35 +0000 (13:22 +0000)]
Move the error checking for variable-sized objects so we don't
double-report errors; fixes PR2362.

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

16 years agoMake sure to define __sparc__ on Solaris; this should "fix"
Eli Friedman [Sun, 25 May 2008 05:26:09 +0000 (05:26 +0000)]
Make sure to define __sparc__ on Solaris; this should "fix"
test/Codegen/mandel.c on Solaris. :-)

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

16 years agoGenerate subprogram debug info with -g.
Sanjiv Gupta [Sun, 25 May 2008 05:15:42 +0000 (05:15 +0000)]
Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.

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