[PATCH] Colored syntax highlighting for llvm-dwarfdump.

Frederic Riss friss at apple.com
Mon Jan 5 17:28:30 PST 2015


Yes, I like it much better. You already have Eric's sign-off anyway, but here are a couple of additional suggestions if you like:


================
Comment at: lib/DebugInfo/DWARFDebugInfoEntry.cpp:153-156
@@ -147,3 +152,6 @@
   if (Name) {
-    OS << Name;
+    if (attr == DW_AT_decl_file || attr == DW_AT_call_file)
+      WithColor(OS, syntax::String).get() << Name;
+    else
+      WithColor(OS, syntax::Enumerator).get() << Name;
   } else if (attr == DW_AT_decl_line || attr == DW_AT_call_line) {
----------------
Could you write this:

```
WithColor(OS, Color).get << Name;
```
and have Color be a variable that you initialize to Enumerator and reset to String if we get Name from the linetable? This way you don't duplicate the {decl,call}_file condtiion with the if above.

================
Comment at: lib/DebugInfo/DWARFFormValue.cpp:487-492
@@ +486,8 @@
+  if (cu_relative_offset) {
+    OS << " => {";
+    {
+      WithColor(OS, syntax::Address).get()
+        << format("0x%8.8" PRIx64, uvalue + (cu ? cu->getOffset() : 0));
+    }
+    OS << "}";
+  }
----------------
You don't need the extra scope here.

http://reviews.llvm.org/D6852

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list