[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 11:41:42 PST 2020
akhuang created this revision.
akhuang added a reviewer: rnk.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
akhuang requested review of this revision.
In https://reviews.llvm.org/D89072 I added static const data members
to the debug subsection for globals. It skipped emitting an S_CONSTANT if it
didn't have a value, which meant the subsection could be empty.
This patch fixes the empty subsection issue.
Repository:
rG LLVM Github Monorepo
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 (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.307418.patch
Type: text/x-patch
Size: 1098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201124/591079a8/attachment.bin>
More information about the llvm-commits
mailing list