[PATCH] D114223: Make ScopedPrinter interface virtual

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 29 02:39:46 PST 2021


jhenderson added inline comments.


================
Comment at: llvm/include/llvm/Support/ScopedPrinter.h:271-277
   void printString(StringRef Label, const std::string &Value) {
     printString(Label, StringRef(Value));
   }
 
-  void printString(StringRef Label, const char* Value) {
+  void printString(StringRef Label, const char *Value) {
     printString(Label, StringRef(Value));
   }
----------------
FWIW, these two functions don't need to be in the interface, since they should implicitly convert to StringRef quite happily. Perhaps a separate patch to remove them?


================
Comment at: llvm/include/llvm/Support/ScopedPrinter.h:279-282
   template <typename T>
   void printNumber(StringRef Label, StringRef Str, T Value) {
-    startLine() << Label << ": " << Str << " (" << Value << ")\n";
+    printNumberImpl(Label, Str, to_string(Value));
   }
----------------
On the note of separate patches, I'd be inclined to move this to be with the other `printNumber` overloads.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114223/new/

https://reviews.llvm.org/D114223



More information about the llvm-commits mailing list