[codeview] Add DISubprogram::ThisAdjustment
Summary:
This represents the adjustment applied to the implicit 'this' parameter
in the prologue of a virtual method in the MS C++ ABI. The adjustment is
always zero unless multiple inheritance is involved.
This increases the size of DISubprogram by 8 bytes, unfortunately. The
adjustment really is a signed 32-bit integer. If this size increase is
too much, we could probably win it back by splitting out a subclass with
info specific to virtual methods (virtuality, vindex, thisadjustment,
containingType).
Reviewers: aprantl, dexonsmith
Subscribers: aaboud, amccarth, llvm-commits
Differential Revision: http://reviews.llvm.org/D21614
llvm-svn: 274325
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index ce16fdd..faf6bf7 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -667,8 +667,8 @@
auto *Node = getSubprogram(
/* IsDistinct = */ isDefinition, VMContext,
getNonCompileUnitScope(Context), Name, LinkageName, File, LineNo, Ty,
- isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
- isDefinition ? CUNode : nullptr, TParams, Decl,
+ isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, 0, Flags,
+ isOptimized, isDefinition ? CUNode : nullptr, TParams, Decl,
MDTuple::getTemporary(VMContext, None).release());
if (isDefinition)
@@ -685,8 +685,8 @@
return DISubprogram::getTemporary(
VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, nullptr,
- 0, 0, Flags, isOptimized, isDefinition ? CUNode : nullptr, TParams,
- Decl, nullptr)
+ 0, 0, 0, Flags, isOptimized, isDefinition ? CUNode : nullptr,
+ TParams, Decl, nullptr)
.release();
}
@@ -694,8 +694,9 @@
DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
DIFile *F, unsigned LineNo, DISubroutineType *Ty,
bool isLocalToUnit, bool isDefinition, unsigned VK,
- unsigned VIndex, DIType *VTableHolder, unsigned Flags,
- bool isOptimized, DITemplateParameterArray TParams) {
+ unsigned VIndex, int ThisAdjustment,
+ DIType *VTableHolder, unsigned Flags, bool isOptimized,
+ DITemplateParameterArray TParams) {
assert(getNonCompileUnitScope(Context) &&
"Methods should have both a Context and a context that isn't "
"the compile unit.");
@@ -703,7 +704,7 @@
auto *SP = getSubprogram(
/* IsDistinct = */ isDefinition, VMContext, cast<DIScope>(Context), Name,
LinkageName, F, LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
- VTableHolder, VK, VIndex, Flags, isOptimized,
+ VTableHolder, VK, VIndex, ThisAdjustment, Flags, isOptimized,
isDefinition ? CUNode : nullptr, TParams, nullptr, nullptr);
if (isDefinition)