summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGCXXABI.h6
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp16
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp2
3 files changed, 17 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h
index 8c0f6c2efd5..9e10ec068e0 100644
--- a/clang/lib/CodeGen/CGCXXABI.h
+++ b/clang/lib/CodeGen/CGCXXABI.h
@@ -336,6 +336,12 @@ public:
virtual void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy,
FunctionArgList &Params) = 0;
+ /// Get the ABI-specific "this" parameter adjustment to apply in the prologue
+ /// of a virtual function.
+ virtual CharUnits getVirtualFunctionPrologueThisAdjustment(GlobalDecl GD) {
+ return CharUnits::Zero();
+ }
+
/// Perform ABI-specific "this" parameter adjustment in a virtual function
/// prologue.
virtual llvm::Value *adjustThisParameterInVirtualFunctionPrologue(
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ab0ee6cdbe9..13461980a4b 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1206,6 +1206,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
unsigned Virtuality = 0;
unsigned VIndex = 0;
unsigned Flags = 0;
+ int ThisAdjustment = 0;
if (Method->isVirtual()) {
if (Method->isPure())
@@ -1235,9 +1236,12 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
if (Method->begin_overridden_methods() == Method->end_overridden_methods())
Flags |= llvm::DINode::FlagIntroducedVirtual;
- // FIXME: Pass down ML.VFPtrOffset and ML.VBTableIndex. The debugger needs
- // these to synthesize a call to a virtual method in a complex inheritance
- // hierarchy.
+ // The 'this' adjustment accounts for both the virtual and non-virtual
+ // portions of the adjustment. Presumably the debugger only uses it when
+ // it knows the dynamic type of an object.
+ ThisAdjustment = CGM.getCXXABI()
+ .getVirtualFunctionPrologueThisAdjustment(GD)
+ .getQuantity();
}
ContainingType = RecordTy;
}
@@ -1263,9 +1267,9 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
llvm::DINodeArray TParamsArray = CollectFunctionTemplateParams(Method, Unit);
llvm::DISubprogram *SP = DBuilder.createMethod(
RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine,
- MethodTy, /*isLocalToUnit=*/false,
- /* isDefinition=*/false, Virtuality, VIndex, ContainingType, Flags,
- CGM.getLangOpts().Optimize, TParamsArray.get());
+ MethodTy, /*isLocalToUnit=*/false, /*isDefinition=*/false, Virtuality,
+ VIndex, ThisAdjustment, ContainingType, Flags, CGM.getLangOpts().Optimize,
+ TParamsArray.get());
SPCache[Method->getCanonicalDecl()].reset(SP);
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 31bfbf0cdfb..e86d7eb7735 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -551,7 +551,7 @@ private:
return llvm::Constant::getAllOnesValue(CGM.IntTy);
}
- CharUnits getVirtualFunctionPrologueThisAdjustment(GlobalDecl GD);
+ CharUnits getVirtualFunctionPrologueThisAdjustment(GlobalDecl GD) override;
void
GetNullMemberPointerFields(const MemberPointerType *MPT,
OpenPOWER on IntegriCloud