Skip to content

Commit fc1cb80

Browse files
committed
Work around vtable index issue due to base class definition being replaced by later PCM.
Mark llvm/clang patch by putting it into a separate ROOT-patches dir; makes it easier to revert later. git-svn-id: http://root.cern.ch/svn/root/trunk@46281 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent ecb8da6 commit fc1cb80

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Index: tools/clang/lib/AST/VTableBuilder.cpp
2+
===================================================================
3+
--- tools/clang/lib/AST/VTableBuilder.cpp (revision 46280)
4+
+++ tools/clang/lib/AST/VTableBuilder.cpp (working copy)
5+
@@ -1160,7 +1160,8 @@
6+
continue;
7+
}
8+
9+
- if (MD->getParent() == MostDerivedClass)
10+
+ if (MD->getParent()->getCanonicalDecl()
11+
+ == MostDerivedClass->getCanonicalDecl())
12+
AddThunk(MD, Thunk);
13+
}
14+
}
15+
@@ -1353,7 +1354,8 @@
16+
17+
// If the overrider is the first base in the primary base chain, we know
18+
// that the overrider will be used.
19+
- if (Overrider->getParent() == FirstBaseInPrimaryBaseChain)
20+
+ if (Overrider->getParent()->getCanonicalDecl()
21+
+ == FirstBaseInPrimaryBaseChain->getCanonicalDecl())
22+
return true;
23+
24+
VTableBuilder::PrimaryBasesSetVectorTy PrimaryBases;
25+
@@ -1417,7 +1419,8 @@
26+
const CXXMethodDecl *OverriddenMD = *I;
27+
28+
// We found our overridden method.
29+
- if (OverriddenMD->getParent() == PrimaryBase)
30+
+ if (OverriddenMD->getParent()->getCanonicalDecl()
31+
+ == PrimaryBase->getCanonicalDecl())
32+
return OverriddenMD;
33+
}
34+
}
35+
@@ -1512,7 +1515,8 @@
36+
Overrider);
37+
38+
if (ThisAdjustment.VCallOffsetOffset &&
39+
- Overrider.Method->getParent() == MostDerivedClass) {
40+
+ Overrider.Method->getParent()->getCanonicalDecl()
41+
+ == MostDerivedClass->getCanonicalDecl()) {
42+
43+
// There's no return adjustment from OverriddenMD and MD,
44+
// but that doesn't mean there isn't one between MD and

interpreter/llvm/src/tools/clang/lib/AST/VTableBuilder.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,8 @@ void VTableBuilder::ComputeThisAdjustments() {
11601160
continue;
11611161
}
11621162

1163-
if (MD->getParent() == MostDerivedClass)
1163+
if (MD->getParent()->getCanonicalDecl()
1164+
== MostDerivedClass->getCanonicalDecl())
11641165
AddThunk(MD, Thunk);
11651166
}
11661167
}
@@ -1353,7 +1354,8 @@ VTableBuilder::IsOverriderUsed(const CXXMethodDecl *Overrider,
13531354

13541355
// If the overrider is the first base in the primary base chain, we know
13551356
// that the overrider will be used.
1356-
if (Overrider->getParent() == FirstBaseInPrimaryBaseChain)
1357+
if (Overrider->getParent()->getCanonicalDecl()
1358+
== FirstBaseInPrimaryBaseChain->getCanonicalDecl())
13571359
return true;
13581360

13591361
VTableBuilder::PrimaryBasesSetVectorTy PrimaryBases;
@@ -1417,7 +1419,8 @@ FindNearestOverriddenMethod(const CXXMethodDecl *MD,
14171419
const CXXMethodDecl *OverriddenMD = *I;
14181420

14191421
// We found our overridden method.
1420-
if (OverriddenMD->getParent() == PrimaryBase)
1422+
if (OverriddenMD->getParent()->getCanonicalDecl()
1423+
== PrimaryBase->getCanonicalDecl())
14211424
return OverriddenMD;
14221425
}
14231426
}
@@ -1512,7 +1515,8 @@ VTableBuilder::AddMethods(BaseSubobject Base, CharUnits BaseOffsetInLayoutClass,
15121515
Overrider);
15131516

15141517
if (ThisAdjustment.VCallOffsetOffset &&
1515-
Overrider.Method->getParent() == MostDerivedClass) {
1518+
Overrider.Method->getParent()->getCanonicalDecl()
1519+
== MostDerivedClass->getCanonicalDecl()) {
15161520

15171521
// There's no return adjustment from OverriddenMD and MD,
15181522
// but that doesn't mean there isn't one between MD and

0 commit comments

Comments
 (0)