]> granicus.if.org Git - clang/log
clang
13 years agoAdd more compiler workarounds. Should fix the build with old GCCs and MSVC.
Benjamin Kramer [Tue, 12 Jul 2011 18:37:23 +0000 (18:37 +0000)]
Add more compiler workarounds. Should fix the build with old GCCs and MSVC.

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

13 years agoIn ARC mode, consider Objective-C lifetime types (object pointers and
Douglas Gregor [Tue, 12 Jul 2011 17:28:52 +0000 (17:28 +0000)]
In ARC mode, consider Objective-C lifetime types (object pointers and
block pointers) that don't have any qualification to be POD types. We
were previously considering them to be non-POD types, because this was
convenient in C++ for is_pod-like traits. However, we now end up
inferring lifetime in such cases (template arguments infer __strong),
so it is not necessary.

Moreover, we want rvalues of object type (which have their lifetime
stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function
properly. Fixes <rdar://problem/9758798>.

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

13 years agoFix a bug where a local variable named 'self' is causing
Fariborz Jahanian [Tue, 12 Jul 2011 17:16:56 +0000 (17:16 +0000)]
Fix a bug where a local variable named 'self' is causing
implicit ivar accesses to go through the 'self' variable
rather than the real 'self' for the method. // rdar://9730771

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

13 years agoUgh, use this compiler workaround again.
John McCall [Tue, 12 Jul 2011 16:53:04 +0000 (16:53 +0000)]
Ugh, use this compiler workaround again.

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

13 years agoSwitch field destruction over to use the new destroyer-based API
John McCall [Tue, 12 Jul 2011 16:41:08 +0000 (16:41 +0000)]
Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

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

13 years agoImprove name mangling for instantiation-dependent types that are not
Douglas Gregor [Tue, 12 Jul 2011 15:18:55 +0000 (15:18 +0000)]
Improve name mangling for instantiation-dependent types that are not
dependent. This covers an odd class of types such as

  int (&)[sizeof(sizeof(T() + T()))];

which involve template parameters but, because of some trick typically
involving a form of expression that is never type-dependent, resolve
down to a non-dependent type. Such types need to be mangled
essentially as they were written in the source code (involving
template parameters), rather than via their canonical type.

In general, instantiation-dependent types should be mangled as
they were written in the source. However, since we can't do that now
without non-trivial refactoring of the AST (see the new FIXME), I've
gone for this partial solution: only use the as-written-in-the-source
mangling for these strange types that are instantiation-dependent but
not dependent. This provides better compatibility with previous
incarnations of Clang and with GCC. In the future, we'd like to get
this right.

Fixes <rdar://problem/9663282>.

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

13 years agoPop block scope after reading from it.
Benjamin Kramer [Tue, 12 Jul 2011 14:11:05 +0000 (14:11 +0000)]
Pop block scope after reading from it.

Found by valgrind.

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

13 years agoSecond attempt at de-constifying LLVM Types in FunctionType::get(),
Jay Foad [Tue, 12 Jul 2011 14:06:48 +0000 (14:06 +0000)]
Second attempt at de-constifying LLVM Types in FunctionType::get(),
StructType::get() and TargetData::getIntPtrType().

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

13 years agoWork around a problem with a static helper's formulation in release
Chandler Carruth [Tue, 12 Jul 2011 08:58:26 +0000 (08:58 +0000)]
Work around a problem with a static helper's formulation in release
builds introduced in r134972:

lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType'
lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument

This fixes the issue by passing CodeGenFunction on down, and using its
builder directly rather than passing just the builder down.

This may not be the best / cleanest fix, Chris please review. It at
least fixes builds.

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

13 years agoFix typo correction crash on overloaded functions, pr10283.
Hans Wennborg [Tue, 12 Jul 2011 08:45:31 +0000 (08:45 +0000)]
Fix typo correction crash on overloaded functions, pr10283.

It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.

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

13 years agoImplement name mangling for sizeof...(function parameter pack).
Douglas Gregor [Tue, 12 Jul 2011 07:03:48 +0000 (07:03 +0000)]
Implement name mangling for sizeof...(function parameter pack).

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

13 years agoFix the desugaring of dependent decltype and typeof(expr) nodes. The
Douglas Gregor [Tue, 12 Jul 2011 06:55:29 +0000 (06:55 +0000)]
Fix the desugaring of dependent decltype and typeof(expr) nodes. The
isSugared() and desugar() routines previously provided were never
actually called, since the corresponding types
(DependentTypeOfExprType, DependentDecltypeType) don't have
corresponding type classes. Outside of the current (incomplete) patch
I'm working on, I haven't found a way to trigger this problem.

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

13 years agoFix a problem Eli ran into where we now reject incomplete arrays of
Chris Lattner [Tue, 12 Jul 2011 06:52:18 +0000 (06:52 +0000)]
Fix a problem Eli ran into where we now reject incomplete arrays of
uncompleted struct types.  We now do what llvm-gcc does and compile
them into [i8 x 0].  If the type is later completed, we make sure that
it is appropriately cast.

We compile the terrible example to something like this now:

%struct.A = type { i32, i32, i32 }

@g = external global [0 x i8]

define void @_Z1fv() nounwind {
entry:
  call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*))
  ret void
}

declare void @_Z3fooP1A(%struct.A*)

define %struct.A* @_Z2f2v() nounwind {
entry:
  ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1)
}

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

13 years agoinsert a bitcast in the 'expand' case of argument passing when needed. This
Chris Lattner [Tue, 12 Jul 2011 06:29:11 +0000 (06:29 +0000)]
insert a bitcast in the 'expand' case of argument passing when needed.  This
fixes the -m32 build of oggenc.

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

13 years agofix an unintended behavior change in the type system rewrite, which caused us to...
Chris Lattner [Tue, 12 Jul 2011 05:53:08 +0000 (05:53 +0000)]
fix an unintended behavior change in the type system rewrite, which caused us to compile
stuff like this:

typedef struct {
 int x, y, z;
} foo_t;

foo_t g;

into:
%"struct.<anonymous>" = type { i32, i32, i32 }
we now get:
%struct.foo_t = type { i32, i32, i32 }

This doesn't change the behavior of the compiler, but makes the IR much easier to read.

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

13 years agoMangle dependent template names of unknown arity
Douglas Gregor [Tue, 12 Jul 2011 05:06:05 +0000 (05:06 +0000)]
Mangle dependent template names of unknown arity

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

13 years agofix PR10335 by watching out for IR type compatibility in call argument lists.
Chris Lattner [Tue, 12 Jul 2011 04:53:39 +0000 (04:53 +0000)]
fix PR10335 by watching out for IR type compatibility in call argument lists.

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

13 years agoMove OBJC_PR_NumBits out of PropertyAttributeKind enum, to its own NumPropertyAttrsBits.
Argyrios Kyrtzidis [Tue, 12 Jul 2011 04:52:08 +0000 (04:52 +0000)]
Move OBJC_PR_NumBits out of PropertyAttributeKind enum, to its own NumPropertyAttrsBits.
No functionality change.

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

13 years agomake test name less specific
Chris Lattner [Tue, 12 Jul 2011 04:51:05 +0000 (04:51 +0000)]
make test name less specific

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

13 years agoImplement the Itanium C++ ABI's mangling rule for
Douglas Gregor [Tue, 12 Jul 2011 04:47:20 +0000 (04:47 +0000)]
Implement the Itanium C++ ABI's mangling rule for
non-instantiation-dependent sizeof and alignof expressions.

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

13 years agoadd some aggressive assertions that call arguments match up to callee
Chris Lattner [Tue, 12 Jul 2011 04:46:18 +0000 (04:46 +0000)]
add some aggressive assertions that call arguments match up to callee
expectations in EmitCall.  Next patch will take this further.

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

13 years agoCentralize the getCanonicalType() calls in the Itanium C++ mangling
Douglas Gregor [Tue, 12 Jul 2011 04:42:08 +0000 (04:42 +0000)]
Centralize the getCanonicalType() calls in the Itanium C++ mangling
code so that they only occur in a single place. No functionality change.

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

13 years ago[ARC] Complain about property without storage attribute when @synthesizing it, not...
Argyrios Kyrtzidis [Tue, 12 Jul 2011 04:30:16 +0000 (04:30 +0000)]
[ARC] Complain about property without storage attribute when @synthesizing it, not at its declaration.

For this sample:

@interface Foo
@property id x;
@end

we get:

t.m:2:1: error: ARC forbids properties of Objective-C objects with unspecified storage attribute
@property  id x;
^
1 error generated.

The error should be imposed on the implementor of the interface, not the user. If the user uses
a header of a non-ARC library whose source code he does not have, we are basically asking him to
go change the header of the library (bad in general), possible overriding how the property is
implemented if he gets confused and says "Oh I'll just add 'copy' then" (even worse).

Second issue is that we don't emit any error for 'readonly' properties, e.g:

@interface Foo
@property (readonly) id x; // no error  here
@end

@implementation Foo
@synthesize x; // no error here too
@end

We should give an error when the implementor is @synthesizing a property which doesn't have
any storage specifier; this is when the explicit specifier is important, because we are
going to create an ivar and we want its ownership to be explicit.

Related improvements:
-OBJC_PR_unsafe_unretained turned out to not fit in ObjCPropertyDecl's bitfields, fix it.
-For properties of extension classes don't drop PropertyAttributesAsWritten values.
-Have PropertyAttributesAsWritten actually only reflect what the user wrote

rdar://9756610.

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

13 years agoFix a typo!
Bruno Cardoso Lopes [Tue, 12 Jul 2011 02:47:38 +0000 (02:47 +0000)]
Fix a typo!

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

13 years agoDo the same as r134946 for arrays. Add more testcases for avx x86_64 arg
Bruno Cardoso Lopes [Tue, 12 Jul 2011 01:27:38 +0000 (01:27 +0000)]
Do the same as r134946 for arrays. Add more testcases for avx x86_64 arg
passing.

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

13 years agoRevert r134888 (and related patches in other trees). It was causing
Bill Wendling [Tue, 12 Jul 2011 01:16:47 +0000 (01:16 +0000)]
Revert r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, line 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134888 into '.':
U    lib/CodeGen/CodeGenModule.cpp

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

13 years agoFix one x86_64 abi issue and the test to actually look for the right thing,
Bruno Cardoso Lopes [Tue, 12 Jul 2011 00:30:27 +0000 (00:30 +0000)]
Fix one x86_64 abi issue and the test to actually look for the right thing,
which is: { <4 x float>, <4 x float> } should continue to go through memory.

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

13 years agoDo full-expression cleanups in a much more sensible way that still lets
John McCall [Tue, 12 Jul 2011 00:15:30 +0000 (00:15 +0000)]
Do full-expression cleanups in a much more sensible way that still lets
people write useful cleanup classes.

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

13 years agoDisable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
Bruno Cardoso Lopes [Mon, 11 Jul 2011 23:33:46 +0000 (23:33 +0000)]
Disable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
specified, 128 avx code is used and we're not sure yet if this the behavior
we want (and if it does, some improvements are needed before relying on it).

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

13 years agoStyle tweak to the more idiomatic 'assert(!bad_state())'.
Chandler Carruth [Mon, 11 Jul 2011 23:33:05 +0000 (23:33 +0000)]
Style tweak to the more idiomatic 'assert(!bad_state())'.

Patch by Caitlin Sadowski.

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

13 years agoHoist the logic for checking the number of arguments to an attribute
Chandler Carruth [Mon, 11 Jul 2011 23:30:35 +0000 (23:30 +0000)]
Hoist the logic for checking the number of arguments to an attribute
into a static helper.

Original patch by Caitlin Sadowski, style tweaks by me.

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

13 years agoEnable "avx" feature, so it can be seen by llvm
Bruno Cardoso Lopes [Mon, 11 Jul 2011 22:50:13 +0000 (22:50 +0000)]
Enable "avx" feature, so it can be seen by llvm

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

13 years agoReapply r134754, which turns out to be working correctly and also
Bruno Cardoso Lopes [Mon, 11 Jul 2011 22:41:29 +0000 (22:41 +0000)]
Reapply r134754, which turns out to be working correctly and also
add one more testcase.

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

13 years agoAllow us to compute linkage et al for instantiation-dependent types.
Douglas Gregor [Mon, 11 Jul 2011 22:38:07 +0000 (22:38 +0000)]
Allow us to compute linkage et al for instantiation-dependent types.

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

13 years agoRevert r134898, "test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331...
NAKAMURA Takumi [Mon, 11 Jul 2011 22:34:14 +0000 (22:34 +0000)]
Revert r134898, "test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331. to appease mingw-target (and non-mingw-host) builds.

PR10331 is still alive I suppose.

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

13 years agoReenable test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:47 +0000 (21:58 +0000)]
Reenable test.

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

13 years agoAdd missing header file for the test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:44 +0000 (21:58 +0000)]
Add missing header file for the test.

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

13 years agoAdd diagnostic for constructs like "va_arg(l, float)" which have undefined behavior...
Eli Friedman [Mon, 11 Jul 2011 21:45:59 +0000 (21:45 +0000)]
Add diagnostic for constructs like "va_arg(l, float)" which have undefined behavior. PR10201.

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

13 years agoTest is broken; XFAIL it until Argyrios gets a chance to look at it.
Eli Friedman [Mon, 11 Jul 2011 21:44:14 +0000 (21:44 +0000)]
Test is broken; XFAIL it until Argyrios gets a chance to look at it.

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

13 years agoDon't warn for unused macro when undef'ing it, if it comes from an included file...
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:39:47 +0000 (20:39 +0000)]
Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065

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

13 years agoFix CMake.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:28:59 +0000 (20:28 +0000)]
Fix CMake.

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

13 years ago[arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix...
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:15:00 +0000 (20:15 +0000)]
[arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix to 'clang_'.

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

13 years agoEmit partial destruction of structs with initializer lists.
John McCall [Mon, 11 Jul 2011 19:35:02 +0000 (19:35 +0000)]
Emit partial destruction of structs with initializer lists.

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

13 years agoobjc-arc: Diagnose when captured variable in block literals
Fariborz Jahanian [Mon, 11 Jul 2011 18:04:54 +0000 (18:04 +0000)]
objc-arc: Diagnose when captured variable in block literals
require destruction and there is possibility of that without
construction. Thanks Johnm for review and suggestions offline.
// rdar://9535237.

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

13 years agoApply patch from Richard Trieu to fix PR9548:
Chandler Carruth [Mon, 11 Jul 2011 17:49:21 +0000 (17:49 +0000)]
Apply patch from Richard Trieu to fix PR9548:

When two different types has the same text representation in the same
diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra
information about the type.

class versa_string;

typedef versa_string string;

namespace std {template <typename T> class vector;}

using std::vector;

void f(vector<string> v);

namespace std {
class basic_string;
typedef basic_string string;
template <typename T> class vector {};
void g() {
  vector<string> v;
  f(v);
}
}

Old message:
----------------
test.cc:15:3: error: no matching function for call to 'f'
  f(&v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' to 'vector<string>' for 1st argument
void f(vector<string> v);
     ^
1 error generated.

New message:
---------------
test.cc:15:3: error: no matching function for call to 'f'
  f(v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' (aka 'std::vector<std::basic_string>') to
      'vector<string>' (aka 'std::vector<versa_string>') for 1st argument
void f(vector<string> v);
     ^
1 error generated.

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

13 years agoTweak two tests with MSYS-bash tolerant.
NAKAMURA Takumi [Mon, 11 Jul 2011 16:21:34 +0000 (16:21 +0000)]
Tweak two tests with MSYS-bash tolerant.

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

13 years agotest/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331.
NAKAMURA Takumi [Mon, 11 Jul 2011 16:21:28 +0000 (16:21 +0000)]
test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331.

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

13 years agoDon't complain about missing return statements for naked
Douglas Gregor [Mon, 11 Jul 2011 15:24:01 +0000 (15:24 +0000)]
Don't complain about missing return statements for naked
functions. Fixes <rdar://problem/9731999>.

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

13 years agotest/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_...
NAKAMURA Takumi [Mon, 11 Jul 2011 14:53:27 +0000 (14:53 +0000)]
test/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_next on mingw.

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

13 years agoDe-constify Types in StructType::get() and TargetData::getIntPtrType().
Jay Foad [Mon, 11 Jul 2011 09:56:20 +0000 (09:56 +0000)]
De-constify Types in StructType::get() and TargetData::getIntPtrType().

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

13 years agoFixed PR10243.
Abramo Bagnara [Mon, 11 Jul 2011 08:52:40 +0000 (08:52 +0000)]
Fixed PR10243.

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

13 years agoAdded removeBitWidth method.
Abramo Bagnara [Mon, 11 Jul 2011 08:43:20 +0000 (08:43 +0000)]
Added removeBitWidth method.

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

13 years agoFix a lot of problems with the partial destruction of arrays:
John McCall [Mon, 11 Jul 2011 08:38:19 +0000 (08:38 +0000)]
Fix a lot of problems with the partial destruction of arrays:
 - an off-by-one error in emission of irregular array limits for
   InitListExprs
 - use an EH partial-destruction cleanup within the normal
   array-destruction cleanup
 - get the branch destinations right for the empty check
Also some refactoring which unfortunately obscures these changes.

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

13 years agoDe-constify Types in FunctionType::get().
Jay Foad [Mon, 11 Jul 2011 07:56:41 +0000 (07:56 +0000)]
De-constify Types in FunctionType::get().

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

13 years agoMatch createCodeEmitter change.
Evan Cheng [Mon, 11 Jul 2011 04:24:19 +0000 (04:24 +0000)]
Match createCodeEmitter change.

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

13 years agoUse cached types; no functionality change.
John McCall [Sun, 10 Jul 2011 20:11:30 +0000 (20:11 +0000)]
Use cached types;  no functionality change.

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

13 years agoFix ARCMT/migrate.m on MSVC.
Francois Pichet [Sun, 10 Jul 2011 19:48:34 +0000 (19:48 +0000)]
Fix ARCMT/migrate.m on MSVC.
Solution is to set output stdout to binary mode to prevent newline conversion (\n => \r\n).

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

13 years agoUnbreak -cc1as mode after MC subtarget changes
Joerg Sonnenberger [Sun, 10 Jul 2011 19:16:25 +0000 (19:16 +0000)]
Unbreak -cc1as mode after MC subtarget changes

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

13 years ago[arcmt] Remove redundant has_error() check.
Argyrios Kyrtzidis [Sun, 10 Jul 2011 18:57:18 +0000 (18:57 +0000)]
[arcmt] Remove redundant has_error() check.

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

13 years ago[arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.
Argyrios Kyrtzidis [Sun, 10 Jul 2011 18:57:15 +0000 (18:57 +0000)]
[arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.

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

13 years agotest/CMakeLists.txt: clang-test may depend on llc when LLVM is built together.
NAKAMURA Takumi [Sun, 10 Jul 2011 17:45:28 +0000 (17:45 +0000)]
test/CMakeLists.txt: clang-test may depend on llc when LLVM is built together.

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

13 years agotest/CMakeLists.txt: Fix ClangUnitTests to be built with clang-test and check-all.
NAKAMURA Takumi [Sun, 10 Jul 2011 17:45:23 +0000 (17:45 +0000)]
test/CMakeLists.txt: Fix ClangUnitTests to be built with clang-test and check-all.

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

13 years agotools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to...
NAKAMURA Takumi [Sun, 10 Jul 2011 15:50:19 +0000 (15:50 +0000)]
tools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to satisfy linking on cygming.

FIXME: tools/c-*.exe should be linked to clang.dll on cygming. llvm/Makefile.rules is not aware of bin/clang.dll.

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

13 years agorelax this test a bit to hopefully work with VC++
Chris Lattner [Sun, 10 Jul 2011 14:52:52 +0000 (14:52 +0000)]
relax this test a bit to hopefully work with VC++

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

13 years agoChange __debugbreak signature to void __debugbreak(void); MSVC compatibility.
Francois Pichet [Sun, 10 Jul 2011 14:15:07 +0000 (14:15 +0000)]
Change __debugbreak signature to void __debugbreak(void); MSVC compatibility.

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

13 years agoimplement a nice new optimization: CodeGenTypes::UpdateCompletedType
Chris Lattner [Sun, 10 Jul 2011 06:03:22 +0000 (06:03 +0000)]
implement a nice new optimization: CodeGenTypes::UpdateCompletedType
is called whenever a tag type is completed.  We previously used that
as the sign to layout the codegen representation for the tag type,
which worked but meant that we laid out *every* completed type, whether
it was used or not.

Now we just lay out the type if we've already seen it somehow else.
This means that we lay out types we've used but haven't seen a body
for, but we don't lay out tons of stuff that noone cares about.

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

13 years agoenhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
Chris Lattner [Sun, 10 Jul 2011 05:53:24 +0000 (05:53 +0000)]
enhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
us to revert the other half of r134860.  Now things are back to a relatively tidy state.

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

13 years agorevert part of r134860, which is empirically unnecessary after the proper fix
Chris Lattner [Sun, 10 Jul 2011 05:44:18 +0000 (05:44 +0000)]
revert part of r134860, which is empirically unnecessary after the proper fix

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

13 years agokeep track of whether being in a RS_StructPointer state
Chris Lattner [Sun, 10 Jul 2011 05:39:13 +0000 (05:39 +0000)]
keep track of whether being in a RS_StructPointer state
caused us to skip layout out a function accurately.  If
so, flush the type cache for both the function and struct
case to ensure that any pointers to the functions get
recomputed.  This is overconservative, but with this patch
clang can build itself again.

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

13 years agochange EmitLValueForField to cast the returned lvalue to the right
Chris Lattner [Sun, 10 Jul 2011 05:34:54 +0000 (05:34 +0000)]
change EmitLValueForField to cast the returned lvalue to the right
type, even when in the struct case.  This was one root issue that was
causing type mismatches throughout the compiler.

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

13 years agoFix the clang bootstrap and Jay's testcase from llvm-dev by being completely
Chris Lattner [Sun, 10 Jul 2011 03:47:27 +0000 (03:47 +0000)]
Fix the clang bootstrap and Jay's testcase from llvm-dev by being completely
conservative when converting a functiontype to IR when in a "pointer within
a struct" context.  This has the unfortunate sideeffect of compiling all
function pointers inside of structs into "{}*" which, though correct, is
ugly.  This has the positive side effect of being correct, and it is pretty
straight-forward to improve on this.

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

13 years agowhen emitting pointer load from an lvalue or storing to an lvalue,
Chris Lattner [Sun, 10 Jul 2011 03:38:35 +0000 (03:38 +0000)]
when emitting pointer load from an lvalue or storing to an lvalue,
do an explicit bitcast to whatever ConvertType produces.  This will
go with the next patch.

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

13 years agoc-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.
NAKAMURA Takumi [Sun, 10 Jul 2011 03:10:43 +0000 (03:10 +0000)]
c-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.

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

13 years agohow about we initialize RecursionState.
Chris Lattner [Sun, 10 Jul 2011 01:10:18 +0000 (01:10 +0000)]
how about we initialize RecursionState.

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

13 years agoRename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
Chris Lattner [Sun, 10 Jul 2011 00:18:59 +0000 (00:18 +0000)]
Rename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
it is a predicate, not an action.  Change the return type to be a bool,
not the incomplete member.  Enhace it to detect the recursive compilation
case, allowing us to compile Eli's testcase on llvmdev:

struct T {
 struct T (*p)(void);
} t;

into:

%struct.T = type { {}* }

@t = common global %struct.T zeroinitializer, align 8

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

13 years agotest/CMakeLists.txt: Add missing c-arcmt-test to clang-test.deps.
NAKAMURA Takumi [Sat, 9 Jul 2011 23:36:37 +0000 (23:36 +0000)]
test/CMakeLists.txt: Add missing c-arcmt-test to clang-test.deps.

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

13 years agoFix linker problem in buildbot.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 22:35:06 +0000 (22:35 +0000)]
Fix linker problem in buildbot.

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

13 years agoUgh, fix CMake.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 22:05:50 +0000 (22:05 +0000)]
Ugh, fix CMake.

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

13 years ago[libclang] Fix linker error in buildbots.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 21:35:58 +0000 (21:35 +0000)]
[libclang] Fix linker error in buildbots.

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

13 years ago[arcmt] Remove test/ARCMT/with-working-dir.m which fails at windows hosts and is...
Argyrios Kyrtzidis [Sat, 9 Jul 2011 20:01:02 +0000 (20:01 +0000)]
[arcmt] Remove test/ARCMT/with-working-dir.m which fails at windows hosts and is not that useful
in the first place. http://llvm.org/PR10312.

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

13 years ago[arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 20:00:58 +0000 (20:00 +0000)]
[arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.

This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.

<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.

Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.

Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.

rdar://9735086.

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

13 years agowhen an enum type is completed, only flush the type cache when
Chris Lattner [Sat, 9 Jul 2011 18:53:56 +0000 (18:53 +0000)]
when an enum type is completed, only flush the type cache when
the enum has already been converted.  If not, there cannot be any types
built on top of it, so there is no need to flush the cache.

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

13 years agofix this on 32-bit hosts.
Chris Lattner [Sat, 9 Jul 2011 18:33:01 +0000 (18:33 +0000)]
fix this on 32-bit hosts.

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

13 years agoclang side to match the LLVM IR type system rewrite patch.
Chris Lattner [Sat, 9 Jul 2011 17:41:47 +0000 (17:41 +0000)]
clang side to match the LLVM IR type system rewrite patch.

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

13 years agoMore compiler workarounds. I have to admit that I was not
John McCall [Sat, 9 Jul 2011 09:09:00 +0000 (09:09 +0000)]
More compiler workarounds.  I have to admit that I was not
expecting so much concentrated oddity on what seemed like a
trivial feature.  Thanks to François Pichet for doing the
MSVC legwork here.

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

13 years agocc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c
Evan Cheng [Sat, 9 Jul 2011 07:32:07 +0000 (07:32 +0000)]
cc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c

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

13 years agodisable this test to get the botz green again.
Chris Lattner [Sat, 9 Jul 2011 07:14:54 +0000 (07:14 +0000)]
disable this test to get the botz green again.

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

13 years agocreateAsmParser API change.
Evan Cheng [Sat, 9 Jul 2011 06:04:17 +0000 (06:04 +0000)]
createAsmParser API change.

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

13 years agoGCC 4.2 compatibility hack.
John McCall [Sat, 9 Jul 2011 02:30:03 +0000 (02:30 +0000)]
GCC 4.2 compatibility hack.

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

13 years agoA number of array-related IR-gen cleanups.
John McCall [Sat, 9 Jul 2011 01:37:26 +0000 (01:37 +0000)]
A number of array-related IR-gen cleanups.
  - Emit default-initialization of arrays that were partially initialized
    with initializer lists with a loop, rather than emitting the default
    initializer N times;
  - support destroying VLAs of non-trivial type, although this is not
    yet exposed to users; and
  - support the partial destruction of arrays initialized with
    initializer lists when an initializer throws an exception.

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

13 years agoSilly typo in test for r134770.
Eli Friedman [Fri, 8 Jul 2011 23:57:18 +0000 (23:57 +0000)]
Silly typo in test for r134770.

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

13 years agoChange -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx should not...
Eli Friedman [Fri, 8 Jul 2011 23:31:17 +0000 (23:31 +0000)]
Change -mno-mmx to be more compatible with gcc.  Specifically, -mno-mmx should not imply -mno-sse.

Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__.

clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much.

<rdar://problem/9694837>

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

13 years agoRevert x86_64 ABI changes until I have time to check the items raised by Eli.
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:57:35 +0000 (22:57 +0000)]
Revert x86_64 ABI changes until I have time to check the items raised by Eli.

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

13 years agoIntroduce __builtin_expect() intrinsic support.
Jakub Staszak [Fri, 8 Jul 2011 22:45:14 +0000 (22:45 +0000)]
Introduce __builtin_expect() intrinsic support.

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

13 years agoAdd support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:18:40 +0000 (22:18 +0000)]
Add support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)

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

13 years agoAdd codegen support for the fma/fmal/fmaf builtins.
Cameron Zwarich [Fri, 8 Jul 2011 21:39:34 +0000 (21:39 +0000)]
Add codegen support for the fma/fmal/fmaf builtins.

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

13 years agoInitialize all the AnalysisBasedWarnings statistics to zero.
Benjamin Kramer [Fri, 8 Jul 2011 20:38:53 +0000 (20:38 +0000)]
Initialize all the AnalysisBasedWarnings statistics to zero.

Found by valgrind.

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

13 years agoRemove unused variable.
Benjamin Kramer [Fri, 8 Jul 2011 20:20:17 +0000 (20:20 +0000)]
Remove unused variable.

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

13 years agoFix up dependency file name printing to more closely match that of gcc, including...
Eli Friedman [Fri, 8 Jul 2011 20:17:28 +0000 (20:17 +0000)]
Fix up dependency file name printing to more closely match that of gcc, including fixing a nasty recent regression that could make us print "/foo.h" with a command-line including "-I ./".

rdar://problem/9734352

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

13 years agoobjc++-arc: more diagnosis of converting a weak-unavailable
Fariborz Jahanian [Fri, 8 Jul 2011 17:41:42 +0000 (17:41 +0000)]
objc++-arc: more diagnosis of converting a weak-unavailable
object to a __weak object type. // rdar://9732636

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