summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2017-09-13 20:53:55 +0000
committerAdrian McCarthy <amccarth@google.com>2017-09-13 20:53:55 +0000
commitd91bf3998fb45f5a959b77d5d0e2d86c040b8bed (patch)
tree5bdd6c47749b62e05a4e78bc1da2289a6e6d7c8b /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent1929ffd45263c8c4ab64b02976ed1e68ad720e31 (diff)
downloadbcm5719-llvm-d91bf3998fb45f5a959b77d5d0e2d86c040b8bed.tar.gz
bcm5719-llvm-d91bf3998fb45f5a959b77d5d0e2d86c040b8bed.zip
Mark static member functions as static in CodeViewDebug
Summary: To improve CodeView quality for static member functions, we need to make the static explicit. In addition to a small change in LLVM's CodeViewDebug to return the appropriate MethodKind, this requires a small change in Clang to note the staticness in the debug info metadata. Subscribers: aprantl, hiraditya Differential Revision: https://reviews.llvm.org/D37715 llvm-svn: 313192
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 42a0d7991d2..ed2dfa6906f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -325,8 +325,9 @@ TypeIndex CodeViewDebug::getMemberFunctionType(const DISubprogram *SP,
// function type, as the complete class type is likely to reference this
// member function type.
TypeLoweringScope S(*this);
- TypeIndex TI =
- lowerTypeMemberFunction(SP->getType(), Class, SP->getThisAdjustment());
+ const bool IsStaticMethod = (SP->getFlags() & DINode::FlagStaticMember) != 0;
+ TypeIndex TI = lowerTypeMemberFunction(
+ SP->getType(), Class, SP->getThisAdjustment(), IsStaticMethod);
return recordTypeIndexForDINode(SP, TI, Class);
}
@@ -1221,7 +1222,8 @@ TypeIndex CodeViewDebug::lowerType(const DIType *Ty, const DIType *ClassTy) {
// The member function type of a member function pointer has no
// ThisAdjustment.
return lowerTypeMemberFunction(cast<DISubroutineType>(Ty), ClassTy,
- /*ThisAdjustment=*/0);
+ /*ThisAdjustment=*/0,
+ /*IsStaticMethod=*/false);
}
return lowerTypeFunction(cast<DISubroutineType>(Ty));
case dwarf::DW_TAG_enumeration_type:
@@ -1542,7 +1544,8 @@ TypeIndex CodeViewDebug::lowerTypeFunction(const DISubroutineType *Ty) {
TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty,
const DIType *ClassTy,
- int ThisAdjustment) {
+ int ThisAdjustment,
+ bool IsStaticMethod) {
// Lower the containing class type.
TypeIndex ClassType = getTypeIndex(ClassTy);
@@ -1558,7 +1561,7 @@ TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty,
ArgTypeIndices = ReturnAndArgTypesRef.drop_front();
}
TypeIndex ThisTypeIndex = TypeIndex::Void();
- if (!ArgTypeIndices.empty()) {
+ if (!IsStaticMethod && !ArgTypeIndices.empty()) {
ThisTypeIndex = ArgTypeIndices.front();
ArgTypeIndices = ArgTypeIndices.drop_front();
}
@@ -1568,9 +1571,7 @@ TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty,
CallingConvention CC = dwarfCCToCodeView(Ty->getCC());
- // TODO: Need to use the correct values for:
- // FunctionOptions
- // ThisPointerAdjustment.
+ // TODO: Need to use the correct values for FunctionOptions.
MemberFunctionRecord MFR(ReturnTypeIndex, ClassType, ThisTypeIndex, CC,
FunctionOptions::None, ArgTypeIndices.size(),
ArgListIndex, ThisAdjustment);
@@ -1612,6 +1613,9 @@ static MethodOptions translateMethodOptionFlags(const DISubprogram *SP) {
static MethodKind translateMethodKindFlags(const DISubprogram *SP,
bool Introduced) {
+ if (SP->getFlags() & DINode::FlagStaticMember)
+ return MethodKind::Static;
+
switch (SP->getVirtuality()) {
case dwarf::DW_VIRTUALITY_none:
break;
@@ -1624,8 +1628,6 @@ static MethodKind translateMethodKindFlags(const DISubprogram *SP,
llvm_unreachable("unhandled virtuality case");
}
- // FIXME: Get Clang to mark DISubprogram as static and do something with it.
-
return MethodKind::Vanilla;
}
OpenPOWER on IntegriCloud