[PATCH] D92049: [CodeView] Avoid emitting empty debug globals subsection.

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 14:39:48 PST 2020


akhuang updated this revision to Diff 307454.
akhuang added a comment.

avoid calling `isa` on a null value


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92049/new/

https://reviews.llvm.org/D92049

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp


Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -2150,10 +2150,13 @@
   if (!DDTy->getName().empty()) {
     Info.Members.push_back({DDTy, 0});
 
-    // Collect static const data members.
+    // Collect static const data members with values.
     if ((DDTy->getFlags() & DINode::FlagStaticMember) ==
-        DINode::FlagStaticMember)
-      StaticConstMembers.push_back(DDTy);
+        DINode::FlagStaticMember) {
+      if (DDTy->getConstant() && (isa<ConstantInt>(DDTy->getConstant()) ||
+                                  isa<ConstantFP>(DDTy->getConstant())))
+        StaticConstMembers.push_back(DDTy);
+    }
 
     return;
   }
@@ -3134,7 +3137,7 @@
                  dyn_cast_or_null<ConstantFP>(DTy->getConstant()))
       Value = APSInt(CFP->getValueAPF().bitcastToAPInt(), true);
     else
-      continue;
+      assert(false && "cannot emit a constant without a value");
 
     std::string QualifiedName = getFullyQualifiedName(Scope, DTy->getName());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92049.307454.patch
Type: text/x-patch
Size: 1147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201124/3f5e5bed/attachment.bin>


More information about the llvm-commits mailing list