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