[NFC] Use StringRef instead of const char* for AsmPrinter
authorserge-sans-paille <sguelton@redhat.com>
Fri, 12 Mar 2021 13:27:15 +0000 (14:27 +0100)
committerserge-sans-paille <sguelton@redhat.com>
Fri, 12 Mar 2021 13:39:25 +0000 (14:39 +0100)
This avoids calling strlen to repeatedly compute some string size.

llvm/include/llvm/CodeGen/AsmPrinter.h

index dcd9cca..52b5ecd 100644 (file)
@@ -144,14 +144,14 @@ public:
   /// AsmPrinter to add their own handlers.
   struct HandlerInfo {
     std::unique_ptr<AsmPrinterHandler> Handler;
-    const char *TimerName;
-    const char *TimerDescription;
-    const char *TimerGroupName;
-    const char *TimerGroupDescription;
-
-    HandlerInfo(std::unique_ptr<AsmPrinterHandler> Handler,
-                const char *TimerName, const char *TimerDescription,
-                const char *TimerGroupName, const char *TimerGroupDescription)
+    StringRef TimerName;
+    StringRef TimerDescription;
+    StringRef TimerGroupName;
+    StringRef TimerGroupDescription;
+
+    HandlerInfo(std::unique_ptr<AsmPrinterHandler> Handler, StringRef TimerName,
+                StringRef TimerDescription, StringRef TimerGroupName,
+                StringRef TimerGroupDescription)
         : Handler(std::move(Handler)), TimerName(TimerName),
           TimerDescription(TimerDescription), TimerGroupName(TimerGroupName),
           TimerGroupDescription(TimerGroupDescription) {}