[readobj] Expand CodeView dumping functionality

This rewrites and expands the existing codeview dumping functionality in
llvm-readobj using techniques similar to those in lib/Object. This defines a
number of new records and enums useful for reading memory mapped codeview
sections in COFF objects.

The dumper is intended as a testing tool for LLVM as it grows more codeview
output capabilities.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D16104

llvm-svn: 257658
diff --git a/llvm/tools/llvm-readobj/StreamWriter.h b/llvm/tools/llvm-readobj/StreamWriter.h
index d2dbb07..08aa519 100644
--- a/llvm/tools/llvm-readobj/StreamWriter.h
+++ b/llvm/tools/llvm-readobj/StreamWriter.h
@@ -10,6 +10,7 @@
 #ifndef LLVM_TOOLS_LLVM_READOBJ_STREAMWRITER_H
 #define LLVM_TOOLS_LLVM_READOBJ_STREAMWRITER_H
 
+#include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -180,6 +181,10 @@
     startLine() << Label << ": " << int(Value) << "\n";
   }
 
+  void printNumber(StringRef Label, APSInt Value) {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
   void printBoolean(StringRef Label, bool Value) {
     startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
   }
@@ -287,6 +292,12 @@
   int IndentLevel;
 };
 
+template <>
+inline void StreamWriter::printHex<ulittle16_t>(StringRef Label,
+                                                ulittle16_t Value) {
+  startLine() << Label << ": " << hex(Value) << "\n";
+}
+
 struct DictScope {
   DictScope(StreamWriter& W, StringRef N) : W(W) {
     W.startLine() << N << " {\n";