aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-09-01 23:22:44 +0000
committerMike Stump <mrs@apple.com>2009-09-01 23:22:44 +0000
commitf9a883c27e3b5724a5a59499691fa109eb5032f8 (patch)
treee7c4a6ed720956badee555c2b36d7075c87ee301 /lib/CodeGen/CGCXX.cpp
parenta4ad5ab45fb0990a5076614f3cfc2eae30ab9755 (diff)
More overriding base work and some cleanups. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 97837b364a..9e59a0a5a2 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -930,10 +930,20 @@ public:
return false;
}
+ void OverrideMethods(const CXXRecordDecl *RD, Index_t AddressPoint,
+ bool MorallyVirtual, Index_t Offset) {
+ for (method_iter mi = RD->method_begin(), me = RD->method_end(); mi != me;
+ ++mi)
+ if (mi->isVirtual()) {
+ const CXXMethodDecl *MD = *mi;
+ llvm::Constant *m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), Ptr8Ty));
+ OverrideMethod(MD, m, MorallyVirtual, Offset);
+ }
+ }
+
void AddMethod(const CXXMethodDecl *MD, Index_t AddressPoint,
bool MorallyVirtual, Index_t Offset) {
- llvm::Constant *m;
- m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), Ptr8Ty));
+ llvm::Constant *m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), Ptr8Ty));
if (OverrideMethod(MD, m, MorallyVirtual, Offset))
return;
@@ -953,19 +963,17 @@ public:
submethods.push_back(m);
}
- void GenerateMethods(const CXXRecordDecl *RD, Index_t AddressPoint,
- bool MorallyVirtual, Index_t Offset) {
+ void AddMethods(const CXXRecordDecl *RD, Index_t AddressPoint,
+ bool MorallyVirtual, Index_t Offset) {
for (method_iter mi = RD->method_begin(), me = RD->method_end(); mi != me;
++mi)
if (mi->isVirtual())
AddMethod(*mi, AddressPoint, MorallyVirtual, Offset);
}
- int64_t GenerateVtableForBase(const CXXRecordDecl *RD,
- bool forPrimary, bool Bottom,
- bool MorallyVirtual,
- int64_t Offset,
- bool ForVirtualBase) {
+ int64_t GenerateVtableForBase(const CXXRecordDecl *RD, bool forPrimary,
+ bool Bottom, bool MorallyVirtual,
+ int64_t Offset, bool ForVirtualBase) {
llvm::Constant *m = llvm::Constant::getNullValue(Ptr8Ty);
int64_t AddressPoint=0;
@@ -995,7 +1003,7 @@ public:
}
// And add the virtuals for the class to the primary vtable.
- GenerateMethods(RD, AddressPoint, MorallyVirtual, Offset);
+ AddMethods(RD, AddressPoint, MorallyVirtual, Offset);
if (!Bottom)
return AddressPoint;
@@ -1022,14 +1030,7 @@ public:
methods.push_back(*i);
}
- int64_t BaseOffset;
- if (ForVirtualBase) {
- BaseOffset = -(BLayout.getVBaseClassOffset(RD) / 8);
- // FIXME: The above is redundant with the other case.
- assert(BaseOffset == -Offset/8);
- } else
- BaseOffset = -Offset/8;
- m = wrap(BaseOffset);
+ m = wrap(-(Offset/8));
methods.push_back(m);
methods.push_back(rtti);
AddressPoint = methods.size();