[dwarfdump] Improve -diff option by hiding more data.
The -diff option makes it easy to diff dwarf by hiding addresses and
offsets. However not all of them were hidden, which should be fixed by
this patch.
Differential revision: https://reviews.llvm.org/D51593
llvm-svn: 341377
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 654d205..35567d0 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -244,15 +244,17 @@
else
formValue.dump(OS, DumpOpts);
+ std::string Space = DumpOpts.ShowAddresses ? " " : "";
+
// We have dumped the attribute raw value. For some attributes
// having both the raw value and the pretty-printed value is
// interesting. These attributes are handled below.
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
if (const char *Name = Die.getAttributeValueAsReferencedDie(Attr).getName(
DINameKind::LinkageName))
- OS << " \"" << Name << '\"';
+ OS << Space << "\"" << Name << '\"';
} else if (Attr == DW_AT_type) {
- OS << " \"";
+ OS << Space << "\"";
dumpTypeName(OS, Die);
OS << '"';
} else if (Attr == DW_AT_APPLE_property_attribute) {