[PATCH] llvm-readobj: COFF/ELF-specific low-level output

Nico Rieck nico.rieck at gmail.com
Tue Mar 12 17:03:43 PDT 2013



================
Comment at: tools/llvm-readobj/StreamWriter.h:135-173
@@ +134,41 @@
+
+  void printNumber(StringRef Label, uint64_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, uint32_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, uint16_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, uint8_t Value)
+  {
+    startLine() << Label << ": " << unsigned(Value) << "\n";
+  }
+
+  void printNumber(StringRef Label, int64_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, int32_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, int16_t Value)
+  {
+    startLine() << Label << ": " << Value << "\n";
+  }
+
+  void printNumber(StringRef Label, int8_t Value)
+  {
+    startLine() << Label << ": " << int(Value) << "\n";
+  }
+
----------------
Michael Spencer wrote:
> These don't need to be duplicated.
Any suggestions? It's the way it is to allow passing in types (like packed_endian_specific_integral<>) that are implicitly convertible to integral types. This neither works with just 64-bit overloads of printNumber or operator<< (with printNumber being a template) due to ambiguity.


http://llvm-reviews.chandlerc.com/D416



More information about the llvm-commits mailing list