Stuart Hastings
4b21495e42
Replace SmallVector with an array, as suggested by Frits van Bommel. rdar://problem/7662569
...
llvm-svn: 130417
2011-04-28 18:16:06 +00:00
John McCall
a85af56e66
When block-capturing a variable with a non-trivial destructor,
...
make sure to mark the destructor. This normally isn't required,
because the destructor should have been marked as part of the
declaration of the local, but it's necessary when the variable
is a parameter because it's the call sites that are responsible
for those destructors.
llvm-svn: 130372
2011-04-28 02:15:35 +00:00
John Wiegley
1c0675e155
Parsing/AST support for Structured Exception Handling
...
Patch authored by Sohail Somani.
Provide parsing and AST support for Windows structured exception handling.
llvm-svn: 130366
2011-04-28 01:08:34 +00:00
John Wiegley
6242b6a688
Implementation of Embarcadero array type traits
...
Patch authored by John Wiegley.
These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).
llvm-svn: 130351
2011-04-28 00:16:57 +00:00
Stuart Hastings
f2752a3938
Re-enable byval for ARM in clang. rdar://problem/7662569
...
llvm-svn: 130312
2011-04-27 17:24:02 +00:00
Fariborz Jahanian
595ec5d43c
Some refactoring of my ms_struct patch.
...
// rdar://8823265 related.
llvm-svn: 130311
2011-04-27 17:14:21 +00:00
Anders Carlsson
c5d3ba1aad
When compiling with -fno-threadsafe-statics, guard variables for globals with internal linkage don't have to be i64, i8 works just fine!
...
llvm-svn: 130286
2011-04-27 04:37:08 +00:00
Fariborz Jahanian
bcb23a180b
With ms_struct attribut, Zero-length bitfields following
...
non-bitfield members are ignore. // rdar://8823265 wip
llvm-svn: 130257
2011-04-26 23:52:16 +00:00
Devang Patel
e67eca43d6
We need pointer size in bits here.
...
llvm-svn: 130244
2011-04-26 21:16:49 +00:00
John McCall
0009fcc39e
Make yet another placeholder type, this one marking that an expression is a bound
...
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function. Diagnose this in the general case. Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.
llvm-svn: 130239
2011-04-26 20:42:42 +00:00
Daniel Dunbar
a59b0a6e3c
IRgen/Darwin: Fix refacto introduced in Triple changes.
...
llvm-svn: 130233
2011-04-26 19:43:00 +00:00
Eric Christopher
6f095d613a
Temporarily revert r130176, it appears to have broken a few tests.
...
llvm-svn: 130179
2011-04-26 01:02:04 +00:00
Devang Patel
420c8de92e
Emit intrinsic at current insert point, not at the end of current block.
...
llvm-svn: 130177
2011-04-25 23:52:27 +00:00
Stuart Hastings
83da03c2ab
Turn on byval parameters in Clang for ARM APCS. rdar://problem/7662569
...
llvm-svn: 130176
2011-04-25 23:48:12 +00:00
Devang Patel
4f325d1f0f
Simplify. There is no need to have a method to just call another method.
...
llvm-svn: 130175
2011-04-25 23:43:36 +00:00
Fariborz Jahanian
24ac1599fc
Generalize case for built-in expressions having
...
side-effect to generate their ir. Not just for
__builtin_expect. // rdar://9330105
llvm-svn: 130172
2011-04-25 23:10:07 +00:00
Fariborz Jahanian
5a866c0bf2
Ir-gen the side-effect(s) when __builtin_expect is
...
constant-folded. // rdar://9330105
llvm-svn: 130163
2011-04-25 22:30:02 +00:00
John Wiegley
f9f6584e95
t/clang/expr-traits
...
Patch authored by David Abrahams.
These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.
llvm-svn: 130122
2011-04-25 06:54:41 +00:00
Ken Dyck
bb2c24008f
Convert size and alignment variables to CharUnits in EmitAggregateCopy(). No
...
change in functionality intended.
llvm-svn: 130113
2011-04-24 17:37:26 +00:00
Ken Dyck
239a3357af
Convert type size and alignment to CharUnits in CheckAggExprForMemSetUse().
...
No change in functionality intended.
llvm-svn: 130112
2011-04-24 17:25:32 +00:00
Ken Dyck
df94cb7dbe
Convert the return type of GetNumNonZeroBytesInInit() to CharUnits. No
...
change in functionality intended.
llvm-svn: 130111
2011-04-24 17:17:56 +00:00
Ken Dyck
3b4bd9a164
Eliminate some literal 8s by converting size variables in EmitGCMove() and
...
EmitFinalDestCopy() to CharUnits. No change in functionality intended.
llvm-svn: 130110
2011-04-24 17:08:00 +00:00
Ken Dyck
a8094505e2
Replace calls to ASTContext::getTypeInfo() with calls to
...
ASTContext::getTypeSize() when only the size part is used. No change in
functionality intended.
llvm-svn: 130109
2011-04-24 17:02:38 +00:00
Ken Dyck
272b6fa0f0
Simplify AppendTailPadding() by converting its parameter to CharUnits. No
...
change in functionality intended.
llvm-svn: 130108
2011-04-24 16:53:44 +00:00
Ken Dyck
7a0b19f978
Eliminate literal 8s from LayoutUnionField by converting NumBytesToAppend to
...
CharUnits. No change in functionality intended.
llvm-svn: 130107
2011-04-24 16:47:33 +00:00
Ken Dyck
345a6de9b4
Eliminate literal 8s from LayoutBitField(), converting variables to
...
CharUnits or replacing the 8s with char align. No change in functionality
intended.
llvm-svn: 130106
2011-04-24 16:40:29 +00:00
Ken Dyck
27337a8800
Convert AccessInfo::AccessAlignment to CharUnits. No change in functionality
...
intended.
llvm-svn: 130087
2011-04-24 10:13:17 +00:00
Jay Foad
dbf81d8ddf
PR9214: Convert the DIBuilder API to use ArrayRef.
...
llvm-svn: 130086
2011-04-24 10:11:03 +00:00
Ken Dyck
f76759c6fa
Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
...
functionality intended.
llvm-svn: 130085
2011-04-24 10:04:59 +00:00
Jay Foad
1a180156b6
Remove unused STL header includes.
...
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Devang Patel
a6cb0642b2
Tie debug information for method declaration with debug information for method definition.
...
llvm-svn: 130037
2011-04-23 00:08:01 +00:00
Francois Pichet
1c229c0472
Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.
...
Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.
llvm-svn: 130022
2011-04-22 22:18:13 +00:00
Fariborz Jahanian
c057794adb
Fixes an instance method meta-data generation bug in
...
ObjC NeXt runtime where method pointer registered in
metadata belongs to an unrelated method. Ast part of this fix,
I turned at @end missing warning (for class
implementations) into an error as we can never
be sure that meta-data being generated is correct.
// rdar://9072317
llvm-svn: 130019
2011-04-22 22:02:28 +00:00
Ken Dyck
0fed10e704
Replace a couple of literal 8s with ASTContext::getCharWidth(). No change in
...
functionality intended.
llvm-svn: 130002
2011-04-22 17:59:22 +00:00
Ken Dyck
c5c416f7db
Eliminate some literal 8s from EmitNullInitialization() by converting
...
variables to CharUnits. No change in functionality intended.
llvm-svn: 130001
2011-04-22 17:51:05 +00:00
Ken Dyck
bbe3862d95
Eliminate some literal 8s from EmitDeclare by converting to CharUnits. No
...
change in functionality intended.
llvm-svn: 129999
2011-04-22 17:41:34 +00:00
Ken Dyck
8159c1f2df
Use CharUnits to eliminate some literal 8s in
...
EmitTypeForVarWithBlocksAttr(). No change in functionality intended.
llvm-svn: 129998
2011-04-22 17:34:18 +00:00
Ken Dyck
abae3beec5
Replace some literal 8s with char width and char align. No change in
...
functionality intended.
llvm-svn: 129996
2011-04-22 17:23:43 +00:00
Justin Holewinski
bd4a3c03ff
PTX: Add default PTX calling conventions
...
llvm-svn: 129987
2011-04-22 11:10:38 +00:00
Nick Lewycky
207bce31e1
Wire up the -ftest-coverage and -fprofile-arcs flags to .gcno file emission (at
...
compile time) and .gcda emission (at runtime). --coverage enables both.
This does not yet add the profile_rt library to the link step if -fprofile-arcs
is enabled when linking.
llvm-svn: 129956
2011-04-21 23:44:07 +00:00
Jay Foad
ea324f154b
PR9214: Convert Metadata API to use ArrayRef.
...
llvm-svn: 129929
2011-04-21 19:59:12 +00:00
John McCall
e0fda7377e
The 0.98 revision of the x86-64 ABI clarified a lot of things, some
...
of which break strict compatibility with previous compilers. Implement
one of them and then immediately opt out on Darwin.
llvm-svn: 129899
2011-04-21 01:20:55 +00:00
Argyrios Kyrtzidis
b2ed28ea4b
For
...
double data[20000000] = {0};
we would blow out the memory by creating 20M Exprs to fill out the initializer.
To fix this, if the initializer list initializes an array with more elements than
there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression
that specifies an expression to be used for value initialization of the rest of the elements.
Fixes rdar://9275920.
llvm-svn: 129896
2011-04-21 00:27:41 +00:00
Anders Carlsson
f03f3ec9dd
Don't add type names for enums; they're never used in LLVM IR.
...
llvm-svn: 129894
2011-04-20 23:51:43 +00:00
Chris Lattner
54fd1a1ad3
fix a crash on code that uses the result value of __builtin___memcpy_chk.
...
llvm-svn: 129892
2011-04-20 23:14:50 +00:00
Daniel Dunbar
914bc4106c
IRgen/ARM: Fix a think-o in conversion-to-null for member function pointers, we
...
were computing the conversion as (ptr != 0 && non-virtual), when it should be
(ptr != 0 || is-virtual).
- Test to follow in LLVM test-suite.
llvm-svn: 129830
2011-04-19 23:10:47 +00:00
Chris Lattner
2531eb421f
some cleanups to use IRBuilder methods instead of llvm:: foo methods.
...
llvm-svn: 129829
2011-04-19 22:55:03 +00:00
Daniel Dunbar
14ad22f09d
ADT/Triple: Switch to using .isOSDarwin() predicate.
...
llvm-svn: 129823
2011-04-19 21:43:27 +00:00
Chris Lattner
46f1614d56
use the newly introduced IRBuilder getInt() method to reduce some
...
redundancy pointed out by John.
llvm-svn: 129808
2011-04-19 20:53:45 +00:00
Devang Patel
43cfa5dce1
Fix typo in comment.
...
llvm-svn: 129703
2011-04-18 17:30:25 +00:00
Anders Carlsson
566ae67ef8
Get rid of std::vector usage when getting function types in CGException.cpp
...
llvm-svn: 129698
2011-04-18 14:24:10 +00:00
Anders Carlsson
940f02d248
Clean up code generation of typeid expressions and add C++ standard references.
...
llvm-svn: 129682
2011-04-18 00:57:03 +00:00
Chris Lattner
97bbee2fb4
Fix a miscompilation I introduced in r129652, thanks for Eli for tracking
...
it down. we effectively were compile the testcase into:
void test14(int x) {
switch (x) {
case 11: break;
case 42: test14(97); // fallthrough
default: test14(42); break;
which is not the same thing at all. This fixes a miscompilation of
MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot.
llvm-svn: 129679
2011-04-17 23:21:26 +00:00
Anders Carlsson
fcaaa697ec
When laying out bases in, always try the "base subobject" LLVM type. If it
...
turns out that a field or base needs to be laid out in the tail padding of
the base, CGRecordLayoutBuilder::ResizeLastBaseFieldIfNecessary will convert
it to an array of i8.
I've audited the new test results to make sure that they are still valid. I've
also verified that we pass a self-host with this change.
This (finally) fixes PR5589!
llvm-svn: 129673
2011-04-17 21:56:13 +00:00
Anders Carlsson
56c4d80a4e
Add addBaseSubobjectTypeName which isn't used yet.
...
llvm-svn: 129671
2011-04-17 21:40:34 +00:00
Anders Carlsson
c58f8cb7fc
Move code to add a type name to a TagDecl type out into a helper function. No functionality change.
...
llvm-svn: 129669
2011-04-17 21:36:59 +00:00
Anders Carlsson
b6d31e7dcc
Use a SmallVector for field types in CGRecordLayoutBuilder now that llvm::StructType::get takes an ArrayRef.
...
llvm-svn: 129667
2011-04-17 21:32:41 +00:00
Eli Friedman
2e2ff8894d
Hack to turn the valgrind buildbot green, until Devang can address it
...
properly.
llvm-svn: 129657
2011-04-17 06:40:15 +00:00
Chris Lattner
bc204c8043
implement rdar://9289524 - case followed immediately by break results in empty IR block,
...
a -O0 code quality issue.
llvm-svn: 129652
2011-04-17 00:54:30 +00:00
Chris Lattner
30107ed600
fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
...
are trivial. This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.
This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0
llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Chris Lattner
56784f9de6
fix rdar://9289603 - clang should fold trivial ?: for enums as well as integer constants into select at -O0
...
by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant. In particular, we now fold enums.
llvm-svn: 129649
2011-04-16 23:15:35 +00:00
Devang Patel
7294d74627
Emit proper selector name in debug info.
...
llvm-svn: 129626
2011-04-16 00:37:51 +00:00
Devang Patel
9d6c857862
Emit debug info for Objective-C properties.
...
llvm-svn: 129625
2011-04-16 00:12:55 +00:00
Michael J. Spencer
6826eb816a
Add 3DNow! Intrinsics.
...
llvm-svn: 129570
2011-04-15 15:07:13 +00:00
Richard Smith
dda56e4b4a
Support for C++11 (non-template) alias declarations.
...
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Chris Lattner
57540c5be0
fix a bunch of comment typos found by codespell. Patch by
...
Luis Felipe Strano Moraes!
llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Peter Collingbourne
9114759641
C1X: implement generic selections
...
As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.
llvm-svn: 129554
2011-04-15 00:35:48 +00:00
Richard Smith
02e85f3bc5
Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
...
llvm-svn: 129541
2011-04-14 22:09:26 +00:00
Anton Korobeynikov
231e875b5c
Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
...
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.
In particular, all library functions should always be AAPCS regardless of floating point ABI used.
llvm-svn: 129534
2011-04-14 20:06:49 +00:00
Ken Dyck
3563aa6520
Replace a couple of divide-by-8s with divide-by-charwidths. No change in
...
functionality intended.
llvm-svn: 129496
2011-04-14 01:00:39 +00:00
Ken Dyck
c5ca87675e
Replace a couple of divisions-by-'8' with divisions-by-charwidth. No change
...
in functionality intended.
llvm-svn: 129491
2011-04-14 00:43:09 +00:00
Bill Wendling
a865185ad6
Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
...
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Bill Wendling
88ae43772a
It looks like the FreeBSD buildbot needs this for the builtins-x86.c test.
...
llvm-svn: 129433
2011-04-13 10:02:54 +00:00
Bill Wendling
b9c9e34cb3
Just use a native "load" instead of translating the builtin later. Clang can
...
take it!
I wasn't able to get __builtin_ia32_loaddqu to transform into an unaligned
load...I'll have to look into it further.
llvm-svn: 129427
2011-04-13 05:58:17 +00:00
Anders Carlsson
bbe277c4a9
Use EmitCallOrInvoke in EmitBadTypeidCall and EmitBadCastCall.
...
llvm-svn: 129424
2011-04-13 02:35:36 +00:00
Bill Wendling
3137d3cb49
Convert the unaligned load builtins to the first-class versions.
...
llvm-svn: 129420
2011-04-13 00:36:37 +00:00
Daniel Dunbar
9c8cd4c097
IRgen/Obj-C: Emit CFStrings and NSStrings with the alignment of the char type,
...
there is no reason to align them higher.
- This roughly matches llvm-gcc's r126913.
- It is an open question whether or not we should do this for cstring's in
general (code size vs optimization potential), for now we just match llvm-gcc
until someone wants to run some experiments.
llvm-svn: 129410
2011-04-12 23:30:52 +00:00
John McCall
58989b7125
We can't emit an aggregate cast as its sub-expression in general just
...
because the result is ignored. The particular example here is with
property l-values, but there could be all sorts of lovely casts that this
isn't safe for. Sink the check into the one case that seems to actually
be capable of honoring this.
llvm-svn: 129397
2011-04-12 22:02:02 +00:00
John McCall
a97f329869
Template static data members can have weak_odr linkage, not just
...
weak linkage. Also, fix a problem where global weak variables
with non-trivial initializers were getting guard variables, or at
least were checking for them and then crashing.
llvm-svn: 129342
2011-04-12 01:46:54 +00:00
John McCall
32f44bd0fc
Ignore indirect field declarations. Fixes PR9570.
...
llvm-svn: 129337
2011-04-12 01:01:22 +00:00
John McCall
2979fe01da
After some discussion with Doug, we decided that it made a lot more sense
...
for __unknown_anytype resolution to destructively modify the AST. So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.
llvm-svn: 129331
2011-04-12 00:42:48 +00:00
Anders Carlsson
0c63350b0b
If there's an invoke destination, we should use invoke instead of call when calling the __cxa_bad_typeid function. Fixes PR7400.
...
llvm-svn: 129273
2011-04-11 14:13:40 +00:00
John McCall
2d2e870745
More __unknown_anytype work.
...
llvm-svn: 129269
2011-04-11 07:02:50 +00:00
Anders Carlsson
8a01a751c9
Remove CK_DynamicToNull.
...
llvm-svn: 129265
2011-04-11 02:03:26 +00:00
Anders Carlsson
c1c9971cab
When we know that a dynamic_cast always returns null, we can make
...
CodeGenFunction::EmitDynamicCast always return null or throw a bad_cast
exception.
llvm-svn: 129264
2011-04-11 01:45:29 +00:00
Anders Carlsson
882d790f72
Clean up CodeGenFunction::EmitDynamicCast. No functionality change.
...
llvm-svn: 129262
2011-04-11 00:46:40 +00:00
Anders Carlsson
98981b10c8
Replace a couple of Builder.CreateICmpEQ with Builder.CreateIsNull. No functionality change.
...
llvm-svn: 129261
2011-04-11 00:30:07 +00:00
Anders Carlsson
c602006638
As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind which
...
represents a dynamic cast where we know that the result is always null.
For example:
struct A {
virtual ~A();
};
struct B final : A { };
struct C { };
bool f(B* b) {
return dynamic_cast<C*>(b);
}
llvm-svn: 129256
2011-04-10 20:33:22 +00:00
Anders Carlsson
c53d9e8350
Strip off parens and no-op casts when deciding if an expr can be devirtualized. Fixes the second half of PR9660.
...
llvm-svn: 129253
2011-04-10 18:20:53 +00:00
Anders Carlsson
e5ec21c977
Change CollectPrimaryBases to collect the bases in the right order. Fixes one half of PR9660.
...
llvm-svn: 129252
2011-04-10 18:00:32 +00:00
Anders Carlsson
68aad14dd3
Make -fdump-vtable-layouts also dump vtable indices for all virtual member functions in the class.
...
llvm-svn: 129250
2011-04-10 17:42:45 +00:00
Eli Friedman
493c34a86c
PR9580: Handle vectors correctly in ScalarExprEmitter::EmitRem.
...
While I'm here, FileCheck-ize the ext-vector test, so we actually check
what it is generating.
llvm-svn: 129241
2011-04-10 04:44:11 +00:00
Eli Friedman
db42a3e876
Make sure we or together the overflow flags of the multiply and add, so the
...
check is triggered appropriately. Reported on cfe-dev.
llvm-svn: 129231
2011-04-09 19:54:33 +00:00
Eli Friedman
c5b20b5283
PR8369: make __attribute((regparm(0))) work correctly. Original patch by
...
pageexec@freemail.hu , tweaks by me.
llvm-svn: 129206
2011-04-09 08:18:08 +00:00
Chris Lattner
e4ec5abf1b
fix indentation
...
llvm-svn: 129202
2011-04-09 07:11:53 +00:00
Chris Lattner
9cb59fa834
add a __sync_swap builtin to fill out the rest of the __sync builtins.
...
Patch by Dave Zarzycki!
llvm-svn: 129189
2011-04-09 03:57:26 +00:00
Ken Dyck
df01628e08
Convert the PointerWidthInBytes variable in EmitMemberPointer() to CharUnits
...
to eliminate a divide-by-8. No change in functionality intended.
llvm-svn: 129180
2011-04-09 01:30:02 +00:00
Ken Dyck
499e93d7ee
Eliminate a divide-by-8 in BuildVMIClassTypeInfo() by using CharUnits for
...
the base offset. No change in functionality intended.
llvm-svn: 129179
2011-04-09 01:09:56 +00:00
Nick Lewycky
d85ae78c48
Apply explicit braces to avoid ambiguous 'else' [-Wparentheses]
...
llvm-svn: 129176
2011-04-09 00:25:15 +00:00
Devang Patel
0b37e79891
Do not use zero as an upper bound for unbounded array because upper bound zero also indicates one element array.
...
llvm-svn: 129157
2011-04-08 21:56:52 +00:00