Benjamin Kramer
d5748c7b9d
Move private classes into anonymous namespaces
...
Also merge anonymous namespaces in Targets.cpp a bit. NFC.
llvm-svn: 232945
2015-03-23 12:31:05 +00:00
David Majnemer
a03849b2e7
MS ABI: Don't try to emit VF/VB-Tables for extern class templates
...
There will be an explicit template instantiation in another translation
unit which will provide the definition of the VF/VB-Tables.
This fixes PR22932.
llvm-svn: 232680
2015-03-18 22:04:43 +00:00
Reid Kleckner
1cbd9aa96d
Reland (2x) r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
...
This reverts commits r230477 and r230478.
llvm-svn: 230526
2015-02-25 19:17:48 +00:00
NAKAMURA Takumi
073f2b4795
Whitespace.
...
llvm-svn: 230478
2015-02-25 10:50:06 +00:00
NAKAMURA Takumi
e218a40a40
Revert r230448, "Reland r230314 "Fix codegen for virtual methods that are (re-) exported from multiple modules."", since I have reverted r230446.
...
llvm-svn: 230477
2015-02-25 10:49:59 +00:00
Reid Kleckner
64b04b9bdf
Reland r230314 "Fix codegen for virtual methods that are (re-) exported from multiple modules."
...
This reverts the revert from commit r230406.
The changes in r230445 and r230446 make the test pass on Windows now.
llvm-svn: 230448
2015-02-25 02:19:56 +00:00
Reid Kleckner
240ef5708e
Add missing MD canonicalization to MS vtable builder
...
llvm-svn: 230445
2015-02-25 02:16:02 +00:00
NAKAMURA Takumi
e976aab1df
Revert r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
...
It crashes for targeting (i686|x86_64)-win32.
clang: clang/lib/AST/VTableBuilder.cpp:142: {anonymous}::FinalOverriders::OverriderInfo {anonymous}::FinalOverriders::getOverrider(const clang::CXXMethodDecl*, clang::CharUnits) const: Assertion `OverridersMap.count(std::make_pair(MD, BaseOffset)) && "Did not find overrider!"' failed.
llvm-svn: 230406
2015-02-25 00:18:22 +00:00
Manuel Klimek
7906f139c3
Fix codegen for virtual methods that are (re-) exported from multiple modules.
...
Fixes multiple crashes where a non-canonical decl would be used as key
in a lookup.
llvm-svn: 230314
2015-02-24 09:06:28 +00:00
Nico Weber
cda5c7c764
Fix typo.
...
llvm-svn: 222964
2014-11-29 23:57:35 +00:00
David Blaikie
82e95a3c79
Update for LLVM API change to make Small(Ptr)Set::insert return pair<iterator, bool> as per the C++ standard's associative container concept.
...
llvm-svn: 222335
2014-11-19 07:49:47 +00:00
Timur Iskhodzhanov
7081460287
Minor readability tweaks to VFTableBuilder.cpp
...
llvm-svn: 222140
2014-11-17 15:53:50 +00:00
Timur Iskhodzhanov
7d19fc1c37
Add a couple more examples illustrating why we need vtordisps and how they work
...
llvm-svn: 222133
2014-11-17 15:11:05 +00:00
Timur Iskhodzhanov
4d28002728
Replace weird whitespace symbols with good old spaces
...
llvm-svn: 221997
2014-11-14 14:16:34 +00:00
Timur Iskhodzhanov
46a18efa5a
Add one illustrative class hierarchy as an example in a comment to the VFTableBuilder code
...
llvm-svn: 221996
2014-11-14 14:10:15 +00:00
Benjamin Kramer
ad8e079c61
Reduce double set lookups. NFC.
...
llvm-svn: 219504
2014-10-10 15:32:48 +00:00
David Majnemer
a9b7e661c8
MS ABI: Assert that vftables should have a non-RTTI entry
...
No functional change intended.
llvm-svn: 218506
2014-09-26 08:07:55 +00:00
Reid Kleckner
15fdcf19ba
Fix a vftable mangling bug
...
We need to walk the class hierarchy twice: once in depth-first base
specifier order for mangling and again in depth-first layout order for
vftable layout.
Vftable layout seems to depend on the full path from the most derived
class to the base containing the vfptr.
Fixes PR21031.
llvm-svn: 218285
2014-09-22 23:14:46 +00:00
David Majnemer
6e9ae7804b
MS ABI: Remove a FIXME that has been fixed
...
We've implemented MSVC-style RTTI for quite some time.
llvm-svn: 218269
2014-09-22 20:39:37 +00:00
David Majnemer
d59becbc07
MS ABI: The latest VC "14" CTP implements deleted virtual functions
...
Deleted virtual functions get _purecall inserted into the vftable.
Earlier CTPs would simply stick nullptr in there.
N.B. MSVC can't handle deleted virtual functions which require return
adjusting thunks, they give an error that a deleted function couldn't be
called inside of a compiler generated function. We get this correct by
making the thunk have a __purecall entry as well.
llvm-svn: 217654
2014-09-12 04:38:08 +00:00
Craig Topper
3cb91b2ad1
Fix some cases were ArrayRefs were being passed by reference.
...
llvm-svn: 216527
2014-08-27 06:28:16 +00:00
Timur Iskhodzhanov
16055e77b9
Fix PR20444 -- wrong number of vftable slots created when return adjustment thunks are needed
...
Reviewed at http://reviews.llvm.org/D4822
llvm-svn: 215312
2014-08-10 11:40:51 +00:00
Timur Iskhodzhanov
f97c973c2e
Fix PR20479 -- missing vftable slots in case of virtual inheritance vs return adjusting thunks
...
Reviewed at http://reviews.llvm.org/D4829
llvm-svn: 215285
2014-08-09 17:08:06 +00:00
David Majnemer
f607234fde
Driver: Handle /GR- in a compatible way with MSVC
...
There are slight differences between /GR- and -fno-rtti which made
mapping one to the other inappropriate.
-fno-rtti disables dynamic_cast, typeid, and does not emit RTTI related
information for the v-table.
/GR- does not generate complete object locators and thus will not
reference them in vftables. However, constructs like dynamic_cast and
typeid are permitted.
This should bring our implementation of RTTI up to semantic parity with
MSVC modulo bugs.
llvm-svn: 212138
2014-07-01 22:24:56 +00:00
David Majnemer
3c7228e468
AST: Small simplification in VTableBuilder
...
Stash whether or not we have an RTTI component away instead of
recomputing it.
llvm-svn: 212127
2014-07-01 21:10:07 +00:00
David Majnemer
d905da4a5f
MS ABI: Reference MSVC RTTI from the VFTable
...
The pointer for a class's RTTI data comes right before the VFTable but
has no name. To be properly compatible with this, we do the following:
* Create a single GlobalVariable which holds the contents of the VFTable
_and_ the pointer to the RTTI data.
* Create a GlobalAlias, with appropriate linkage/visibility, that points
just after the RTTI data pointer. This ensures that the VFTable
symbol will always refer to VFTable data.
* Create a Comdat with a "Largest" SelectionKind and stick the private
GlobalVariable in it. By transitivity, the GlobalAlias will be a
member of the Comdat group. Using "Largest" ensures that foreign
definitions without an RTTI data pointer will _not_ be chosen in the
final linked image.
Whether or not we emit RTTI data depends on several things:
* The -fno-rtti flag implies that we should never not emit a pointer to
RTTI data before the VFTable.
* __declspec(dllimport) brings in the VFTable from a remote DLL. Use an
available_externally GlobalVariable to provide a local definition of
the VFTable. This means that we won't have any available_externally
definitions of things like complete object locators. This is
acceptable because they are never directly referenced.
To my knowledge, this completes the implementation of MSVC RTTI code
generation.
Further semantic work should be done to properly support /GR-.
llvm-svn: 212125
2014-07-01 20:30:31 +00:00
Craig Topper
00bbdcf9b3
Remove llvm:: from uses of ArrayRef.
...
llvm-svn: 211987
2014-06-28 23:22:23 +00:00
Craig Topper
36250ad632
[C++11] Use 'nullptr'. AST edition.
...
llvm-svn: 208517
2014-05-12 05:36:57 +00:00
Nico Weber
d19e6a7e54
MicrosoftVTableContext: Don't leak VPtrInfos. Found by LSan, PR19522.
...
llvm-svn: 207138
2014-04-24 19:52:12 +00:00
Timur Iskhodzhanov
6b12850d27
Fix PR19487, PR19505 and PR19506 -- redundant vtordisp thunks when the final overrider is present in both a vbase and nvbase
...
Reviewed at http://reviews.llvm.org/D3449
llvm-svn: 206908
2014-04-22 17:32:02 +00:00
Reid Kleckner
fd385407fa
MS ABI: Don't append to vbtables that we shouldn't extend
...
This was probably a benign bug, since nobody would look at the vbtable
slots that we were filling in.
llvm-svn: 206508
2014-04-17 22:47:52 +00:00
Timur Iskhodzhanov
ed11ae3d21
Follow-up to r206457 -- fix static adjustments for some subtle virtual inheritance cases
...
Reviewed at http://reviews.llvm.org/D3410
llvm-svn: 206504
2014-04-17 22:01:48 +00:00
Timur Iskhodzhanov
057fa3a5a5
Fix PR19408 - Missing static this adjustment in a vtordisp thunk
...
Also fix a few other vtordisp-related bugs.
Reviewed at http://reviews.llvm.org/D3400
llvm-svn: 206457
2014-04-17 11:01:41 +00:00
Timur Iskhodzhanov
9ae7d3bd5f
Slightly improve the readability of MicrosoftVTableContext::computeVTablePaths(). No functionality changes.
...
llvm-svn: 205178
2014-03-31 11:01:51 +00:00
Timur Iskhodzhanov
1523c610c9
Make the 'for (auto ...)' names more readable
...
llvm-svn: 204787
2014-03-26 08:22:48 +00:00
Timur Iskhodzhanov
dd0a27664d
Fix PR19066 - 0-sized vftable in the presence of virtual inheritance
...
Reviewed at http://llvm-reviews.chandlerc.com/D3181
llvm-svn: 204786
2014-03-26 08:12:53 +00:00
Reid Kleckner
d0fe317e0c
MS ABI: Mark direct virtual bases as visted when building vtable paths
...
Fixes PR19240. In retrospect, this is a fairly obvious bug. :)
llvm-svn: 204744
2014-03-25 18:33:27 +00:00
Timur Iskhodzhanov
ba5570221d
Fix PR19172 - wrong this adjustment calculated for virtual destructor in a class with complex inheritance
...
Reviewed at http://llvm-reviews.chandlerc.com/D3128
llvm-svn: 204394
2014-03-20 20:38:34 +00:00
Timur Iskhodzhanov
4fea4f917d
Flust stdout after each vftable dumped to simplify debugging
...
llvm-svn: 204341
2014-03-20 13:42:14 +00:00
Aaron Ballman
2b124d1a5d
[C++11] Replacing CXXRecordDecl iterators method_begin() and method_end() with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops.
...
llvm-svn: 203812
2014-03-13 16:36:16 +00:00
Aaron Ballman
445a939db8
[C++11] Replacing CXXRecordDecl iterators vbases_begin() and vbases_end() with iterator_range vbases(). Updating all of the usages of the iterators with range-based for loops.
...
llvm-svn: 203808
2014-03-13 16:15:17 +00:00
Aaron Ballman
574705ed7f
[C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with iterator_range bases(). Updating all of the usages of the iterators with range-based for loops.
...
llvm-svn: 203803
2014-03-13 15:41:46 +00:00
Benjamin Kramer
15ae783e14
[C++11] Convert sort predicates into lambdas.
...
No functionality change.
llvm-svn: 203289
2014-03-07 21:35:40 +00:00
Timur Iskhodzhanov
a895758203
Fix PR18967 -- Bad this adjustment for virtual methods in a diamond virtual inheritance hierarchy
...
llvm-svn: 203222
2014-03-07 09:34:59 +00:00
Timur Iskhodzhanov
77764b6d4c
Style fix: replace "1 entries" with "1 entry" in the vftable layout dumping code
...
llvm-svn: 202978
2014-03-05 13:54:07 +00:00
Timur Iskhodzhanov
3a9ac93478
First step towards fixing PR18967 - simplify the ComputeThisOffset interface
...
llvm-svn: 202870
2014-03-04 18:17:38 +00:00
Benjamin Kramer
a741b8c451
[C++11] Simplify compare operators with std::tie.
...
No functionality change.
llvm-svn: 202755
2014-03-03 20:26:46 +00:00
Benjamin Kramer
867ea1d426
[C++11] Replace llvm::tie with std::tie.
...
llvm-svn: 202639
2014-03-02 13:01:17 +00:00
Benjamin Kramer
bbdd7640e8
[C++11] Replace verbose functors with succinct lambdas
...
No functionality change.
llvm-svn: 202590
2014-03-01 14:48:57 +00:00
Reid Kleckner
3331128994
Fix leak in MicrosoftVTableContext
...
llvm-svn: 202558
2014-02-28 23:26:22 +00:00