]> granicus.if.org Git - clang/log
clang
14 years agoextern variable declared locally to objective-c++ method
Fariborz Jahanian [Wed, 30 Jun 2010 18:27:47 +0000 (18:27 +0000)]
extern variable declared locally to objective-c++ method
should not be mangled either. Fixes radar 8016412.

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

14 years agoMake both old and new versions of reference binding use the new classification functi...
Sebastian Redl [Wed, 30 Jun 2010 18:13:39 +0000 (18:13 +0000)]
Make both old and new versions of reference binding use the new classification functions, and updated them for N3092.

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

14 years agoClean up the diagnostic complaining about the element type of a vector
Douglas Gregor [Wed, 30 Jun 2010 17:30:41 +0000 (17:30 +0000)]
Clean up the diagnostic complaining about the element type of a vector
type so that it actually complains about the element type itself.

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

14 years agoComplain about the application of a transparent_union attribute to a
Douglas Gregor [Wed, 30 Jun 2010 17:24:13 +0000 (17:24 +0000)]
Complain about the application of a transparent_union attribute to a
union whose first field has integral vector type. Also, clean up this
diagnostic a bit. Thanks to Eli for spotting this change in semantics
last week.

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

14 years agoreduce nesting.
Chris Lattner [Wed, 30 Jun 2010 16:58:07 +0000 (16:58 +0000)]
reduce nesting.

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

14 years agoAdd header file needed to compile with g++-4.6, which has undergone some more
Duncan Sands [Wed, 30 Jun 2010 16:54:05 +0000 (16:54 +0000)]
Add header file needed to compile with g++-4.6, which has undergone some more
header trimming (needed for std::uninitialized_copy).

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

14 years agoFix a comment typo.
Sebastian Redl [Wed, 30 Jun 2010 16:41:54 +0000 (16:41 +0000)]
Fix a comment typo.

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

14 years agoNasty rewriter bug which turns out to have an easy fix in
Fariborz Jahanian [Wed, 30 Jun 2010 16:31:08 +0000 (16:31 +0000)]
Nasty rewriter bug which turns out to have an easy fix in
rewriting a c-style cast expression in statement printer.
Fixes radar 8143056.

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

14 years agoFix rdar://8139785 "implement warning on dead expression in comma operator"
Argyrios Kyrtzidis [Wed, 30 Jun 2010 10:53:14 +0000 (10:53 +0000)]
Fix rdar://8139785 "implement warning on dead expression in comma operator"

As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g:

x || test_logical_foo1();

emitted a bogus "expression result unused" for 'x'.

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

14 years agoFix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.
Argyrios Kyrtzidis [Wed, 30 Jun 2010 08:49:30 +0000 (08:49 +0000)]
Fix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.

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

14 years agoSupport DependentSizedArrayType for PCH.
Argyrios Kyrtzidis [Wed, 30 Jun 2010 08:49:25 +0000 (08:49 +0000)]
Support DependentSizedArrayType for PCH.

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

14 years agoSupport ParenListExpr for PCH.
Argyrios Kyrtzidis [Wed, 30 Jun 2010 08:49:18 +0000 (08:49 +0000)]
Support ParenListExpr for PCH.

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

14 years agoMake the constructor explicit.
Argyrios Kyrtzidis [Wed, 30 Jun 2010 08:49:12 +0000 (08:49 +0000)]
Make the constructor explicit.

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

14 years agoMangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
Charles Davis [Wed, 30 Jun 2010 08:09:57 +0000 (08:09 +0000)]
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).

Also, stub out the remaining mangleType() routines.

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

14 years agoCorrectly implement the CheckerVisit optimization introduced in r106884, but this...
Ted Kremenek [Wed, 30 Jun 2010 07:28:52 +0000 (07:28 +0000)]
Correctly implement the CheckerVisit optimization introduced in r106884, but this time actually used the cached checker list when calling back to Checker visit methods.  This reduces the analysis time for sqlite3.c by 8%.

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

14 years agoHeaders: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
Daniel Dunbar [Wed, 30 Jun 2010 06:30:56 +0000 (06:30 +0000)]
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.

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

14 years agoHeaders: Change [u]intmax_t to be defined in terms of __[U]INTMAX_TYPE__, instead...
Daniel Dunbar [Wed, 30 Jun 2010 06:30:50 +0000 (06:30 +0000)]
Headers: Change [u]intmax_t to be defined in terms of __[U]INTMAX_TYPE__, instead of intN_t.

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

14 years agoReapply r107235, this time with both my typo fixed, and a logical bug fixed.
Chandler Carruth [Wed, 30 Jun 2010 02:59:29 +0000 (02:59 +0000)]
Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.

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

14 years agoRevert r107235, it had a silly typo in it, and fixing the typo breaks something
Chandler Carruth [Wed, 30 Jun 2010 02:06:16 +0000 (02:06 +0000)]
Revert r107235, it had a silly typo in it, and fixing the typo breaks something
else. Get the build bots happy while I debug. Very sorry for the delay fixing
this...

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

14 years agoPointers casted as integers still count as locations to SimpleSValuator, so don't...
Jordy Rose [Wed, 30 Jun 2010 01:35:20 +0000 (01:35 +0000)]
Pointers casted as integers still count as locations to SimpleSValuator, so don't crash if we do a funny thing like ((int)ptr)&1. Fixes PR7527.

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

14 years agoFix PR7402: We were creating implicit member initializers for every field in an
Chandler Carruth [Wed, 30 Jun 2010 00:54:29 +0000 (00:54 +0000)]
Fix PR7402: We were creating implicit member initializers for every field in an
anonymous union under the presumption that they didn't do anything. While this
is true, our checks for redundant initialization of an anonymous union still
fire when these overlap with explicit user initialization. A cleaner approach
is to avoid initializing multiple members of a union altogether, but this still
is in a rather fuzzy are especially when C++0x allows non-POD types into
unions.

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

14 years agoRevert r107173, "fix PR7519: after thrashing around and remembering how all this...
Daniel Dunbar [Wed, 30 Jun 2010 00:22:35 +0000 (00:22 +0000)]
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.

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

14 years agoRevert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType...
Daniel Dunbar [Wed, 30 Jun 2010 00:22:30 +0000 (00:22 +0000)]
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.

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

14 years agoImplement C++ DR299, which allows an implicit conversion from a class
Douglas Gregor [Wed, 30 Jun 2010 00:20:43 +0000 (00:20 +0000)]
Implement C++ DR299, which allows an implicit conversion from a class
type to an integral or enumeration type in the size of an array new
expression, e.g.,

  new int[ConvertibleToInt(10)];

This is a GNU and C++0x extension.

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

14 years agoRetain the source location of the constructor when building an implicit member
Chandler Carruth [Tue, 29 Jun 2010 23:50:44 +0000 (23:50 +0000)]
Retain the source location of the constructor when building an implicit member
initialization. I tried several ideas but couldn't come up with a test case for
this that didn't rely on a Clang bug to report a diagnostic after template
instantiation of the constructor due to the implicit initializers. Suggestions
welcome. This fixes the source location aspect of PR7402.

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

14 years agoRe-improve recovery when the condition of a switch statement does not
Douglas Gregor [Tue, 29 Jun 2010 23:25:20 +0000 (23:25 +0000)]
Re-improve recovery when the condition of a switch statement does not
have integral or enumeration type, so that we still check the contents
of the switch body. My previous patch made this worse; now we're back
to where we were previously.

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

14 years agoFactor the conversion from a switch condition to an integral or
Douglas Gregor [Tue, 29 Jun 2010 23:17:37 +0000 (23:17 +0000)]
Factor the conversion from a switch condition to an integral or
enumeration type out into a separate, reusable routine. The only
functionality change here is that we recover a little more
aggressively from ill-formed switch conditions.

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

14 years agoSupport C++ friend declarations for PCH.
Argyrios Kyrtzidis [Tue, 29 Jun 2010 22:47:00 +0000 (22:47 +0000)]
Support C++ friend declarations for PCH.

This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:

-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.

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

14 years agoWhen we know that we are at sub-statement reading (which is all of PCHStmtReader...
Argyrios Kyrtzidis [Tue, 29 Jun 2010 22:46:25 +0000 (22:46 +0000)]
When we know that we are at sub-statement reading (which is all of PCHStmtReader) use the "faster" ReadSubStmt. No functionality change.

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

14 years agoIRgen: Assignment to Objective-C properties shouldn't reload the value, for
Daniel Dunbar [Tue, 29 Jun 2010 22:44:21 +0000 (22:44 +0000)]
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
 - Also, tidy up assignment code a bit to look more like the scalar path.

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

14 years agofix PR7523, which was caused by the ABI code calling ConvertType instead
Chris Lattner [Tue, 29 Jun 2010 22:39:04 +0000 (22:39 +0000)]
fix PR7523, which was caused by the ABI code calling ConvertType instead
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.

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

14 years agoIRgen: Assignment to Objective-C properties shouldn't reload the value (which
Daniel Dunbar [Tue, 29 Jun 2010 22:00:45 +0000 (22:00 +0000)]
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
would trigger an extra method call).
 - While in the area, I also changed Clang to not emit an unnecessary load from
   'x' in cases like 'y = (x = 1)'.

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

14 years agoTweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
Ted Kremenek [Tue, 29 Jun 2010 21:58:54 +0000 (21:58 +0000)]
Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
be true if some paths were aborted because they exceeded
the maximum loop unrolling count.

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

14 years agoAdd test case for <rdar://problem/4289832>. Clang actuallys gets
Ted Kremenek [Tue, 29 Jun 2010 20:25:42 +0000 (20:25 +0000)]
Add test case for <rdar://problem/4289832>.  Clang actuallys gets
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.

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

14 years agoWhen typo correction produces a result that is not of the kind we're
Douglas Gregor [Tue, 29 Jun 2010 19:27:42 +0000 (19:27 +0000)]
When typo correction produces a result that is not of the kind we're
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.

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

14 years agochange ABIArgInfo to hold its llvm type with PATypeHolder so that
Chris Lattner [Tue, 29 Jun 2010 19:21:36 +0000 (19:21 +0000)]
change ABIArgInfo to hold its llvm type with PATypeHolder so that
it doesn't dangle as types get refined.  This fixes Shootout-C++/lists1
and probably also PR7522.

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

14 years agoFix broken testcase
Douglas Gregor [Tue, 29 Jun 2010 19:17:14 +0000 (19:17 +0000)]
Fix broken testcase

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

14 years agoTypo correction for namespace alias definitions
Douglas Gregor [Tue, 29 Jun 2010 18:55:19 +0000 (18:55 +0000)]
Typo correction for namespace alias definitions

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

14 years agotests: Fix test to not depend on instruction names.
Daniel Dunbar [Tue, 29 Jun 2010 18:34:40 +0000 (18:34 +0000)]
tests: Fix test to not depend on instruction names.

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

14 years agoSema: Fix a subtle i64 -> i32 truncation which broke layout of large structures
Daniel Dunbar [Tue, 29 Jun 2010 18:34:35 +0000 (18:34 +0000)]
Sema: Fix a subtle i64 -> i32 truncation which broke layout of large structures
with bit-fields.

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

14 years agorelax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
Chris Lattner [Tue, 29 Jun 2010 18:13:52 +0000 (18:13 +0000)]
relax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
of CanQualTypes to be passed in.

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

14 years agoThis patch fixes a bug whereby, clang skipped
Fariborz Jahanian [Tue, 29 Jun 2010 18:12:32 +0000 (18:12 +0000)]
This patch fixes a bug whereby, clang skipped
unimplemented property warning for properties
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.

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

14 years agofix PR7519: after thrashing around and remembering how all this stuff
Chris Lattner [Tue, 29 Jun 2010 17:56:33 +0000 (17:56 +0000)]
fix PR7519: after thrashing around and remembering how all this stuff
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.

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

14 years agoAllow a using directive to refer to the implicitly-defined namespace
Douglas Gregor [Tue, 29 Jun 2010 17:53:46 +0000 (17:53 +0000)]
Allow a using directive to refer to the implicitly-defined namespace
"std", with a warning, to improve GCC compatibility. Fixes PR7517.

As a drive-by, add typo correction for using directives.

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

14 years agoWith packed enums, an enumerator's value may be stored in more bits
Douglas Gregor [Tue, 29 Jun 2010 17:12:35 +0000 (17:12 +0000)]
With packed enums, an enumerator's value may be stored in more bits
than the enumeration type itself takes. Fixes PR7477.

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

14 years agotests: Use %clangxx when using driver for C++, in case C++ support is disabled.
Daniel Dunbar [Tue, 29 Jun 2010 16:52:24 +0000 (16:52 +0000)]
tests: Use %clangxx when using driver for C++, in case C++ support is disabled.

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

14 years agotests: Spell %clang_cc1 correctly.
Daniel Dunbar [Tue, 29 Jun 2010 16:52:18 +0000 (16:52 +0000)]
tests: Spell %clang_cc1 correctly.

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

14 years agominor cleanups.
Chris Lattner [Tue, 29 Jun 2010 16:40:28 +0000 (16:40 +0000)]
minor cleanups.

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

14 years agoDriver/Darwin: Only run dsymutil when we are also compiling/assembling as part
Daniel Dunbar [Tue, 29 Jun 2010 16:38:33 +0000 (16:38 +0000)]
Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
of the compilation.
 - <rdar://problem/8141387> clang is always invoking dsymutil

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

14 years agoDelete assert in ComputeKeyFunction. The function runs fine without it, since
Jeffrey Yasskin [Tue, 29 Jun 2010 15:27:35 +0000 (15:27 +0000)]
Delete assert in ComputeKeyFunction.  The function runs fine without it, since
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation.  This allows people to call
ASTContext::getKeyFunction on arbitrary classes.

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

14 years agoChange X86_64ABIInfo to have ASTContext and TargetData ivars to
Chris Lattner [Tue, 29 Jun 2010 06:01:59 +0000 (06:01 +0000)]
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
avoid passing ASTContext down through all the methods it has.

When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type.  If so, use that pointer type instead of i64.  This
allows us to compile A function taking a stringref into something
like this:

define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=4]
  %0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  store i64 %D.coerce0, i64* %0
  %1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
  store i8* %D.coerce1, i8** %1
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
  %tmp3 = load i8** %tmp2                         ; <i8*> [#uses=1]
  %add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
  ret i8* %add.ptr
}

instead of this:

define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=3]
  %0 = insertvalue %0 undef, i64 %D.coerce0, 0    ; <%0> [#uses=1]
  %1 = insertvalue %0 %0, i64 %D.coerce1, 1       ; <%0> [#uses=1]
  %2 = bitcast %struct.DeclGroup* %D to %0*       ; <%0*> [#uses=1]
  store %0 %1, %0* %2, align 1
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
  %tmp3 = load i8** %tmp2                         ; <i8*> [#uses=1]
  %add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
  ret i8* %add.ptr
}

This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef

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

14 years agoMinix doesn't support dylibs, PR7294
Chris Lattner [Tue, 29 Jun 2010 05:05:09 +0000 (05:05 +0000)]
Minix doesn't support dylibs, PR7294

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

14 years agoplumb preferred types down into X86_64ABIInfo::classifyArgumentType,
Chris Lattner [Tue, 29 Jun 2010 01:14:09 +0000 (01:14 +0000)]
plumb preferred types down into X86_64ABIInfo::classifyArgumentType,
no functionality change.

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

14 years agoPass the LLVM IR version of argument types down into computeInfo.
Chris Lattner [Tue, 29 Jun 2010 01:08:48 +0000 (01:08 +0000)]
Pass the LLVM IR version of argument types down into computeInfo.
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.

Nothing is using this yet, so no functionality change.

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

14 years agoPrefer llvm_unreachable(...) to assert(false && ...). This is important as
Chandler Carruth [Tue, 29 Jun 2010 00:23:11 +0000 (00:23 +0000)]
Prefer llvm_unreachable(...) to assert(false && ...). This is important as
without it we might exit a non-void function without returning.

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

14 years agoadd IR names to coerced arguments.
Chris Lattner [Tue, 29 Jun 2010 00:14:52 +0000 (00:14 +0000)]
add IR names to coerced arguments.

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

14 years agomake the argument passing stuff in the FCA case smarter still, by
Chris Lattner [Tue, 29 Jun 2010 00:06:42 +0000 (00:06 +0000)]
make the argument passing stuff in the FCA case smarter still, by
avoiding making the FCA at all when the types exactly line up.  For
example, before we made:

%struct.DeclGroup = type { i64, i64 }

define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=3]
  %2 = insertvalue %struct.DeclGroup undef, i64 %0, 0 ; <%struct.DeclGroup> [#uses=1]
  %3 = insertvalue %struct.DeclGroup %2, i64 %1, 1 ; <%struct.DeclGroup> [#uses=1]
  store %struct.DeclGroup %3, %struct.DeclGroup* %D
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
  %tmp3 = load i64* %tmp2                         ; <i64> [#uses=1]
  %add = add nsw i64 %tmp1, %tmp3                 ; <i64> [#uses=1]
  ret i64 %add
}

... which has the pointless insertvalue, which fastisel hates, now we
make:

%struct.DeclGroup = type { i64, i64 }

define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=4]
  %2 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  store i64 %0, i64* %2
  %3 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
  store i64 %1, i64* %3
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
  %tmp3 = load i64* %tmp2                         ; <i64> [#uses=1]
  %add = add nsw i64 %tmp1, %tmp3                 ; <i64> [#uses=1]
  ret i64 %add
}

This only kicks in when x86-64 abi lowering decides it likes us.

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

14 years agoA few prettifications. Also renamed TraverseInitializer to
Craig Silverstein [Tue, 29 Jun 2010 00:02:17 +0000 (00:02 +0000)]
A few prettifications.  Also renamed TraverseInitializer to
TraverseConstructorInitializer, to be a bit clearer.

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

14 years agoPer Doug's suggestion, move check for invalid SourceLocation into
Ted Kremenek [Mon, 28 Jun 2010 23:54:17 +0000 (23:54 +0000)]
Per Doug's suggestion, move check for invalid SourceLocation into
cxloc::translateSourceLocation() (thus causing all clients of this
function to have the same behavior).

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

14 years agoChange CGCall to handle the "coerce" case where the coerce-to type
Chris Lattner [Mon, 28 Jun 2010 23:44:11 +0000 (23:44 +0000)]
Change CGCall to handle the "coerce" case where the coerce-to type
is a FCA to pass each of the elements as individual scalars.  This
produces code fast isel is less likely to reject and is easier on
the optimizers.

For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
  return D.NumDecls+D.Y;
}

to:
%struct.DeclGroup = type { i64, i64 }

define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=3]
  store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
  %tmp3 = load i64* %tmp2                         ; <i64> [#uses=1]
  %add = add nsw i64 %tmp1, %tmp3                 ; <i64> [#uses=1]
  ret i64 %add
}

Now we get:

%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }

define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
  %D = alloca %struct.DeclGroup, align 8          ; <%struct.DeclGroup*> [#uses=3]
  %2 = insertvalue %0 undef, i64 %0, 0            ; <%0> [#uses=1]
  %3 = insertvalue %0 %2, i64 %1, 1               ; <%0> [#uses=1]
  %4 = bitcast %struct.DeclGroup* %D to %0*       ; <%0*> [#uses=1]
  store %0 %3, %0* %4, align 1
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
  %tmp1 = load i64* %tmp                          ; <i64> [#uses=1]
  %tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
  %tmp3 = load i8** %tmp2                         ; <i8*> [#uses=1]
  %add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
  ret i8* %add.ptr
}

Elimination of the FCA inside the function is still-to-come.

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

14 years agoFix up ClassTemplateSpecializationDecl: For implicit instantiations
Craig Silverstein [Mon, 28 Jun 2010 23:42:10 +0000 (23:42 +0000)]
Fix up ClassTemplateSpecializationDecl: For implicit instantiations
("set<int> x;"), we don't want to recurse at all, since the
instatiated class isn't written in the source code anywhere.  (Note
the instatiated *type* -- set<int> -- is written, and will still get a
callback of TemplateSpecializationType).  For explicit instantiations
("template set<int>;"), we do need a callback, since this is the only
callback that's made for this instantiation.  We use
getTypeAsWritten() to distinguish.

We will still need to figure out how to handle template
specializations, which probably are still not quite correct.

Reviewed by chandlerc

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

14 years agomake the trivial forms of CreateCoerced{Load|Store} trivial.
Chris Lattner [Mon, 28 Jun 2010 22:51:39 +0000 (22:51 +0000)]
make the trivial forms of CreateCoerced{Load|Store} trivial.

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

14 years agoModify the way sub-statements are stored and retrieved from PCH.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 22:28:35 +0000 (22:28 +0000)]
Modify the way sub-statements are stored and retrieved from PCH.

Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.

x = sizeof(int[1]);

would crash PCH.

Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
 PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.

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

14 years agopass/return structs of char and short as i8/i16 to avoid
Chris Lattner [Mon, 28 Jun 2010 21:59:07 +0000 (21:59 +0000)]
pass/return structs of char and short as i8/i16 to avoid
aweful through-memory coersion, just like we do for i32 now.

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

14 years agomore tidying up.
Chris Lattner [Mon, 28 Jun 2010 21:43:59 +0000 (21:43 +0000)]
more tidying up.

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

14 years agoRemove state assertion.
Ted Kremenek [Mon, 28 Jun 2010 20:44:49 +0000 (20:44 +0000)]
Remove state assertion.

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

14 years agoDon't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes...
Ted Kremenek [Mon, 28 Jun 2010 20:32:40 +0000 (20:32 +0000)]
Don't crash in InitializePreprocessor() when there is no valid PTHManager.  Fixes <rdar://problem/8098441>.

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

14 years agorandom acts of tidying.
Chris Lattner [Mon, 28 Jun 2010 20:05:43 +0000 (20:05 +0000)]
random acts of tidying.

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

14 years agoX86-64:
Chris Lattner [Mon, 28 Jun 2010 19:56:59 +0000 (19:56 +0000)]
X86-64:
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner.  Passing in the low part
of a double is the same as passing in a float.

For example, we now compile:

struct DeclGroup { float NumDecls; };
float foo(DeclGroup D);
void bar(DeclGroup *D) {
 foo(*D);
}

into:

%struct.DeclGroup = type { float }

define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
  %D.addr = alloca %struct.DeclGroup*, align 8    ; <%struct.DeclGroup**> [#uses=2]
  %agg.tmp = alloca %struct.DeclGroup, align 4    ; <%struct.DeclGroup*> [#uses=2]
  store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
  %tmp = load %struct.DeclGroup** %D.addr         ; <%struct.DeclGroup*> [#uses=1]
  %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.DeclGroup* %tmp to i8*  ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
  %coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
  %0 = load float* %coerce.dive, align 1          ; <float> [#uses=1]
  %call = call float @_Z3foo9DeclGroup(float %0)  ; <float> [#uses=0]
  ret void
}

instead of:

%struct.DeclGroup = type { float }

define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
  %D.addr = alloca %struct.DeclGroup*, align 8    ; <%struct.DeclGroup**> [#uses=2]
  %agg.tmp = alloca %struct.DeclGroup, align 4    ; <%struct.DeclGroup*> [#uses=2]
  %tmp3 = alloca double                           ; <double*> [#uses=2]
  store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
  %tmp = load %struct.DeclGroup** %D.addr         ; <%struct.DeclGroup*> [#uses=1]
  %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.DeclGroup* %tmp to i8*  ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
  %coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
  %0 = bitcast double* %tmp3 to float*            ; <float*> [#uses=1]
  %1 = load float* %coerce.dive                   ; <float> [#uses=1]
  store float %1, float* %0, align 1
  %2 = load double* %tmp3                         ; <double> [#uses=1]
  %call = call float @_Z3foo9DeclGroup(double %2) ; <float> [#uses=0]
  ret void
}

which is this machine code (at -O0):

__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret

vs this:

__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
movss %xmm0, (%rsp)
movsd (%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret

At -O3, it is the difference between this now:

__Z3barP9DeclGroup:
movss (%rdi), %xmm0
jmp __Z3foo9DeclGroup  # TAILCALL

vs this before:

__Z3barP9DeclGroup:
movl (%rdi), %eax
movd %rax, %xmm0
jmp __Z3foo9DeclGroup  # TAILCALL

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

14 years agoMinor refactorin of my last patch (radar 7860965 related).
Fariborz Jahanian [Mon, 28 Jun 2010 19:42:10 +0000 (19:42 +0000)]
Minor refactorin of my last patch (radar 7860965 related).

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

14 years agoHave __func__ and siblings point to block's implementation function
Fariborz Jahanian [Mon, 28 Jun 2010 18:58:34 +0000 (18:58 +0000)]
Have __func__ and siblings point to block's implementation function
name. Fixes radar 7860965.

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

14 years agotweak test to pass on windows
Chris Lattner [Mon, 28 Jun 2010 18:29:14 +0000 (18:29 +0000)]
tweak test to pass on windows

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

14 years agotests: Rewrite test to check intent instead of implementation.
Daniel Dunbar [Mon, 28 Jun 2010 17:43:18 +0000 (17:43 +0000)]
tests: Rewrite test to check intent instead of implementation.

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

14 years agoSet the default arch based on the triple.
Rafael Espindola [Mon, 28 Jun 2010 17:18:09 +0000 (17:18 +0000)]
Set the default arch based on the triple.

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

14 years agoFix UnitTests/2004-02-02-NegativeZero.c, which regressed when
Chris Lattner [Mon, 28 Jun 2010 17:12:37 +0000 (17:12 +0000)]
Fix UnitTests/2004-02-02-NegativeZero.c, which regressed when
I broke negate of FP values.

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

14 years agofix a silly fixme.
Chris Lattner [Mon, 28 Jun 2010 17:11:58 +0000 (17:11 +0000)]
fix a silly fixme.

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

14 years agollvm::errs() is non-buffered, so it doesn't need to be flushed.
Dan Gohman [Mon, 28 Jun 2010 15:56:07 +0000 (15:56 +0000)]
llvm::errs() is non-buffered, so it doesn't need to be flushed.

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

14 years agoAdd support for traversing initializer lists (in constructors), which
Craig Silverstein [Mon, 28 Jun 2010 15:37:14 +0000 (15:37 +0000)]
Add support for traversing initializer lists (in constructors), which
we ignoring before.  To give access to the names on the initializer,
which aren't a type or an expr or a decl, I've introduced a new
TraverseInitializer.  By default, it just traverses on the expr that
the name is being initialized to.

Reviewed by chandlerc.  Tested via clang's 'make test'.

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

14 years agoIntroduce Expr::Classify and Expr::ClassifyModifiable, which determine the classifica...
Sebastian Redl [Mon, 28 Jun 2010 15:09:07 +0000 (15:09 +0000)]
Introduce Expr::Classify and Expr::ClassifyModifiable, which determine the classification of an expression under the C++0x taxology (value category). Reimplement isLvalue and isModifiableLvalue using these functions. No regressions in the test suite from this, and my rough performance check doesn't show any regressions either.

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

14 years agoSupport CXXPseudoDestructorExpr for PCH.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 09:32:03 +0000 (09:32 +0000)]
Support CXXPseudoDestructorExpr for PCH.

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

14 years agoSupport DependentScopeDeclRefExpr for PCH.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 09:31:56 +0000 (09:31 +0000)]
Support DependentScopeDeclRefExpr for PCH.

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

14 years agoRefactor PCH reading/writing of template arguments passed to expressions.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 09:31:48 +0000 (09:31 +0000)]
Refactor PCH reading/writing of template arguments passed to expressions.

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

14 years agoFix PCH emitting/reading for template arguments that contain expressions.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 09:31:42 +0000 (09:31 +0000)]
Fix PCH emitting/reading for template arguments that contain expressions.

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

14 years agoFix various bugs in recent commits for C++ PCH.
Argyrios Kyrtzidis [Mon, 28 Jun 2010 09:31:34 +0000 (09:31 +0000)]
Fix various bugs in recent commits for C++ PCH.

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

14 years agoPartial fix for PR7267 based on comments by John McCall on an earlier patch.
Chandler Carruth [Mon, 28 Jun 2010 08:39:25 +0000 (08:39 +0000)]
Partial fix for PR7267 based on comments by John McCall on an earlier patch.
This is more targeted, as it simply provides toggle actions for the parser to
turn access checking on and off. We then use these to suppress access checking
only while we parse the template-id (included scope specifier) of an explicit
instantiation and explicit specialization of a class template. The
specialization behavior is an extension, as it seems likely a defect that the
standard did not exempt them as it does explicit instantiations.

This allows the very common practice of specializing trait classes to work for
private, internal types. This doesn't address instantiating or specializing
function templates, although those apparently already partially work.

The naming and style for the Action layer isn't my favorite, comments and
suggestions would be appreciated there.

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

14 years agoPointer comparisons (and pointer-pointer subtraction). Basically filling in SimpleSVa...
Jordy Rose [Mon, 28 Jun 2010 08:26:15 +0000 (08:26 +0000)]
Pointer comparisons (and pointer-pointer subtraction). Basically filling in SimpleSValuator::EvalBinOpLL().

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

14 years agoSuppress diagnosing access violations while looking up deallocation functions
Chandler Carruth [Mon, 28 Jun 2010 00:30:51 +0000 (00:30 +0000)]
Suppress diagnosing access violations while looking up deallocation functions
much as we already do for allocation function lookup. Explicitly check access
for the function we actually select in one case that was previously missing,
but being caught behind the blanket diagnostics for all overload candidates.
This fixs PR7436.

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

14 years agoUse softfp for linux gnueabi, keep the warning for everything else.
Rafael Espindola [Sun, 27 Jun 2010 18:29:21 +0000 (18:29 +0000)]
Use softfp for linux gnueabi, keep the warning for everything else.

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

14 years agoCorrectly destroy reference temporaries with global storage. Remove ErrorUnsupported...
Anders Carlsson [Sun, 27 Jun 2010 17:52:15 +0000 (17:52 +0000)]
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.

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

14 years agoAdd a CreateReferenceTemporary that will do the right thing for variables with global...
Anders Carlsson [Sun, 27 Jun 2010 17:23:46 +0000 (17:23 +0000)]
Add a CreateReferenceTemporary that will do the right thing for variables with global storage.

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

14 years agoSimplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing...
Anders Carlsson [Sun, 27 Jun 2010 16:56:04 +0000 (16:56 +0000)]
Simplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing PR7326.

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

14 years agoReduce indentation.
Anders Carlsson [Sun, 27 Jun 2010 15:24:55 +0000 (15:24 +0000)]
Reduce indentation.

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

14 years agomisc tidying
Chris Lattner [Sun, 27 Jun 2010 07:40:06 +0000 (07:40 +0000)]
misc tidying

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

14 years agofinally get around to doing a significant cleanup to irgen:
Chris Lattner [Sun, 27 Jun 2010 07:15:29 +0000 (07:15 +0000)]
finally get around to doing a significant cleanup to irgen:
have CGF create and make accessible standard int32,int64 and
intptr types.  This fixes a ton of 80 column violations
introduced by LLVMContextification and cleans up stuff a lot.

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

14 years agotidy up OrderGlobalInits
Chris Lattner [Sun, 27 Jun 2010 06:32:58 +0000 (06:32 +0000)]
tidy up OrderGlobalInits

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

14 years agoIf coercing something from int or pointer type to int or pointer type
Chris Lattner [Sun, 27 Jun 2010 06:26:04 +0000 (06:26 +0000)]
If coercing something from int or pointer type to int or pointer type
(potentially after unwrapping it from a struct) do it without going through
memory.  We now compile:

struct DeclGroup {
  unsigned NumDecls;
};

int foo(DeclGroup D) {
  return D.NumDecls;
}

into:

%struct.DeclGroup = type { i32 }

define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %coerce.val.ii = trunc i64 %0 to i32            ; <i32> [#uses=1]
  store i32 %coerce.val.ii, i32* %coerce.dive
  %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp1 = load i32* %tmp                          ; <i32> [#uses=1]
  ret i32 %tmp1
}

instead of:

%struct.DeclGroup = type { i32 }

define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %tmp = alloca i64                               ; <i64*> [#uses=2]
  %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  store i64 %0, i64* %tmp
  %1 = bitcast i64* %tmp to i32*                  ; <i32*> [#uses=1]
  %2 = load i32* %1, align 1                      ; <i32> [#uses=1]
  store i32 %2, i32* %coerce.dive
  %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp2 = load i32* %tmp1                         ; <i32> [#uses=1]
  ret i32 %tmp2
}

... which is quite a bit less terrifying.

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

14 years agoSame patch as the previous on the store side. Before we compiled this:
Chris Lattner [Sun, 27 Jun 2010 06:04:18 +0000 (06:04 +0000)]
Same patch as the previous on the store side.  Before we compiled this:

struct DeclGroup {
  unsigned NumDecls;
};

int foo(DeclGroup D) {
  return D.NumDecls;
}

to:

%struct.DeclGroup = type { i32 }

define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %tmp = alloca i64                               ; <i64*> [#uses=2]
  store i64 %0, i64* %tmp
  %1 = bitcast i64* %tmp to %struct.DeclGroup*    ; <%struct.DeclGroup*> [#uses=1]
  %2 = load %struct.DeclGroup* %1, align 1        ; <%struct.DeclGroup> [#uses=1]
  store %struct.DeclGroup %2, %struct.DeclGroup* %D
  %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp2 = load i32* %tmp1                         ; <i32> [#uses=1]
  ret i32 %tmp2
}

which caused fast isel bailouts due to the FCA load/store of %2.  Now
we generate this just blissful code:

%struct.DeclGroup = type { i32 }

define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %tmp = alloca i64                               ; <i64*> [#uses=2]
  %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  store i64 %0, i64* %tmp
  %1 = bitcast i64* %tmp to i32*                  ; <i32*> [#uses=1]
  %2 = load i32* %1, align 1                      ; <i32> [#uses=1]
  store i32 %2, i32* %coerce.dive
  %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp2 = load i32* %tmp1                         ; <i32> [#uses=1]
  ret i32 %tmp2
}

This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.

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

14 years agoimprove CreateCoercedLoad a bit to generate slightly less awful
Chris Lattner [Sun, 27 Jun 2010 05:56:15 +0000 (05:56 +0000)]
improve CreateCoercedLoad a bit to generate slightly less awful
IR when handling X86-64 by-value struct stuff.  For example, we
use to compile this:

struct DeclGroup {
  unsigned NumDecls;
};

int foo(DeclGroup D);
void bar(DeclGroup *D) {
  foo(*D);
}

into:

define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) ssp nounwind {
entry:
  %D.addr = alloca %struct.DeclGroup*, align 8    ; <%struct.DeclGroup**> [#uses=2]
  %agg.tmp = alloca %struct.DeclGroup, align 4    ; <%struct.DeclGroup*> [#uses=2]
  %tmp3 = alloca i64                              ; <i64*> [#uses=2]
  store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
  %tmp = load %struct.DeclGroup** %D.addr         ; <%struct.DeclGroup*> [#uses=1]
  %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.DeclGroup* %tmp to i8*  ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
  %0 = bitcast i64* %tmp3 to %struct.DeclGroup*   ; <%struct.DeclGroup*> [#uses=1]
  %1 = load %struct.DeclGroup* %agg.tmp           ; <%struct.DeclGroup> [#uses=1]
  store %struct.DeclGroup %1, %struct.DeclGroup* %0, align 1
  %2 = load i64* %tmp3                            ; <i64> [#uses=1]
  call void @_Z3foo9DeclGroup(i64 %2)
  ret void
}

which would cause fastisel to bail out due to the first class aggregate load %1.  With
this patch we now compile it into the (still awful):

define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind ssp noredzone {
entry:
  %D.addr = alloca %struct.DeclGroup*, align 8    ; <%struct.DeclGroup**> [#uses=2]
  %agg.tmp = alloca %struct.DeclGroup, align 4    ; <%struct.DeclGroup*> [#uses=2]
  %tmp3 = alloca i64                              ; <i64*> [#uses=2]
  store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
  %tmp = load %struct.DeclGroup** %D.addr         ; <%struct.DeclGroup*> [#uses=1]
  %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.DeclGroup* %tmp to i8*  ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
  %coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <i32*> [#uses=1]
  %0 = bitcast i64* %tmp3 to i32*                 ; <i32*> [#uses=1]
  %1 = load i32* %coerce.dive                     ; <i32> [#uses=1]
  store i32 %1, i32* %0, align 1
  %2 = load i64* %tmp3                            ; <i64> [#uses=1]
  %call = call i32 @_Z3foo9DeclGroup(i64 %2) noredzone ; <i32> [#uses=0]
  ret void
}

which doesn't bail out.  On CGStmt.ll, this reduces fastisel bail outs from 958 to 935,
and is the precursor of better things to come.

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

14 years agoImplicitly compare symbolic expressions to zero when they're being used as constraint...
Jordy Rose [Sun, 27 Jun 2010 01:20:56 +0000 (01:20 +0000)]
Implicitly compare symbolic expressions to zero when they're being used as constraints. Part of PR7491.

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

14 years agomerge two tests.
Chris Lattner [Sun, 27 Jun 2010 01:08:03 +0000 (01:08 +0000)]
merge two tests.

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