Commit Graph

31 Commits

Author SHA1 Message Date
Rafael Espindola c3cde36ead Output destructors and constructors in a more natural order.
With this patch we output the in the order
C2
C1

D2
D1
D0

Which means that a destructor or constructor that call another is output after
the callee. This is a bit easier to read IHMO and a tiny bit more efficient
as we don't put a decl in DeferredDeclsToEmit.

llvm-svn: 196784
2013-12-09 14:51:17 +00:00
Stephen Lin 4362261b00 CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail.
llvm-svn: 188447
2013-08-15 06:47:53 +00:00
Peter Collingbourne 71c26936a0 Remove CodeGenVTables::ComputeVTableRelatedInformation dependency on CodeGen
llvm-svn: 140503
2011-09-26 01:56:36 +00:00
Chris Lattner a5f58b05e8 clang side to match the LLVM IR type system rewrite patch.
llvm-svn: 134831
2011-07-09 17:41:47 +00:00
Anders Carlsson d6f1518cc9 Fix another regression from the "skip vtable pointer initialization"
optimization. Make sure to require a vtable when trying to get the address
of a VTT, otherwise we would never end up emitting the VTT.

llvm-svn: 131400
2011-05-16 04:08:36 +00:00
Anders Carlsson 49c0bd2a25 Re-enable the fix for PR9181 now that all the edge cases are handled.
llvm-svn: 131385
2011-05-15 17:36:21 +00:00
Anders Carlsson b55c8c127e Disable the optimization until the bug noticed by Sean Hunt has been fixed.
llvm-svn: 131372
2011-05-15 01:50:14 +00:00
Anders Carlsson 9bd7d16440 When emitting the destructor for a class with a vtable, if we can determine
that the destructor body is trivial and that all member variables also have either
trivial destructors or trivial destructor bodies, we don't need to initialize the
vtable pointers since no virtual member functions will be called on the destructor.

Fixes PR9181.

llvm-svn: 131368
2011-05-14 23:26:09 +00:00
John McCall 358d056c14 We were emitting construction v-tables with internal linkage all the time.
Emit them instead with the linkage of the VTT.

I'm actually really ambivalent about this;  it's what GCC does, but outside
of improving code size (if the linkage is coalescing), I'm not sure it's
at all relevant.  Construction vtables are naturally referenced only by the
VTT, which is itself only referenced by complete-object constructors and
destructors;  giving the construction vtables possibly-external linkage is
important if you have an optimization that drills through the VTT to a
reference to a particular construction vtable which it cannot just emit
itself.

llvm-svn: 128374
2011-03-27 09:00:25 +00:00
Anders Carlsson 883fc72c3c Make emitting a VTT a two-step process, much like emitting a VTable. You first get the address of the VTT, and then pass it to EmitVTTDefinition.
llvm-svn: 124539
2011-01-29 19:16:51 +00:00
Rafael Espindola 05842dabb8 Move unnamed_addr after the function arguments on Sabre's request.
llvm-svn: 124210
2011-01-25 19:10:24 +00:00
Anders Carlsson 571e2ad042 Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.

llvm-svn: 124089
2011-01-24 00:46:19 +00:00
Rafael Espindola bb7f7686c5 Set unnamed_addr in VTTs.
llvm-svn: 123280
2011-01-11 22:29:55 +00:00
Rafael Espindola 5674c644cf Add unnamed_addr to vtables.
llvm-svn: 123272
2011-01-11 21:10:26 +00:00
Rafael Espindola 0ee986c1f1 Add unnamed_addr to constructors and destructors.
llvm-svn: 123197
2011-01-11 00:26:26 +00:00
John McCall 5513fce96b It turns out that linkers (at least, the Darwin linker) don't necessarily
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere).  447.dealII actually does this.

I've put the code under an option that's currently not hooked up to anything.

llvm-svn: 110374
2010-08-05 20:39:18 +00:00
John McCall 8a705c15d9 Extend the hidden-visibility vtables optimization to template classes that
haven't been explicitly instantiated.

llvm-svn: 110189
2010-08-04 06:38:15 +00:00
Anders Carlsson b4d2cdbb46 Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
llvm-svn: 105330
2010-06-02 15:58:27 +00:00
Douglas Gregor 0094eb26fc Be sure to use the standard substitutions when mangling the names of
vtables, VTTs, and construction vtables. Fixes PR7201.

llvm-svn: 104675
2010-05-26 05:11:13 +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
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 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 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
Anders Carlsson 1aaecfa02d Mangle basic_ostream and basic_iostream specializations.
llvm-svn: 90794
2009-12-07 19:56:42 +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
Anders Carlsson 3482b819db Mangle std::basic_ostream<char, std::char_traits<char>> as So.
llvm-svn: 83557
2009-10-08 17:20:26 +00:00
Anders Carlsson 025893300c Remove PR5061 workaround.
llvm-svn: 83046
2009-09-29 05:36:21 +00:00
Anders Carlsson 2e5935241a Mangle std::basic_string<char, std::char_traits<char>, std::allocator<char> > as Ss.
llvm-svn: 82882
2009-09-27 00:12:57 +00:00
Anders Carlsson 853bb50382 Mangle ::std::basic_string as Sb.
llvm-svn: 82881
2009-09-26 23:14:39 +00:00
Anders Carlsson 872ce0dc31 Mangle ::std::allocator as Sa.
llvm-svn: 82880
2009-09-26 23:10:05 +00:00
Anders Carlsson aa9e3c8793 Substitute "::std::" as "St".
llvm-svn: 82874
2009-09-26 20:53:44 +00:00