Reorder fission variables.
[oota-llvm.git] / lib / DebugInfo / DWARFAbbreviationDeclaration.cpp
index 7bc942f63dd5e7dc97a1fd1718a76f0538e020c2..0df692c3a3b7f3d4a92a1977e72683e4a198eba4 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "DWARFAbbreviationDeclaration.h"
 #include "llvm/Support/Dwarf.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 using namespace dwarf;
@@ -47,11 +48,28 @@ DWARFAbbreviationDeclaration::extract(DataExtractor data, uint32_t* offset_ptr,
 }
 
 void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
-  OS << '[' << getCode() << "] " << TagString(getTag()) << "\tDW_CHILDREN_"
-     << (hasChildren() ? "yes" : "no") << '\n';
-  for (unsigned i = 0, e = Attributes.size(); i != e; ++i)
-    OS << '\t' << AttributeString(Attributes[i].getAttribute())
-       << '\t' << FormEncodingString(Attributes[i].getForm()) << '\n';
+  const char *tagString = TagString(getTag());
+  OS << '[' << getCode() << "] ";
+  if (tagString)
+    OS << tagString;
+  else
+    OS << format("DW_TAG_Unknown_%x", getTag());
+  OS << "\tDW_CHILDREN_" << (hasChildren() ? "yes" : "no") << '\n';
+  for (unsigned i = 0, e = Attributes.size(); i != e; ++i) {
+    OS << '\t';
+    const char *attrString = AttributeString(Attributes[i].getAttribute());
+    if (attrString)
+      OS << attrString;
+    else
+      OS << format("DW_AT_Unknown_%x", Attributes[i].getAttribute());
+    OS << '\t';
+    const char *formString = FormEncodingString(Attributes[i].getForm());
+    if (formString)
+      OS << formString;
+    else
+      OS << format("DW_FORM_Unknown_%x", Attributes[i].getForm());
+    OS << '\n';
+  }
   OS << '\n';
 }