<div dir="ltr">Yep, test case would be good here<br><br><div class="gmail_quote"><div dir="ltr">On Tue, May 22, 2018 at 10:41 AM Jonas Devlieghere via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jdevlieghere<br>
Date: Tue May 22 10:37:27 2018<br>
New Revision: 333005<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=333005&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=333005&view=rev</a><br>
Log:<br>
[DebugInfo] Fix location list check in the verifier<br>
<br>
We weren't properly verifying location lists because we tried obtaining<br>
the offset as a constant.<br>
<br>
Modified:<br>
    llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=333005&r1=333004&r2=333005&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=333005&r1=333004&r2=333005&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Tue May 22 10:37:27 2018<br>
@@ -409,7 +409,7 @@ unsigned DWARFVerifier::verifyDebugInfoA<br>
     ReportError("DIE has invalid DW_AT_stmt_list encoding:");<br>
     break;<br>
   case DW_AT_location: {<br>
-    auto VerifyLocation = [&](StringRef D) {<br>
+    auto VerifyLocationExpr = [&](StringRef D) {<br>
       DWARFUnit *U = Die.getDwarfUnit();<br>
       DataExtractor Data(D, DCtx.isLittleEndian(), 0);<br>
       DWARFExpression Expression(Data, U->getVersion(),<br>
@@ -422,13 +422,13 @@ unsigned DWARFVerifier::verifyDebugInfoA<br>
     };<br>
     if (Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock()) {<br>
       // Verify inlined location.<br>
-      VerifyLocation(llvm::toStringRef(*Expr));<br>
-    } else if (auto LocOffset = AttrValue.Value.getAsUnsignedConstant()) {<br>
+      VerifyLocationExpr(llvm::toStringRef(*Expr));<br>
+    } else if (auto LocOffset = AttrValue.Value.getAsSectionOffset()) {<br>
       // Verify location list.<br>
       if (auto DebugLoc = DCtx.getDebugLoc())<br>
         if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset))<br>
           for (const auto &Entry : LocList->Entries)<br>
-            VerifyLocation({Entry.Loc.data(), Entry.Loc.size()});<br>
+            VerifyLocationExpr({Entry.Loc.data(), Entry.Loc.size()});<br>
     }<br>
     break;<br>
   }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>