[codeview] Add IntroducingVirtual debug info flag
CodeView needs to know if a virtual method was introduced in the current
class, and base classes may not have complete type information, so we
need to thread this bit through from the frontend.
llvm-svn: 273453
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index da69f8b..3e45639 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "CodeViewDebug.h"
+#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/Line.h"
@@ -1174,12 +1175,6 @@
// Lower the containing class type.
TypeIndex ClassType = getTypeIndex(ClassTy);
- // While processing the class type it is possible we already created this
- // member function. If so, we check here and return the existing one.
- auto I = TypeIndices.find({Ty, ClassTy});
- if (I != TypeIndices.end())
- return I->second;
-
SmallVector<TypeIndex, 8> ReturnAndArgTypeIndices;
for (DITypeRef ArgTypeRef : Ty->getTypeArray())
ReturnAndArgTypeIndices.push_back(getTypeIndex(ArgTypeRef));
@@ -1313,12 +1308,7 @@
// [MemberInfo]
typedef std::vector<MemberInfo> MemberList;
- struct MethodInfo {
- const DISubprogram *Method;
- bool Introduced;
- };
- // [MethodInfo]
- typedef std::vector<MethodInfo> MethodsList;
+ typedef TinyPtrVector<const DISubprogram *> MethodsList;
// MethodName -> MethodsList
typedef MapVector<MDString *, MethodsList> MethodsMap;
@@ -1367,10 +1357,7 @@
if (!Element)
continue;
if (auto *SP = dyn_cast<DISubprogram>(Element)) {
- // Non-virtual methods does not need the introduced marker.
- // Set it to false.
- bool Introduced = false;
- Info.Methods[SP->getRawName()].push_back({SP, Introduced});
+ Info.Methods[SP->getRawName()].push_back(SP);
} else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
if (DDTy->getTag() == dwarf::DW_TAG_member)
collectMemberInfo(Info, DDTy);
@@ -1491,11 +1478,9 @@
StringRef Name = MethodItr.first->getString();
std::vector<OneMethodRecord> Methods;
- for (ClassInfo::MethodInfo &MethodInfo : MethodItr.second) {
- const DISubprogram *SP = MethodInfo.Method;
- bool Introduced = MethodInfo.Introduced;
-
- TypeIndex MethodType = getTypeIndex(SP->getType(), Ty);
+ for (const DISubprogram *SP : MethodItr.second) {
+ TypeIndex MethodType = getMemberFunctionType(SP, Ty);
+ bool Introduced = SP->getFlags() & DINode::FlagIntroducedVirtual;
unsigned VFTableOffset = -1;
if (Introduced)