Commit Graph

767 Commits

Author SHA1 Message Date
Anders Carlsson 703a08605f Ignore non-interesting bases when emitting construction vtables.
llvm-svn: 98177
2010-03-10 19:15:26 +00:00
Rafael Espindola e81620fb88 Move test and also test codegen.
llvm-svn: 98154
2010-03-10 14:01:14 +00:00
Anders Carlsson 45be0e069d Add newline.
llvm-svn: 98140
2010-03-10 06:51:56 +00:00
Anders Carlsson 804cf51dcf Don't accidentally mark some functions in construction vtables as unused. Also land the test for a previous checkin, now that it's correct.
llvm-svn: 98139
2010-03-10 06:51:42 +00:00
Anders Carlsson ca82a4fdba Improve vcall offset handling in construction vtables. With this we layout the construction vtables from the ABI examples correctly.
llvm-svn: 98127
2010-03-10 02:33:41 +00:00
Rafael Espindola e7113ca907 Delay codegen of vtables when handling implicit instantiations.
This fixes PR6474.

llvm-svn: 98123
2010-03-10 02:19:29 +00:00
Devang Patel 4f26205ba8 More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
This fixes PR 6554.

llvm-svn: 98083
2010-03-09 21:32:27 +00:00
Douglas Gregor 589973b097 In C++98/03, an uninitialized variable that has POD class type will be
uninitialized. This seems not to be the case in C++0x, where we still
call the (trivial) default constructor for a POD class
(!). Previously, we had implemented only the C++0x rules; now we
implement both. Fixes PR6536.

llvm-svn: 97928
2010-03-08 02:45:10 +00:00
Douglas Gregor c934bc840c Perform overload resolution when static_cast'ing from a
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.

llvm-svn: 97923
2010-03-07 23:24:59 +00:00
Eli Friedman b632e30e41 Fix for PR6294: we should only delay recording nested dynamic classes if they
are lexically nested.  Othewise, we never end up recording semantically nested
classes.

llvm-svn: 97900
2010-03-07 05:49:51 +00:00
Douglas Gregor 577cf97cf3 Don't turn off mangling in implicitly extern "C" system headers. GCC
doesn't do this on any of the major platforms, and we don't really
support any of the platforms that do (nor will we actually handle
those headers well). Fixes PR6217; see PR6530 for details on what we
would need to do to support these platforms.

llvm-svn: 97899
2010-03-07 05:10:40 +00:00
Fariborz Jahanian 9eba9dfb0c Refactor local class name mangling and make it
ABI conforming.

llvm-svn: 97702
2010-03-04 01:02:03 +00:00
Fariborz Jahanian a529c25555 Implements mangling of local class names to
fix a code gen crash. This is WIP as not
all ABI cases are covered (there is a FIXME to 
this effect). Fixes radar 7696748.

llvm-svn: 97658
2010-03-03 19:41:08 +00:00
Anders Carlsson 5b0057c05b Fix a bug with base offset merging that Devang noticed.
llvm-svn: 97641
2010-03-03 04:58:02 +00:00
John McCall 1950a11939 Don't emit derived-to-base destructor aliases if we don't have a definition
for the base destructor, because aliases to declarations aren't legal.

Fixes PR 6471.

llvm-svn: 97637
2010-03-03 03:40:11 +00:00
John McCall bd8d9bd39c Split out types that are non-canonical unless dependent as their own
category.  Use this in a few places to eliminate unnecessary TST cases and
do some future-proofing.  Provide terrible manglings for typeof.  Mangle
decltype with some hope of accuracy.

Our manglings for some of the cases covered in the testcase are different
from gcc's, which I've raised as an issue with the ABI list.

llvm-svn: 97523
2010-03-01 23:49:17 +00:00
John McCall de9607bc6f The latest draft uses 'dt' to mangle member expressions, and now so do we.
llvm-svn: 97479
2010-03-01 19:12:25 +00:00
Douglas Gregor a51c67424e Improve name mangling for dependently-scoped declaration references.
llvm-svn: 97422
2010-02-28 22:05:49 +00:00
Douglas Gregor 5610db6923 Add name mangling for DeclRefExprs that refer to external names
llvm-svn: 97418
2010-02-28 21:40:32 +00:00
Anders Carlsson 7162ab947b Handle unused functions in construction vtables correctly.
llvm-svn: 97406
2010-02-28 18:37:33 +00:00
Anders Carlsson 8b37bb7c48 When laying out vtables for virtual bases in construction vtables, we need to check if the vtable is a primary base in the layout class.
llvm-svn: 97402
2010-02-28 18:08:38 +00:00
Anders Carlsson b15d8c57ad Add another construction vtable test.
llvm-svn: 97401
2010-02-28 17:59:36 +00:00
Anders Carlsson e3385f566b More improvements to construction vtables; we know handle vbase offsets correctly (I hope).
llvm-svn: 97361
2010-02-28 01:43:58 +00:00
Anders Carlsson c3f92a16f2 Add a simple construction vtable test.
llvm-svn: 97344
2010-02-27 21:09:00 +00:00
Anders Carlsson e02a926a1c Use the real base offset when calculating vbase offsets.
llvm-svn: 97338
2010-02-27 19:21:58 +00:00
Anders Carlsson 4d0729a7cc Figured out why the test was failing, this will hopefully fix it.
llvm-svn: 97336
2010-02-27 19:00:53 +00:00
Anders Carlsson 2b381bbb5c Don't add this adjustments for pure virtual member functions.
llvm-svn: 97334
2010-02-27 18:16:50 +00:00
Anders Carlsson ec27c49d6c XFAIL this for now. I have no idea why this test is failing on some machines. Looks like some sort of whitespace issue in FileCheck.
llvm-svn: 97332
2010-02-27 18:09:05 +00:00
Anders Carlsson e6528ed7c5 Add another test.
llvm-svn: 97329
2010-02-27 16:55:58 +00:00
Anders Carlsson 4068798cbc Finish up the changes to this adjustments.
llvm-svn: 97328
2010-02-27 16:52:49 +00:00
Anders Carlsson d2025417ef Fix another vtable layout bug; we weren't looking hard enough for overriden functions when determining if an overrider will ever be used.
llvm-svn: 97306
2010-02-27 06:38:03 +00:00
Anders Carlsson d69b2f93ea Handle vcall offset sharing between destructors.
llvm-svn: 97304
2010-02-27 04:12:52 +00:00
Anders Carlsson b08aaa3e10 Fix a bug where we were generating an unnecessary vtable for a virtual base that's already a primary virtual base.
llvm-svn: 97303
2010-02-27 04:05:52 +00:00
Anders Carlsson ed7d0e8be8 Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.
llvm-svn: 97173
2010-02-25 22:18:35 +00:00
Anders Carlsson a9f633b060 Generate correct vcall offsets when we have a primary virtual base that is not a primary base in the complete class hierarchy.
llvm-svn: 97039
2010-02-24 16:43:12 +00:00
Eli Friedman ad5f0789f6 PR6400: Handle an extreme edge case in mangling correctly.
llvm-svn: 96961
2010-02-23 18:20:18 +00:00
Anders Carlsson 0570f71255 More fixes. Don't try to emit a virtual base vtable if the virtual base in question is a primary virtual base of some other base.
llvm-svn: 96881
2010-02-23 03:48:14 +00:00
Anders Carlsson bae46277fe Always emit vcall offset for the primary base, not only if it's virtual. Remove a debug printf, and add the test case that now passes.
llvm-svn: 96880
2010-02-23 03:26:17 +00:00
John McCall f8ff7b9fd1 Perform two more constructor/destructor code-size optimizations:
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions.  This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.

2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor.  This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).

These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.

llvm-svn: 96842
2010-02-23 00:48:20 +00:00
John McCall b81884d347 More refactoring around constructor/destructor code generation.
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.

This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.

llvm-svn: 96670
2010-02-19 09:25:03 +00:00
Anders Carlsson 821095085b Add another test from the ABI spec.
llvm-svn: 96659
2010-02-19 05:59:40 +00:00
John McCall d4324148d7 Re-introduce the ctor/dtor alias optimization, this time hidden behind a
command-line option which defaults off.

llvm-svn: 96649
2010-02-19 01:32:20 +00:00
John McCall 334ce7c1c4 Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't.

llvm-svn: 96612
2010-02-18 21:31:48 +00:00
John McCall 5c60a6f597 Make deleting and complete dtor variants defer to other dtor variants by
calling them as subroutines.  This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.

llvm-svn: 96605
2010-02-18 19:59:28 +00:00
Anders Carlsson e5faca7cda Fix another bug and add another class.
llvm-svn: 96590
2010-02-18 17:32:33 +00:00
Anders Carlsson aa7444cd7d Add another class from cxx-vtable-ex.html
llvm-svn: 96588
2010-02-18 17:28:16 +00:00
Anders Carlsson 8847d9e40a More work on vcall offsets.
llvm-svn: 96587
2010-02-18 17:26:40 +00:00
Anders Carlsson 664b7d026e Add tests from the Itanium C++ ABI spec.
llvm-svn: 96586
2010-02-18 17:07:24 +00:00
John McCall 67cea74745 Emit complete constructors and destructors as aliases to base constructors
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes.  We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.

llvm-svn: 96451
2010-02-17 03:52:49 +00:00
Daniel Dunbar fd09df7839 IRgen: Switch 'retval' to use CreateIRTemp.
llvm-svn: 96376
2010-02-16 19:45:20 +00:00
Daniel Dunbar 27bacafb71 IRgen: Switch EmitCompoundLiteralLValue to use CreateMemTemp.
llvm-svn: 96373
2010-02-16 19:43:39 +00:00
Anders Carlsson bc91b44a23 Add an extreme vbase offsets test. I'm kinda amazed that this works myself ;)
llvm-svn: 96356
2010-02-16 16:50:08 +00:00
Anders Carlsson 13f0f66223 Handle layout of vtables for virtual bases.
llvm-svn: 96355
2010-02-16 16:49:35 +00:00
Anders Carlsson 14157939ab Fix a bug where we would not emit secondary vtables for bases of a primary base.
llvm-svn: 96351
2010-02-16 16:02:57 +00:00
Anders Carlsson 77904f1d5b Emit vbase offsets.
llvm-svn: 96329
2010-02-16 04:59:55 +00:00
Anders Carlsson 033d48697f Don't compute final overriders or build vtables for bases that don't need a vtable.
llvm-svn: 96171
2010-02-14 17:05:59 +00:00
Anders Carlsson 258a1e35e8 Improve support for non-virtual 'this' pointer adjustments. With this, it should be possible to use the new vtable layout code for all class hierarchies that do not involve virtual bases.
llvm-svn: 96137
2010-02-14 00:16:19 +00:00
Anders Carlsson d3adb0ced9 Add basic support for simple non-virtual 'this' pointer adjustments.
llvm-svn: 96136
2010-02-13 23:40:17 +00:00
Anders Carlsson e75aaa97b3 Start laying out secondary vtables.
llvm-svn: 96123
2010-02-13 22:05:23 +00:00
Anders Carlsson c1290adab7 Don't make return adjustments for pure virtual member functions.
llvm-svn: 96120
2010-02-13 21:16:54 +00:00
Anders Carlsson cf5a882da1 Handle virtual bases in return adjustment types.
llvm-svn: 96119
2010-02-13 21:07:32 +00:00
Anders Carlsson 6a6cbfc55f More work on covariant return types. We now handle non-virtual adjustments fine.
llvm-svn: 96114
2010-02-13 20:11:51 +00:00
Anders Carlsson 0760481f26 Fix a refacto that broke the clang-on-clang build.
llvm-svn: 95994
2010-02-12 18:14:46 +00:00
Anders Carlsson e8a9756e63 Keep track of the address points for all primary bases, and add the ability to dump multiple address points for a single offset.
llvm-svn: 95970
2010-02-12 07:43:48 +00:00
John McCall 84c416b9f6 Fix a bug causing an assertion when a covariant return type differed from
an overriden type only by reduced qualification.

llvm-svn: 95968
2010-02-12 06:15:07 +00:00
Anders Carlsson 65b4978f7f More work on vtable layout. We can now layout vtables with primary bases.
llvm-svn: 95965
2010-02-12 05:25:12 +00:00
Anders Carlsson 09da3372b6 When dumping vtables, dump whether a virtual member function is pure or not.
llvm-svn: 95963
2010-02-12 02:38:13 +00:00
Anders Carlsson 48ea217fbf Add virtual operator= example.
llvm-svn: 95888
2010-02-11 18:21:49 +00:00
Anders Carlsson 5bd8d19291 More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.
llvm-svn: 95887
2010-02-11 18:20:28 +00:00
Anders Carlsson 932c2f2a9a Keep track of, and dump, vtable address points.
llvm-svn: 95874
2010-02-11 17:18:51 +00:00
Anders Carlsson 5d40c6f658 Check in the beginnings of my new vtable layout builder idea.
Right now, it's off by default but can be tested by passing -fdump-vtable-layouts to clang -cc1. This option will cause all vtables that will normally be emitted as part of codegen to also be dumped using the new layout code.

I've also added a very simple new vtable layout test case.

llvm-svn: 95865
2010-02-11 08:02:13 +00:00
Daniel Dunbar 5140d1b75e Update tests in -Asserts mode. These tests really need to be rewritten...
llvm-svn: 95658
2010-02-09 08:22:03 +00:00
Daniel Dunbar a7566f163a IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!

PR6240.

llvm-svn: 95648
2010-02-09 02:48:28 +00:00
John McCall 340aafaac6 Emit global references with constant initializers as constants. Fixes PR5585.
The standard actually says that such references should have internal linkage,
but gcc doesn't do that, so we probably can't get away with it.

llvm-svn: 95577
2010-02-08 21:46:50 +00:00
Anders Carlsson ff8cce4395 Make sure to set vtable pointers in the destructors as well.
llvm-svn: 95525
2010-02-07 19:45:40 +00:00
Anders Carlsson 6d0e5bd8f3 Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
llvm-svn: 95524
2010-02-07 17:37:13 +00:00
Douglas Gregor b65a913c35 Fix assertion failure when parsing linkage specifications (PR5921),
from Keir Mierle!

llvm-svn: 95516
2010-02-07 08:38:28 +00:00
Anders Carlsson cee2d2f016 Use the right linkage for static variables inside C++ inline functions.
llvm-svn: 95512
2010-02-07 02:03:08 +00:00
Anders Carlsson 10d369d1a2 Improved handling of the visibility attribute. Declarations now inherit their parent's visibility.
(This is kind of a risky change, but I did a self-host build and everything appears to work fine!)

llvm-svn: 95511
2010-02-07 01:44:36 +00:00
Anders Carlsson 9878f9f73b Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
llvm-svn: 95509
2010-02-06 23:59:05 +00:00
Anders Carlsson fcd764a168 Add support for threadsafe statics, and make them the default (matching gcc).
Daniel, I'd appreciate a review of the driver/cc1 parts.

llvm-svn: 95508
2010-02-06 23:23:06 +00:00
Anders Carlsson 2c4de4c31e Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)
llvm-svn: 95485
2010-02-06 04:52:27 +00:00
Anders Carlsson 6710c5351e Use the correct function info for constructors when applying function attributes. Fixes PR6245.
llvm-svn: 95474
2010-02-06 02:44:09 +00:00
Douglas Gregor a16b0cae9a Implement name mangling for template template parameters
llvm-svn: 95427
2010-02-05 20:45:00 +00:00
Anders Carlsson cb86e1088a Fix the bug that was breaking self-host, and re-land the static ctor fixes.
llvm-svn: 95400
2010-02-05 18:38:45 +00:00
Douglas Gregor af77cd220a Revert r95363 and r95375, which broke self-host.
llvm-svn: 95389
2010-02-05 16:18:08 +00:00
Anders Carlsson ff338dbf9c Fix a test case.
llvm-svn: 95374
2010-02-05 06:58:06 +00:00
Anders Carlsson ecac409cb0 If a global initializer has a non-trivial destructor it can't be emitted as a constant (even if it has a trivial constructor).
llvm-svn: 95363
2010-02-05 05:19:42 +00:00
Anders Carlsson 824e0613de When binding an lvalue to a reference, we always need to pop temporaries.
With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:

Expected Passes    : 6933
Expected Failures  : 46
Unsupported Tests  : 40
Unexpected Failures: 27

which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.

llvm-svn: 95313
2010-02-04 17:32:58 +00:00
Anders Carlsson 3460aa1079 Update test.
llvm-svn: 95312
2010-02-04 17:29:32 +00:00
Anders Carlsson 9b942c65a5 Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.
llvm-svn: 95311
2010-02-04 17:26:01 +00:00
Anders Carlsson e5dfc26850 Improve conditional temporaries test.
llvm-svn: 95310
2010-02-04 17:23:15 +00:00
Anders Carlsson c4325486b9 Fix another pointer-to-member function miscompile, this time when trying to call a virtual member function.
llvm-svn: 95307
2010-02-04 17:08:48 +00:00
Anders Carlsson 674cf89301 Improve test.
llvm-svn: 95306
2010-02-04 17:06:52 +00:00
Anders Carlsson 7914dad72d Calculate offset correctly when taking the address of a virtual member function.
llvm-svn: 95305
2010-02-04 16:38:05 +00:00
John McCall d061b4429e Mangle member expressions. Also invented.
llvm-svn: 95284
2010-02-04 02:56:29 +00:00
John McCall 09de8ecd88 Add mangling support for calls, sizeof/alignof, constructor calls,
float literals, and unresolved lookups (which required hand-wavey extensions).

llvm-svn: 95273
2010-02-04 01:42:13 +00:00
Anders Carlsson b0695ef011 Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:
void f(int a = 10) {
  return a;
}

would always return 10, regardless of the passed in argument.

This fixes another 600 test failures. We're now down to only 137 failures!

llvm-svn: 95262
2010-02-03 21:58:41 +00:00
Anders Carlsson 66498388a7 Handle reference binding in aggregate initializers. Fixes another 47 tests.
llvm-svn: 95235
2010-02-03 19:13:55 +00:00
Douglas Gregor 7dc5c17d92 When a function or variable somehow depends on a type or declaration
that is in an anonymous namespace, give that function or variable
internal linkage.

This change models an oddity of the C++ standard, where names declared
in an anonymous namespace have external linkage but, because anonymous
namespace are really "uniquely-named" namespaces, the names cannot be
referenced from other translation units. That means that they have
external linkage for semantic analysis, but the only sensible
implementation for code generation is to give them internal
linkage. We now model this notion via the UniqueExternalLinkage
linkage type. There are several changes here:

  - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
    when the declaration is in an anonymous namespace.
  - Added Type::getLinkage() to determine the linkage of a type, which
    is defined as the minimum linkage of the types (when we're dealing
    with a compound type that is not a struct/class/union).
  - Extended NamedDecl::getLinkage() to consider the linkage of the
    template arguments and template parameters of function template
    specializations and class template specializations.
  - Taught code generation to rely on NamedDecl::getLinkage() when
    determining the linkage of variables and functions, also
    considering the linkage of the types of those variables and
    functions (C++ only). Map UniqueExternalLinkage to internal
    linkage, taking out the explicit checks for
    isInAnonymousNamespace().

This fixes much of PR5792, which, as discovered by Anders Carlsson, is
actually the reason behind the pass-manager assertion that causes the
majority of clang-on-clang regression test failures. With this fix,
Clang-built-Clang+LLVM passes 88% of its regression tests (up from
67%). The specific numbers are:

LLVM:
  Expected Passes    : 4006
  Expected Failures  : 32
  Unsupported Tests  : 40
  Unexpected Failures: 736

Clang:
  Expected Passes    : 1903
  Expected Failures  : 14
  Unexpected Failures: 75

Overall:
  Expected Passes    : 5909
  Expected Failures  : 46
  Unsupported Tests  : 40
  Unexpected Failures: 811

Still to do:
  - Improve testing
  - Check whether we should allow the presence of types with
  InternalLinkage (in addition to UniqueExternalLinkage) given
  variables/functions internal linkage in C++, as mentioned in
  PR5792. 
  - Determine how expensive the getLinkage() calls are in practice;
  consider caching the result in NamedDecl.
  - Assess the feasibility of Chris's idea in comment #1 of PR5792.

llvm-svn: 95216
2010-02-03 09:33:45 +00:00
Anders Carlsson 5dc86337fb Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.
llvm-svn: 95116
2010-02-02 19:58:43 +00:00
John McCall 49786a6c31 Codegen CXXConstructExprs with trivial constructors as constants.
Eliminates a lot of spurious global initializers, fixing PR6205.

llvm-svn: 95077
2010-02-02 08:02:49 +00:00
Anders Carlsson 75b1f959da Check in a test case and a nasty workaround for PR6199.
llvm-svn: 95076
2010-02-02 07:10:35 +00:00
Daniel Dunbar c4c7db6b71 XFAIL two tests on Win32 until some cares to investigate... the problem on
dyncast is just due to \r\n newline interaction w/ regexps. The remap-load.c
failure is a bit stranger (the end of the extent is on the next line), but I
don't care to investigate.

llvm-svn: 95071
2010-02-02 05:41:30 +00:00
Anders Carlsson e8bfe412ec Improve handling of emitting 'null' pointers to data members.
llvm-svn: 95066
2010-02-02 05:17:25 +00:00
Anders Carlsson 259688ce29 Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
llvm-svn: 95063
2010-02-02 03:37:46 +00:00
Anders Carlsson 15217531f7 Merge a test into pointers-to-data-members.cpp and convert it to FileCheck.
llvm-svn: 95061
2010-02-02 03:32:35 +00:00
Anders Carlsson 2cfade1671 Rename a test.
llvm-svn: 95060
2010-02-02 03:23:38 +00:00
Anders Carlsson 6276b2506d When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
llvm-svn: 94942
2010-01-31 02:39:02 +00:00
Anders Carlsson 600f737b95 When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.
llvm-svn: 94939
2010-01-31 01:43:37 +00:00
Douglas Gregor 65eb86e912 Fix reference binding of const lvalue references to bit-fields, which
requires a temporary. Previously, we were building an initialization
sequence that bound to the bit-field as if it were a real lvalue. Note
that we previously (and still) diagnose binding of non-const
references to bit-fields, as we should.

There's no real way to test that this code is correct, since reference
binding does not *currently* have any representation in the AST. This
fix should make it easier for that to happen, so I've verified this
fix with...

Added InitializationSequence::dump(), to print an initialization
sequence for debugging purposes.

llvm-svn: 94826
2010-01-29 19:14:02 +00:00
Douglas Gregor 16810ca647 Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
llvm-svn: 94811
2010-01-29 16:37:09 +00:00
Anders Carlsson 26809837b9 Update xcode project.
llvm-svn: 94654
2010-01-27 03:22:55 +00:00
Anders Carlsson 2a58948dc9 XFAIL this for now.
llvm-svn: 94653
2010-01-27 03:06:00 +00:00
Anders Carlsson 29f899dc6f Fix test/CodeGenCXX/default-destructor-synthesis.cpp not to rely on asm output.
llvm-svn: 94652
2010-01-27 03:03:08 +00:00
Anders Carlsson 483d08a25a Fix attr.cpp by not checking the generated assembler output.
llvm-svn: 94651
2010-01-27 02:49:52 +00:00
Mike Stump a04ecfb701 Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

This fixes 40% of all the problems remaining in one of my testcases.

llvm-svn: 94592
2010-01-26 21:35:27 +00:00
Anders Carlsson ca4a5459d8 Use the right definition when emitting a global variable. Fixes PR5564.
llvm-svn: 94555
2010-01-26 17:43:42 +00:00
Anders Carlsson d6b21e4842 If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
llvm-svn: 94525
2010-01-26 06:15:16 +00:00
Anders Carlsson 0b5f1ddf0a Fix another debug info crash with virtual bases.
llvm-svn: 94520
2010-01-26 05:26:39 +00:00
Anders Carlsson 17ed0496c5 Fix the test I broke, and also fix a crash when declaring a virtual destructor. Add debug info support for pure virtual member functions.
llvm-svn: 94519
2010-01-26 05:19:50 +00:00
Anders Carlsson 20bbbd489b Make sure to always mark a global variable as not being constant if it has a C++ initializer.
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Mike Stump 77537b136e Be sure to track the non-virtual part of the vcall offset in complex
multiple inheritance cases.  WIP.

This fixes 20% of the outstanding problems found by the randomized
tester.

llvm-svn: 94499
2010-01-26 03:42:22 +00:00
Mike Stump 90181eb294 Fixup a missing vcall entry. WIP.
llvm-svn: 94478
2010-01-26 00:05:04 +00:00
Fariborz Jahanian 210031b79c Fix a code gen. bug involving compiling global references.
(fixes radar 7574896).

llvm-svn: 94434
2010-01-25 18:30:26 +00:00
Alexis Hunt aecc45cb3c Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.

llvm-svn: 94352
2010-01-24 03:04:27 +00:00
Anders Carlsson 60ddba67a8 Fix a nasty bug where temporaries weren't marked as being conditional in some cases.
llvm-svn: 94341
2010-01-24 00:20:05 +00:00
Mike Stump 0978af83b3 Insulate these from changes to the default for -Wunreachable-code.
llvm-svn: 94326
2010-01-23 20:12:18 +00:00
Benjamin Kramer 20bac07abb Adjust testcase for recent AsmPrinter changes, sigh.
llvm-svn: 94307
2010-01-23 10:15:32 +00:00
Daniel Dunbar c766b8a1f4 Fix a FIXME, this test folds to a constant now.
llvm-svn: 94263
2010-01-23 00:26:29 +00:00
Mike Stump 1891698a9b Fixup the rest of the testcases to grep the .ll file instead of the .s
file, and add FIXMEs to the remaining broken tests.

llvm-svn: 94238
2010-01-22 22:37:17 +00:00
Mike Stump 3cd08d9df7 Convert more testcases to checking the .ll file instead of the .s file.
llvm-svn: 94229
2010-01-22 22:06:55 +00:00
Mike Stump 0a2754ed8a Be sure to select primary bases among the nearly empties in preorder,
not just among the direct bases.  Before we where missing nearly
empties that were bases of virtual base classes.

llvm-svn: 94208
2010-01-22 20:27:17 +00:00
Mike Stump 9eb76d47f2 Ensure we output all non-virtual base vtables. Fixes PR5890.
llvm-svn: 94163
2010-01-22 06:45:05 +00:00
Benjamin Kramer 2067816b3a Revert r94073, it fails in Release-Asserts builds.
llvm-svn: 94089
2010-01-21 18:14:21 +00:00
Benjamin Kramer d2eba45be3 Match branch labels with the trailing colon so we don't accidentally match something else.
llvm-svn: 94073
2010-01-21 15:19:14 +00:00
Chris Lattner 5e536d85ad allow this test to pass, even with the recent .s printer changes.
Have I ever mentioned that clang regtests should not be grepping .s files??

llvm-svn: 93998
2010-01-20 07:45:09 +00:00
Anders Carlsson 07894e8a0e More VTT builder fixes. With these fixes we now correctly handle the very complex VTT example from the Itanium ABI spec.
llvm-svn: 93725
2010-01-18 17:13:59 +00:00
Anders Carlsson 1af3df854f Fix a bunch of VTT layout bugs, add simple tests for VTT layout.
llvm-svn: 93709
2010-01-18 04:25:18 +00:00
Anders Carlsson 25933d4ecd Update virt.cpp for changes to the LLVM asm printer (?) This test should really be all LLVM IR...
llvm-svn: 93707
2010-01-18 03:58:13 +00:00
Eli Friedman 8fdc2cb46a Fix crash generating debug info for constructor for anonymous struct.
llvm-svn: 93601
2010-01-16 00:43:13 +00:00
Eli Friedman 1fcf66b0dd Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator.

llvm-svn: 93592
2010-01-16 00:00:48 +00:00
Eli Friedman cab014721b Fix a couple bugs in copy assignment operator synthesis.
llvm-svn: 93546
2010-01-15 20:06:11 +00:00
Mike Stump fc4daba5e0 Fix Release-Asserts for the time being.
llvm-svn: 93493
2010-01-15 00:50:35 +00:00
Mike Stump 6f0bf82622 Fix Release-Asserts.
llvm-svn: 93353
2010-01-13 21:23:04 +00:00
Mike Stump 8521f06ced Fix for Release-Assert.
llvm-svn: 93348
2010-01-13 20:58:35 +00:00
Mike Stump 2f7b246a47 Fix for Release-Asserts.
llvm-svn: 93347
2010-01-13 20:57:29 +00:00
Mike Stump 5c1e7259f1 Fix Release-Asserts.
llvm-svn: 93346
2010-01-13 20:43:31 +00:00
Chandler Carruth 04bdce6407 Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.

llvm-svn: 93252
2010-01-12 20:32:25 +00:00
Chris Lattner bb8976e36e implement codegen support for preinc as an lvalue, PR5514.
llvm-svn: 93076
2010-01-09 21:44:40 +00:00