[PATCH] D129392: llvm-dwarfdump: Don't crash if DW_AT_{decl,call}_{file,line} uses signed form

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 14:38:27 PDT 2022


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp:139-149
+    if (const auto *LT = U->getContext().getLineTableForUnit(U)) {
+      if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
+        if (LT->getFileNameByIndex(
+                *Val, U->getCompilationDir(),
+                DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
+                File)) {
+          File = '"' + File + '"';
----------------
I /think/ LLVM's style guide now doesn't encourage omitting braces from single statement but multi-line blocks like this, so I left these ones in.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp:156-160
+    if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
+      OS << *Val;
+    } else {
+      FormValue.dump(OS, DumpOpts);
+    }
----------------
Ah, removed these in a follow-up commit ( 84960896236338eb1c7b30f34041214e64db0bd1 )


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129392/new/

https://reviews.llvm.org/D129392



More information about the llvm-commits mailing list