diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-11 15:26:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 15:26:53 +0200 |
commit | 2b15fb16cee05e6fe56edc6bc24d4d31df48a115 (patch) | |
tree | 2446968525fa3529eb6b8c5c430c296047273b31 /llvm/tools | |
parent | 400d4fd7b6dea9c7cdd255bb804fcd0ee77f6d42 (diff) | |
download | llvm-2b15fb16cee05e6fe56edc6bc24d4d31df48a115.zip llvm-2b15fb16cee05e6fe56edc6bc24d4d31df48a115.tar.gz llvm-2b15fb16cee05e6fe56edc6bc24d4d31df48a115.tar.bz2 |
[gold] Don't pass StringRef to message() (#95083)
This is a printf style variadic function. If using a "%s" format, we
should pass "const char *" rather than "StringRef".
The use of data() here is safe because we know that the StringRef was
originally derived from a null-terminated string.
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 265ebcb..0b175a3 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -307,7 +307,8 @@ namespace options { } else if (opt.consume_front("opt-remarks-hotness-threshold=")) { auto ResultOrErr = remarks::parseHotnessThresholdOption(opt); if (!ResultOrErr) - message(LDPL_FATAL, "Invalid remarks hotness threshold: %s", opt); + message(LDPL_FATAL, "Invalid remarks hotness threshold: %s", + opt.data()); else RemarksHotnessThreshold = *ResultOrErr; } else if (opt.consume_front("opt-remarks-format=")) { @@ -319,7 +320,7 @@ namespace options { } else if (opt.consume_front("time-trace-granularity=")) { unsigned Granularity; if (opt.getAsInteger(10, Granularity)) - message(LDPL_FATAL, "Invalid time trace granularity: %s", opt); + message(LDPL_FATAL, "Invalid time trace granularity: %s", opt.data()); else time_trace_granularity = Granularity; } else { |