[PATCH] D21011: [codeview] Add complex record type translation

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 10:30:16 PDT 2016


rnk added a comment.

This needs some test, I'd add something like types-method-overloads.ll, and keep it focused to non-virtual methods so that we don't have to update it too much as we handle more complex virtual inheritance cases.


================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1185-1192
@@ +1184,10 @@
+ClassInfo &CodeViewDebug::collectClassInfo(const DICompositeType *Ty) {
+  auto I = ClassInfoMap.find(Ty);
+  if (I != ClassInfoMap.end()) {
+    return *I->second;
+  }
+
+  ClassInfoMap.insert(
+      std::make_pair(Ty, std::unique_ptr<ClassInfo>(new ClassInfo())));
+  ClassInfo &Info = *(ClassInfoMap.find(Ty)->second);
+
----------------
This does 3 lookups, it only needs to do one, something like this:
  auto Insertion = ClassInfoMap.insert({Ty, std::unique_ptr<ClassInfo>()});
  std::unique_ptr<ClassInfo> &Info = *Insertion.first->second;
  if (!Insertion.second)
    return Info;
  Info.reset(new ClassInfo());
  ...
  

================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1202
@@ +1201,3 @@
+    if (auto *SP = dyn_cast<DISubprogram>(Element)) {
+      Info.Methods[SP->getRawName()].push_back({ SP, true });
+    } else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
----------------
Should we claim that all methods are introduced virtual methods, or just the virtual ones?


http://reviews.llvm.org/D21011





More information about the llvm-commits mailing list