[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.
This commit is contained in:
Nikita Popov
2024-06-11 15:26:53 +02:00
committed by GitHub
parent 400d4fd7b6
commit 2b15fb16ce

View File

@@ -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 {