[PATCH] D43387: [DebugInfo] Removed assert on missing CountVarDIE
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 07:44:43 PST 2018
sdesmalen created this revision.
sdesmalen added reviewers: aprantl, dblaikie, probinson.
Herald added a subscriber: JDevlieghere.
The assert for a DISubrange's CountVarDIE to be available fails
when the dbg.value() has been optimized away for any reason.
Having the assert for that is a little heavy, so instead removing
it now in favor of not generating the 'count' expression.
Addresses http://llvm.org/PR36263 .
https://reviews.llvm.org/D43387
Files:
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1381,15 +1381,13 @@
if (DefaultLowerBound == -1 || LowerBound != DefaultLowerBound)
addUInt(DW_Subrange, dwarf::DW_AT_lower_bound, None, LowerBound);
- if (auto *CV = SR->getCount().dyn_cast<DIVariable*>()) {
- // 'finishVariableDefinition' that creates the types for a variable is
- // always called _after_ the DIEs for variables are created.
- auto *CountVarDIE = getDIE(CV);
- assert(CountVarDIE && "DIE for count is not yet instantiated");
+ DIE *CountVarDIE = nullptr;
+ if (auto *CV = SR->getCount().dyn_cast<DIVariable*>())
+ CountVarDIE = getDIE(CV);
+
+ if (CountVarDIE)
addDIEEntry(DW_Subrange, dwarf::DW_AT_count, *CountVarDIE);
- } else if (Count != -1)
- // FIXME: An unbounded array should reference the expression that defines
- // the array.
+ else if (Count != -1)
addUInt(DW_Subrange, dwarf::DW_AT_count, None, Count);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43387.134616.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/56ea98a5/attachment.bin>
More information about the llvm-commits
mailing list