Commit Graph

157 Commits

Author SHA1 Message Date
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
Mike Stump 1f49d65235 Finish off fixing up debug information.
llvm-svn: 94193
2010-01-22 18:48:47 +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
Mike Stump d2808449e4 Update debugging code.
llvm-svn: 94145
2010-01-22 02:51:26 +00:00
Anders Carlsson f768db7775 Move the VTT related code into its own file, CGVTT.cpp
llvm-svn: 94079
2010-01-21 16:50:45 +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 3d1a09552c Move some common code into BuildVTT.
llvm-svn: 93710
2010-01-18 04:45:46 +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 827b245fd6 Minor VTT builder cleanup, no functionality change.
llvm-svn: 93696
2010-01-17 23:53:20 +00:00
Anders Carlsson 42f1376f35 Get the ctor vtable address points directly from the VTT builder.
llvm-svn: 93681
2010-01-17 17:10:44 +00:00
Anders Carlsson 5f9a881e1e Store the address points for constructor vtables directly in the VTT builder, because that's the only time they're needed.
llvm-svn: 93412
2010-01-14 02:29:07 +00:00
Douglas Gregor ccecc1bb43 Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
llvm-svn: 92855
2010-01-06 20:27:16 +00:00
Daniel Dunbar a671c2a9fe Fix (invalid) may-be-uninitialized warning.
llvm-svn: 92828
2010-01-06 07:13:04 +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
Mike Stump 81478719a7 Reorder to avoid invalidating idx which is an accessor into VCall.
llvm-svn: 92819
2010-01-06 03:09:19 +00:00
Douglas Gregor 26751ffc53 Silence bogus GCC warning
llvm-svn: 92787
2010-01-05 21:55:26 +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 93a1884fde Move address points to CGVtableInfo, no functionality change.
llvm-svn: 92420
2010-01-02 18:02:32 +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 27da15ba8e Move a few more functions away from CGCXX and to CGClass and CGExprCXX.
llvm-svn: 92399
2010-01-01 20:29:01 +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
Mike Stump d538a6d364 Remove some dead code.
llvm-svn: 92123
2009-12-24 07:29:41 +00:00
Anders Carlsson 3f4336cb1f Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
llvm-svn: 91590
2009-12-17 07:09:17 +00:00
Eli Friedman 2151725325 Fix a small bug in ComputeMethodVtableIndices.
llvm-svn: 91411
2009-12-15 03:31:17 +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
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 48c6b0d14f Slight tweak to vtable linkage.
llvm-svn: 90832
2009-12-08 04:09:14 +00:00
Eli Friedman 31bc3ad275 A bunch more thunk fixes from misc testing.
(Yes, I do intend to commit some tests for this.)

llvm-svn: 90818
2009-12-07 23:56:34 +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 c0dacee1e0 Erm, revert for the moment; I didn't test this as thoroughly as I should have
(although it does pass regression tests).

llvm-svn: 90747
2009-12-07 04:45:50 +00:00
Eli Friedman c5d3a6ae3d Tweak the formula for non-virtual offsets to something which appears a bit
more accurate.

llvm-svn: 90746
2009-12-07 04:38:34 +00:00
Anders Carlsson 5ebf8b44e9 Move key functions to a separate map.
llvm-svn: 90745
2009-12-07 04:35:11 +00:00
Eli Friedman f2eda5efd2 Be a bit more complete about accumulating SavedThisAdjustments.
llvm-svn: 90723
2009-12-06 22:33:51 +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 fe5f7d916f Set the correct linkage for VTTs as well.
llvm-svn: 90689
2009-12-06 01:09:21 +00:00
Anders Carlsson 232324c5c0 More linkage improvements.
llvm-svn: 90687
2009-12-06 00:53:22 +00:00
Anders Carlsson 0911ae8ef2 Pass the desired vtable linkage to GenerateVtable directly. Only call MaybeMarkVirtualImplicitMembersReferenced for non-inline functions.
llvm-svn: 90686
2009-12-06 00:23:49 +00:00
Anders Carlsson 7e28c5f2e2 Make GenerateVtable a private member function of CGVtableInfo.
llvm-svn: 90684
2009-12-06 00:01:05 +00:00
Anders Carlsson 4ed44eb7d9 Only emit the vtable definition if the class has a key function and we're emitting it, or if the class doesn't have a key function and we are emitting the complete constructor.
llvm-svn: 90681
2009-12-05 22:42:54 +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 b3f54b748d CodeGenModule::GenerateVtable now returns a pointer directly to the vtable and not to the address point.
llvm-svn: 90676
2009-12-05 21:28:12 +00:00
Anders Carlsson a95d4c51dc Make sure that hte vtable always has an i8* array type.
llvm-svn: 90675
2009-12-05 21:09:05 +00:00
Anders Carlsson c8e39ec79f Add a function for getting the vtable address point of a class.
llvm-svn: 90674
2009-12-05 21:03:56 +00:00
Anders Carlsson b694f05ffb Simplify BuildVTT.
llvm-svn: 90673
2009-12-05 21:02:25 +00:00
Anders Carlsson b78d093fcc Let the VTT builder pretend that getVtable returns a pointer to the vtable and not to the vtable address point.
llvm-svn: 90672
2009-12-05 20:58:49 +00:00
Anders Carlsson 78c2898e02 Change getCtorVtable to not return the address point offset, but the global variable.
llvm-svn: 90671
2009-12-05 20:42:53 +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