[llvm] bc4a5bd - [NFC] Use StringRef instead of const char* for AsmPrinter
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 12 05:39:42 PST 2021
Author: serge-sans-paille
Date: 2021-03-12T14:39:25+01:00
New Revision: bc4a5bdce4af82a5522869d8a154e9e15cf809df
URL: https://github.com/llvm/llvm-project/commit/bc4a5bdce4af82a5522869d8a154e9e15cf809df
DIFF: https://github.com/llvm/llvm-project/commit/bc4a5bdce4af82a5522869d8a154e9e15cf809df.diff
LOG: [NFC] Use StringRef instead of const char* for AsmPrinter
This avoids calling strlen to repeatedly compute some string size.
Added:
Modified:
llvm/include/llvm/CodeGen/AsmPrinter.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index dcd9cca0d81d..52b5ecd1a3bb 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -144,14 +144,14 @@ class AsmPrinter : public MachineFunctionPass {
/// 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) {}
More information about the llvm-commits
mailing list