[PATCH] D87406: [DebugInfo] Fixing CodeView assert related to lowerBound field of DISubrange.
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 22:44:36 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe45b0708ae81: [DebugInfo] Fixing CodeView assert related to lowerBound field of DISubrange. (authored by alok, committed by SouraVX).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87406/new/
https://reviews.llvm.org/D87406
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
@@ -1578,11 +1578,16 @@
assert(Element->getTag() == dwarf::DW_TAG_subrange_type);
const DISubrange *Subrange = cast<DISubrange>(Element);
- assert(!Subrange->getRawLowerBound() &&
- "codeview doesn't support subranges with lower bounds");
int64_t Count = -1;
- if (auto *CI = Subrange->getCount().dyn_cast<ConstantInt*>())
- Count = CI->getSExtValue();
+ // Calculate the count if either LowerBound is absent or is zero and
+ // either of Count or UpperBound are constant.
+ auto *LI = Subrange->getLowerBound().dyn_cast<ConstantInt *>();
+ if (!Subrange->getRawLowerBound() || (LI && (LI->getSExtValue() == 0))) {
+ if (auto *CI = Subrange->getCount().dyn_cast<ConstantInt*>())
+ Count = CI->getSExtValue();
+ else if (auto *UI = Subrange->getUpperBound().dyn_cast<ConstantInt*>())
+ Count = UI->getSExtValue() + 1; // LowerBound is zero
+ }
// Forward declarations of arrays without a size and VLAs use a count of -1.
// Emit a count of zero in these cases to match what MSVC does for arrays
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87406.291135.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200911/c70791c7/attachment.bin>
More information about the llvm-commits
mailing list