[PATCH] D40199: llvm-dwarfdump --verify is incorrectly saying all DW_AT_location attributes with locations lists are invalid.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 08:47:15 PST 2018


aprantl added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:413
   case DW_AT_location: {
-    Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock();
-    if (!Expr) {
-      ReportError("DIE has invalid DW_AT_location encoding:");
-      break;
+    auto VerifyLocation = [&](const void *data, size_t len) {
+      DWARFUnit *U = Die.getDwarfUnit();
----------------
Why doesn't this just take a StringRef? It looks like all call sites convert StringRefs, too.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:429
+    } else if (auto LocOffset = AttrValue.Value.getAsUnsignedConstant()) {
+      // Location list
+      if (auto DebugLoc = DCtx.getDebugLoc()) {
----------------
Full sentences in the comments?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:431
+      if (auto DebugLoc = DCtx.getDebugLoc()) {
+        if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset)) {
+          for (const auto &Entry : LocList->Entries)
----------------
redundant braces


https://reviews.llvm.org/D40199





More information about the llvm-commits mailing list