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
Eli Friedman
5866fe306d
Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
...
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.
llvm-svn: 92976
2010-01-08 00:50:11 +00:00
Nuno Lopes
950d5b2cd3
fix PR5869: mangle static symbols like gcc does to make it easier to diff symbol tables
...
llvm-svn: 92911
2010-01-07 09:36:51 +00:00
Douglas Gregor
3a08dcc156
Test linkage of typeinfo and typeinfo names for class templates
...
llvm-svn: 92897
2010-01-07 04:09:30 +00:00
Douglas Gregor
d01472beee
Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.
...
llvm-svn: 92822
2010-01-06 04:50:56 +00:00
Douglas Gregor
1a68ab6c83
Make use of available_externally linkage for vtables when the
...
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.
llvm-svn: 92779
2010-01-05 21:40:05 +00:00
Douglas Gregor
a318efd1f2
Improve key-function computation for templates. In particular:
...
- All classes can have a key function; templates don't change that.
non-template classes when computing the key function.
- We always mark all of the virtual member functions of class
template instantiations.
- The vtable for an instantiation of a class template has weak
linkage.
We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.
llvm-svn: 92753
2010-01-05 19:06:31 +00:00
Anders Carlsson
a0b025e40f
When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
...
llvm-svn: 92680
2010-01-05 05:04:05 +00:00
Eli Friedman
50f6aa11cf
Improve coverage for test.
...
llvm-svn: 92440
2010-01-03 01:20:41 +00:00
Anders Carlsson
e36a6b3e44
Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.
...
llvm-svn: 92409
2010-01-02 01:01:18 +00:00
Anders Carlsson
2d21394190
If the key function of a record is inline, then the RTTI data should have weak_odr linkage.
...
llvm-svn: 92371
2009-12-31 19:36:25 +00:00
Anders Carlsson
bc7def9850
Remove rtti.cpp, it's very fragile and has been marked XFAIL for a while now. Between rtti-layout.cpp and rtti-linkage.cpp, RTTI testing should be covered.
...
llvm-svn: 92361
2009-12-31 17:44:32 +00:00
Anders Carlsson
a442499072
Fix a bunch of bugs with VMI RTTI building, and add a whole bunch of tests.
...
llvm-svn: 92319
2009-12-30 23:47:56 +00:00
Anders Carlsson
1e4cd33f13
Add base class checks.
...
llvm-svn: 92286
2009-12-30 01:29:05 +00:00
Anders Carlsson
a4bbe58c3b
Add more vtable tests.
...
llvm-svn: 92285
2009-12-30 01:25:42 +00:00
Anders Carlsson
ac2f681777
More RTTI cleanup, test that RTTI classes have the correct vtables.
...
llvm-svn: 92284
2009-12-30 01:00:12 +00:00
Anders Carlsson
ef88695860
Handle enum types as well.
...
llvm-svn: 92276
2009-12-29 22:13:01 +00:00
Anders Carlsson
26cf4ab8e2
Fix function type RTTI linkage and add tests.
...
llvm-svn: 92266
2009-12-29 20:20:19 +00:00
Sam Weinig
b999f68ed9
Fix for PR5871. Make __PRETTY_FUNCTION__ work for member functions defined in a class local to a function.
...
llvm-svn: 92200
2009-12-28 03:19:38 +00:00
Eli Friedman
e513c6af97
Fix runline.
...
llvm-svn: 92174
2009-12-27 05:59:41 +00:00
Eli Friedman
847a2bce04
Fix PointerExprEvaluator::VisitCastExpr so it doesn't misfold C++ casts which
...
it doesn't know how to fold, like derived-to-base casts.
llvm-svn: 92173
2009-12-27 05:43:15 +00:00
Sam Weinig
4e83bd2795
Fix for PR5872. Add static specifier and const/volatile qualifiers to member functions in __PRETTY_FUNCTION__ predefined expressions.
...
llvm-svn: 92171
2009-12-27 01:38:20 +00:00
Eli Friedman
fddc26cc64
Make copy constructor elimination work in more cases; the case in question
...
here affects clang-on-clang.
llvm-svn: 92151
2009-12-24 23:33:34 +00:00
Sam Weinig
07d211ea40
Fix for PR5844. Be explicit about anonymous struct/class/union/namespaces in __PRETTY_FUNCTION__ predefined expression.
...
llvm-svn: 92149
2009-12-24 23:15:03 +00:00
Douglas Gregor
363b151ff7
When transforming CXXExprWithTemporaries and CXXBindTemporaryExpr
...
expressions (e.g., for template instantiation), just transform the
subexpressions and return those, since the temporary-related nodes
will be implicitly regenerated. Fixes PR5867, but I said that
before...
llvm-svn: 92135
2009-12-24 18:51:59 +00:00
Douglas Gregor
f82bead3fd
InitializationSequence handles binding to temporaries, so that
...
argument-passing doesn't have to. Fixes PR5867, where we were binding
a temporary twice in the AST and, therefore, calling its destructor
twice.
llvm-svn: 92131
2009-12-24 17:16:46 +00:00
Anders Carlsson
a88d197284
Mangle block pointer types. Fixes PR5858.
...
llvm-svn: 92069
2009-12-23 22:31:44 +00:00
Douglas Gregor
247894b361
There is no such thing as typeinfo for a cv-qualified type. Assert
...
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.
llvm-svn: 92064
2009-12-23 22:04:40 +00:00
Douglas Gregor
f45f6828c6
Remove cv-qualifiers from the argument to typeid
...
llvm-svn: 92041
2009-12-23 20:51:04 +00:00
Anders Carlsson
910847c149
Mangle template template parameters. Fixes PR5861.
...
llvm-svn: 92030
2009-12-23 19:30:55 +00:00
Douglas Gregor
19fc0b753a
Make sure that reinterpret_cast gets a CastKind on all successful
...
paths. Fixes "cannot compile this unexpected cast lvalue yet" error in
llvm/lib/Analysis/IPA/GlobalsModRef.cpp.
llvm-svn: 91932
2009-12-22 22:47:22 +00:00
Anders Carlsson
8a35c7982c
Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity.
...
With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being).
llvm-svn: 91893
2009-12-22 06:36:32 +00:00
Daniel Dunbar
3780f0b680
x86_64: Structures with no fields but which have padding should be classified as
...
integer.
- This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
- PR5831.
llvm-svn: 91874
2009-12-22 01:19:25 +00:00
Douglas Gregor
4141d5bea2
When converting from a type to itself or one of its base classes via a
...
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.
llvm-svn: 91861
2009-12-22 00:21:20 +00:00
Anders Carlsson
9a98ac993f
Add tests for structs inside anonymous namespaces.
...
llvm-svn: 91806
2009-12-21 00:57:38 +00:00
Anders Carlsson
2b7f444366
Incomplete structs should also have internal linkage.
...
llvm-svn: 91805
2009-12-21 00:41:42 +00:00
Anders Carlsson
18e6ee1b20
Correcly handle pointers to member pointer types where the class or the pointee is incomplete.
...
llvm-svn: 91804
2009-12-20 23:37:55 +00:00
Anders Carlsson
d008129f34
Rework the way pointer types are handled by the RTTI builder. We now get the right linkage for indirect pointers to incomplete structs.
...
llvm-svn: 91799
2009-12-20 22:30:54 +00:00
Douglas Gregor
a4b592a7d5
Switch more of Sema::CheckInitializerTypes over to
...
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization).
Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.
llvm-svn: 91750
2009-12-19 03:01:41 +00:00
Anders Carlsson
6fda43f4c1
Correctly initialize the PrimaryBaseInfo if a base is null. Fixes PR5832.
...
llvm-svn: 91748
2009-12-19 02:13:41 +00:00
Eli Friedman
357e8c94d6
Fix for PR5524: make reference binding in default argument work correctly.
...
llvm-svn: 91733
2009-12-19 00:20:10 +00:00
Eli Friedman
726b878574
Test for r91724.
...
llvm-svn: 91730
2009-12-18 23:42:55 +00:00
Anders Carlsson
0087bc851c
Fix regression I introduced when dynamic_cast-ing to a reference type.
...
llvm-svn: 91687
2009-12-18 14:55:04 +00:00
Anders Carlsson
b396f43520
It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
...
llvm-svn: 91686
2009-12-18 14:42:03 +00:00
Douglas Gregor
e1314a64b8
Switch the initialization required by return statements over to the
...
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:
- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.
Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.
llvm-svn: 91669
2009-12-18 05:02:21 +00:00
Sean Callanan
12ca3f46d8
Testcase fixes to reflect instruction table changes in the LLVM backend
...
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html )
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.
* PR5050-constructor-conversion.cpp
* array-construction.cpp
* constructor-conversion.cpp
* cast-conversion.cpp
* constructor-default-arg.cpp
* derived-to-base-conv.cpp
* ptr-to-member-function.cpp
* call-arg-zero-temp.cpp
* default-destructor-synthesis.cpp
* global-array-destruction.cpp
* array-operator-delete-call.cpp
* decl-ref-init.cpp
* default-constructor-for-members.cpp
* convert-to-fptr.cpp
* constructor-for-array-members.cpp
* conversion-function.cpp
* objc-read-weak-byref.m
Fixed testcase to reflect call qualifier
llvm-svn: 91640
2009-12-18 00:04:09 +00:00
Nuno Lopes
641fdce235
revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz
...
llvm-svn: 91600
2009-12-17 10:15:49 +00:00
Anders Carlsson
539e584c3c
Attempt to fix rtti-layout.cpp on Linux.
...
llvm-svn: 91581
2009-12-17 04:57:25 +00:00
Anders Carlsson
dc9b9cf7b1
Add a (currently failing) RTTI layout test.
...
llvm-svn: 91580
2009-12-17 04:41:05 +00:00
Douglas Gregor
8cdc2e0590
Fix test case to unbreak testing
...
llvm-svn: 91551
2009-12-16 19:18:40 +00:00
Douglas Gregor
4f4b186215
When value-initializing a class with no user-defined constructors but
...
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.
llvm-svn: 91548
2009-12-16 18:50:27 +00:00
Anders Carlsson
d681a29ac0
Baby steps towards fixing PR5589. If a class needs a vtable pointer, add one.
...
llvm-svn: 91545
2009-12-16 17:27:20 +00:00
Nuno Lopes
13c88c7269
implement PR5654: add -fassume-sane-operator-new, which is enabled by default, and adds the malloc attribute to the global function new() and to the overloaded new operators.
...
feel free to chage the name to this lengthy argument
llvm-svn: 91543
2009-12-16 16:59:22 +00:00
Anders Carlsson
07863b8b6e
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
...
llvm-svn: 91520
2009-12-16 07:05:41 +00:00
Anders Carlsson
18ada9856f
Handle ImplicitValueInitExpr in AggExprEmitter.
...
llvm-svn: 91519
2009-12-16 06:57:54 +00:00
Anders Carlsson
b7e93e268f
Mangle CXXOperatorCallExprs, fixes PR5796.
...
llvm-svn: 91507
2009-12-16 05:48:46 +00:00
Daniel Dunbar
5618e98f33
Update tests to use %clang instead of 'clang', and forcibly disable use of '
...
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).
llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Daniel Dunbar
8fbe78f6fc
Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
...
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Eli Friedman
2151725325
Fix a small bug in ComputeMethodVtableIndices.
...
llvm-svn: 91411
2009-12-15 03:31:17 +00:00
Eli Friedman
8d83842761
Really fix this test.
...
llvm-svn: 91409
2009-12-15 03:22:41 +00:00
Eli Friedman
a2761ba52f
Fix test broken by my last commit.
...
llvm-svn: 91396
2009-12-15 02:20:06 +00:00
Douglas Gregor
db121bad2a
When rebuilding CXXConstructExprs after a transformation, use
...
CompleteConstructorCall to perform type-checking.
llvm-svn: 91279
2009-12-14 16:27:04 +00:00
Anders Carlsson
e66e2942fc
Mangle unary, binary and ternary expressions correctly.
...
llvm-svn: 91257
2009-12-14 01:45:37 +00:00
Eli Friedman
b095e15af4
Fix for PR5714: make sure globals that will be modified aren't marked const.
...
llvm-svn: 91156
2009-12-11 21:23:03 +00:00
Eli Friedman
3ace52b3a7
Fix linkage of type info and vtable for classes without linkage.
...
llvm-svn: 91152
2009-12-11 20:48:18 +00:00
Eli Friedman
75c9b97123
Make sure mangling doesn't crash in another case. Add some more tests.
...
llvm-svn: 91149
2009-12-11 20:21:38 +00:00
Eli Friedman
30e94d047e
Fix for PR5706: let mangleName deal with mangling names without identifiers
...
correctly.
llvm-svn: 91136
2009-12-11 18:00:57 +00:00
Anders Carlsson
b41a5c9308
XFAIL this for now, fixing linkage bugs causes the order of globals to change. Will fix later today.
...
llvm-svn: 91130
2009-12-11 17:01:29 +00:00
Anders Carlsson
a0b98f083a
Use GetAddrOfRTTI when getting the RTTI pointer for a base class.
...
llvm-svn: 91127
2009-12-11 16:37:06 +00:00
Eli Friedman
68396b16f6
Move the code for converting a member pointer to a bool so that it is usable
...
for logical not.
llvm-svn: 91112
2009-12-11 09:26:29 +00:00
Eli Friedman
1762cf2ad0
Fix for PR5718: implement equality comparisons for member function pointers.
...
llvm-svn: 91108
2009-12-11 07:36:43 +00:00
Anders Carlsson
fd7dfeb779
Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
...
llvm-svn: 91098
2009-12-11 02:46:30 +00:00
Eli Friedman
ad6c2e5b3a
Fix a recent regression from the initialization changes.
...
llvm-svn: 91097
2009-12-11 02:42:07 +00:00
Anders Carlsson
afd1edb52e
When an exception needs to be freed by calling __cxa_exception_free, make sure to stash away the exception pointer somewhere.
...
This fixes an "Instruction does not dominate all uses!" verification error when compiling TableGen.
llvm-svn: 91084
2009-12-11 00:32:37 +00:00
Eli Friedman
d70bbfd7d8
Support unary type traits in a scalar context. Not that I've actually seen
...
this construct, but might as well for completeness.
llvm-svn: 91071
2009-12-10 22:40:32 +00:00
Eli Friedman
ee275c82ff
Clean up enum constants so that they're finally sane. Fixes PR3173 and a
...
recently introduced crash.
llvm-svn: 91070
2009-12-10 22:29:29 +00:00
Anders Carlsson
781161dc55
Make sure that explicitly instantiated functions get the right linkage.
...
llvm-svn: 91069
2009-12-10 22:25:34 +00:00
Eli Friedman
d011893e86
Test for r90950.
...
llvm-svn: 91043
2009-12-10 08:51:23 +00:00
Anders Carlsson
a72ddd4609
Handle emitting static variables that have reference type.
...
llvm-svn: 91027
2009-12-10 01:05:11 +00:00
Mike Stump
25b20fc2ae
Add terminate handler for copy constructors for thrown objects. WIP.
...
llvm-svn: 90994
2009-12-09 23:31:35 +00:00
Douglas Gregor
3e1e527826
Reimplement reference initialization (C++ [dcl.init.ref]) using the
...
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.
Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:
p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
cannot bind to a value of unrelated type 'struct Base'
Derived &dr2 = b; // expected-error{{non-const lvalue reference to
...
^ ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
type 'struct Base const' drops qualifiers
Base &br3 = bc; // expected-error{{drops qualifiers}}
^ ~~
p5-var.cpp:57:15: error: ambiguous conversion from derived class
'struct Diamond' to base class 'struct Base':
struct Diamond -> struct Derived -> struct Base
struct Diamond -> struct Derived2 -> struct Base
Base &br5 = diamond; // expected-error{{ambiguous conversion from
...
^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
cannot bind to
a value of unrelated type 'int'
long &lr = i; // expected-error{{non-const lvalue reference to type
...
^ ~
p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
bind to a temporary of type 'struct Base'
Base &br1 = Base(); // expected-error{{non-const lvalue reference to
...
^ ~~~~~~
p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
int & ir1 = (ib.i); // expected-error{{non-const reference cannot
...
^ ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
int i : 17; // expected-note{{bit-field is declared here}}
^
llvm-svn: 90992
2009-12-09 23:02:17 +00:00
Eli Friedman
bb5008a32a
Fix for PR5707: make sure implicit copy constructors initialize the vtable
...
pointer.
llvm-svn: 90840
2009-12-08 06:46:18 +00:00
Eli Friedman
7316819fcf
Fix for PR5710: make sure to put function template specializations into the
...
DeclContext, so they don't completely disappear from the AST.
I don't particularly like this fix, but I don't see any obviously better way
to deal with it, and I think it's pretty clearly an improvement; comments
welcome.
llvm-svn: 90835
2009-12-08 05:40:03 +00:00
Eli Friedman
48c6b0d14f
Slight tweak to vtable linkage.
...
llvm-svn: 90832
2009-12-08 04:09:14 +00:00
Eli Friedman
f2c79b6b9c
Misc key function fixes.
...
llvm-svn: 90831
2009-12-08 03:56:49 +00:00
Eli Friedman
8aaff69e86
Fix some direct checks of expressions which might be surrounded by parentheses.
...
llvm-svn: 90825
2009-12-08 02:09:46 +00:00
Eli Friedman
cd6a50f3e5
Make copy assignment operator synthesis not explode for classes with complex
...
or non-record aggregate members.
It might be worth spending some time to optimize this code (and the parallel
code for copy constructors) to memcpy in larger chunks, rather than copying
one member at a time. Not sure exactly how beneficial that would be, but
it seems like could help for large classes with, for example, a vtable pointer
forcing the generation of a copy constructor.
llvm-svn: 90823
2009-12-08 01:57:53 +00:00
Anders Carlsson
220bf4fc5a
No need to add tail padding if the resulting LLVM struct type will have the same size as the final record size.
...
llvm-svn: 90820
2009-12-08 01:24:23 +00:00
Eli Friedman
f6c175b745
Correctly handle conditional operators involving throw.
...
llvm-svn: 90800
2009-12-07 20:25:53 +00:00
Anders Carlsson
1aaecfa02d
Mangle basic_ostream and basic_iostream specializations.
...
llvm-svn: 90794
2009-12-07 19:56:42 +00:00
Anders Carlsson
e1b3e6292a
It's OK to try to emit a vtable definition more than once. Fixes PR5697.
...
llvm-svn: 90751
2009-12-07 07:59:52 +00:00
Eli Friedman
d0e8de2cd8
Move RequireCompleteType requirement for fields early into ActOnField so that
...
subsequent code which depends on a complete type does the right thing.
llvm-svn: 90727
2009-12-07 00:22:08 +00:00
Sam Weinig
d060ed4d70
Don't print a void return type for C++ constructors and destructors when generating a predefined expr for them.
...
llvm-svn: 90725
2009-12-06 23:55:13 +00:00
Eli Friedman
8174f2c23c
Work-in-progess rewrite of thunks: move thunk generation outside of vtable
...
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.
llvm-svn: 90722
2009-12-06 22:01:30 +00:00
Anders Carlsson
3efc6e6f46
Add rudimentary support for member pointers to CGDebugInfo.
...
llvm-svn: 90711
2009-12-06 18:00:51 +00:00
Eli Friedman
eddf1213e2
Fix a slight oversight in computing whether a copy constructor is elidable.
...
Fixes PR5695.
llvm-svn: 90702
2009-12-06 09:26:33 +00:00
Anders Carlsson
232324c5c0
More linkage improvements.
...
llvm-svn: 90687
2009-12-06 00:53:22 +00:00
Anders Carlsson
0ab79e22ab
If a class does not have a key function, its linkage should be weak_odr.
...
llvm-svn: 90680
2009-12-05 22:24:38 +00:00
Anders Carlsson
58b271d450
Use createGlobalVariable for creating vtable variables too.
...
llvm-svn: 90679
2009-12-05 22:19:10 +00:00
Anders Carlsson
21bbc1e705
Factor vtable related GlobalVariable creation out into a separate function. Add vtable linkage test.
...
llvm-svn: 90667
2009-12-05 17:04:47 +00:00
Eli Friedman
0846d52f70
Tweak "key function" rules so that they work for templates with virtual
...
inline functions.
llvm-svn: 90645
2009-12-05 04:55:55 +00:00
Anders Carlsson
a30e1750cd
Don't emit explicit specializations of static member variable declarations.
...
llvm-svn: 90624
2009-12-04 23:50:01 +00:00
Anders Carlsson
cfb65d7432
Be a little more clever about inline member functions that are marked inline in the inline class declaration but not in the actual definition:
...
class A {
inline void f();
}
void A::f() { }
This is not the most ideal solution, since it doesn't work 100% with regular functions (as my FIXME comment states).
llvm-svn: 90607
2009-12-04 22:35:50 +00:00
Anders Carlsson
1f78b2bf62
Diagnose declarations of implicit member functions.
...
llvm-svn: 90605
2009-12-04 22:33:25 +00:00
Anders Carlsson
ce460529c0
When generating a virtual destructor, don't try to make a virtual call to the base class destructor because then we'll just re-enter the same destructor!
...
This was done to fix PR5619, so I went ahead and passed a dummy VTT pointer for now.
llvm-svn: 90578
2009-12-04 19:33:17 +00:00
Anders Carlsson
5c9e7b16a5
Correctly mangle the 'std' namespace inside extern "C++" blocks.
...
llvm-svn: 90544
2009-12-04 06:23:23 +00:00
Eli Friedman
d67751766b
Test for non-canonical decl and vtables.
...
llvm-svn: 90541
2009-12-04 04:30:55 +00:00
Eli Friedman
1d6fb1669c
Add recursion guards to ice-checking and evaluation for declrefs, so we
...
don't infinitely recurse for cases we can't evaluate.
llvm-svn: 90480
2009-12-03 20:31:57 +00:00
Anders Carlsson
ce2cd01647
Handle static_assert inside functions.
...
llvm-svn: 90461
2009-12-03 17:26:31 +00:00
Benjamin Kramer
70e39fe99c
Make test 64 bit safe.
...
llvm-svn: 90452
2009-12-03 13:09:24 +00:00
Eli Friedman
c339081c24
Fix for PR5659: correct a rather nasty oversight in the type conversion for
...
member pointer types.
llvm-svn: 90450
2009-12-03 12:44:31 +00:00
Eli Friedman
4039f35344
Fix thunk generation for thunks with a parameter with reference type.
...
llvm-svn: 90412
2009-12-03 04:49:52 +00:00
Eli Friedman
d4df7753d2
Fix for PR5522 and PR5666: fix a bunch of mangling issues with extern variables
...
and funcctions declared locally within a function.
llvm-svn: 90344
2009-12-02 20:32:49 +00:00
Eli Friedman
6393aac45e
Fix another "operator delete missing" crash: make sure we don't check
...
isVirtual() before we've actually calculated whether the destructor is
virtual.
llvm-svn: 90303
2009-12-02 07:16:50 +00:00
Eli Friedman
df76fe45e6
Tweak test to check for a bit more.
...
llvm-svn: 90302
2009-12-02 07:04:32 +00:00
Eli Friedman
81bce6b05e
Make sure to call AddOverriddenMethods for implicit copy assignment operators;
...
it's rare, but possible, for the difference to be significant.
llvm-svn: 90301
2009-12-02 06:59:20 +00:00
Fariborz Jahanian
4d9ab43f23
Fix a code gen. crash synthesizing a destructor.
...
Fixes pr5660.
llvm-svn: 90283
2009-12-01 23:18:25 +00:00
Fariborz Jahanian
b0cd26ad21
Test for my last patch.
...
llvm-svn: 90159
2009-11-30 22:07:56 +00:00
Daniel Dunbar
441e3729a5
Add missing assignment operator to test, and add tests for while loops and for
...
loops (including temporaries inside the initializers).
llvm-svn: 90151
2009-11-30 20:00:35 +00:00
Daniel Dunbar
7bd1048f26
Add more sophisticated test for destruction order of C++ temporaries, please
...
feel free to extend!
llvm-svn: 90143
2009-11-30 18:17:34 +00:00
Eli Friedman
78910a508a
Add a much more thorough test of casts to virtual bases, and fix
...
GetCXXBaseClassOffset to actually pass the test.
llvm-svn: 90025
2009-11-28 03:31:34 +00:00
Eli Friedman
2adc9abd51
Some member pointer casting tests.
...
llvm-svn: 89989
2009-11-27 04:56:40 +00:00
Eli Friedman
250534cf9a
Fix for PR5594: use EmitGlobalDefinition instead of EmitCXXDestructor so that
...
we check whether the vtable needs to be generated.
llvm-svn: 89984
2009-11-27 01:42:12 +00:00
Eli Friedman
84a7e347bf
Simplify and fix up the handling of implicit constructors, copy assignment
...
operators, and destructors. Avoids generating declarations/definitions of
trivial constructors/destructors, and makes sure the trivial copy assignment
operator is generated when necessary.
llvm-svn: 89943
2009-11-26 07:40:08 +00:00
Eli Friedman
d15eb34d4b
Implement IRGen for MemberExpr referring to static member function.
...
llvm-svn: 89938
2009-11-26 06:08:14 +00:00
Eli Friedman
f873c2fb68
Slight tweak to the algorithm for getLinkage().
...
llvm-svn: 89932
2009-11-26 03:04:01 +00:00
Eli Friedman
8a5f75ed5d
Use new getLinkage() method to correctly compute whether a variable has
...
internal linkage. Fixes PR5433.
llvm-svn: 89931
2009-11-26 02:52:12 +00:00
Anders Carlsson
82ba57c8f0
Add VTT parameter to base ctors/dtors with virtual bases. (They aren't used yet).
...
llvm-svn: 89835
2009-11-25 03:15:49 +00:00
Douglas Gregor
3d9e90ae3e
Implement proper cleanup semantics for condition variables in for
...
statements, e.g.,
for(; X x = X(); ) { ... }
Daniel or Anders, please review!
llvm-svn: 89832
2009-11-25 01:51:31 +00:00
Douglas Gregor
e05b765b0d
Tweak the code-generation-for-condition-variables test case to get to what we want to test
...
llvm-svn: 89818
2009-11-25 00:29:29 +00:00
Douglas Gregor
7bab5ff8e7
Eliminate CXXConditionDeclExpr with extreme prejudice.
...
All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).
Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting
Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.
llvm-svn: 89817
2009-11-25 00:27:52 +00:00
Douglas Gregor
680f861d74
Clean up the AST for while loops and fix several problems with
...
cleanups for while loops:
1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g.,
while (shared_ptr<WorkInt> p = getWorkItem()) {
// ...
}
2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g.,
while (blah)
RAIIObject raii(blah+1);
llvm-svn: 89800
2009-11-24 21:15:44 +00:00
Anders Carlsson
3c9beab48a
Handle references correctly when synthesizing copy constructors.
...
With this change, the clang-on-clang test result is now
Expected Passes : 224
Unexpected Failures: 37
Which means that we can compile over 80% of clang with clang! :)
llvm-svn: 89799
2009-11-24 21:08:10 +00:00
Fariborz Jahanian
831451b417
Fix the test case failed in buildbot.
...
llvm-svn: 89791
2009-11-24 19:37:10 +00:00
Anders Carlsson
3a202f601e
Handle cases where we're constructing an array of objects and the constructor has default arguments.
...
llvm-svn: 89783
2009-11-24 18:43:52 +00:00
Fariborz Jahanian
835026e9f1
Refactor collection of call arguments in common code.
...
Add support for variadic collection functions. More to do
here.
llvm-svn: 89781
2009-11-24 18:29:37 +00:00
Douglas Gregor
dcf1962405
Explicitly store the condition variable within switch statements, and
...
make sure that this variable is destroyed when we exit the switch
statement.
llvm-svn: 89776
2009-11-24 17:07:59 +00:00
Anders Carlsson
b9f96a3286
We always need to emit the base expression of a member expression, even when the member decl refers to an enum. Thanks to Eli for pointing this out!
...
llvm-svn: 89775
2009-11-24 16:57:33 +00:00
Anders Carlsson
b7408b95ed
Fix a crash when "instantiating" VarDecls that are neither type nor value dependent.
...
llvm-svn: 89774
2009-11-24 16:52:50 +00:00
Douglas Gregor
965f450d42
Introduce cleanup scopes for "if" statements in two places:
...
- Outside the "if", to ensure that we destroy the condition variable
at the end of the "if" statement rather than at the end of the
block containing the "if" statement.
- Inside the "then" and "else" branches, so that we emit then- or
else-local cleanups at the end of the corresponding block when the
block is not a compound statement.
To make adding these new cleanup scopes easier (and since
switch/do/while will all need the same treatment), added the
CleanupScope RAII object to introduce a new cleanup scope and make
sure it gets cleaned up.
llvm-svn: 89773
2009-11-24 16:43:22 +00:00
Anders Carlsson
bd97548f35
When mangling a ctor/dtor we need to take into consideration whether it's a member template.
...
llvm-svn: 89741
2009-11-24 05:36:32 +00:00
Anders Carlsson
0ade9715f2
Ignore constructor member templates in CodeGenModule::EmitTopLevelDecl.
...
llvm-svn: 89737
2009-11-24 05:16:24 +00:00
Anders Carlsson
6445773279
It is common for vtables to contain pointers to functions that have either incomplete return types or incomplete argument types.
...
Handle this by returning the llvm::OpaqueType for those cases, which CodeGenModule::GetOrCreateLLVMFunction knows about, and treats as being an "incomplete function".
llvm-svn: 89736
2009-11-24 05:08:52 +00:00
Anders Carlsson
f2e4f72f03
Don't try to treat an enum constant as an lvalue.
...
llvm-svn: 89705
2009-11-23 21:56:41 +00:00
Anders Carlsson
2e7bc11f11
Convert the && and || operands to bool using standard conversions. Fixes PR5593.
...
llvm-svn: 89704
2009-11-23 21:47:44 +00:00
Anders Carlsson
7fa434c2b8
Handle converting member pointers to bool.
...
llvm-svn: 89692
2009-11-23 20:04:44 +00:00
Sebastian Redl
22e2e5c423
Intercept sizeof and alignof references before they get into ASTContext methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590.
...
llvm-svn: 89668
2009-11-23 17:18:46 +00:00
Daniel Dunbar
e1cd0152a9
x86_64, PR5582: Layout bases for C++ records.
...
- Ideally we would have an single iteration interface for this, but this works
for now.
llvm-svn: 89632
2009-11-22 23:01:23 +00:00
Anders Carlsson
5838108317
Use EmitStoreOfScalar when copying the scalar to the space allocated by 'new'.
...
llvm-svn: 89613
2009-11-22 19:25:33 +00:00
Anders Carlsson
e18e29eeb9
Support emitting aggregate class initializers. Fixes PR5581.
...
llvm-svn: 89569
2009-11-21 23:56:04 +00:00
Daniel Dunbar
88ad4c5d02
Mangler: Sketch mangling for TemplateArgument::Declaration kind.
...
- Several important FIXMEs related to whether arguments are expressions or external names, and the mangling of extern "C" names (c.f., PR5522).
llvm-svn: 89556
2009-11-21 09:17:15 +00:00
Mike Stump
4d119e49f9
Add testcases for recent checkins.
...
llvm-svn: 89469
2009-11-20 18:51:28 +00:00