aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2021-07-08 13:30:14 -0700
committerDavid Blaikie <dblaikie@gmail.com>2021-07-08 13:37:57 -0700
commit1def2579e10dd84405465f403e8c31acebff0c97 (patch)
tree8f8965df36c9eadb466cccd78d1a384ebd550cc5 /llvm/lib/Support/CommandLine.cpp
parenta7992b43a54f89dca7b76cb79d1045acce6dbe1f (diff)
downloadllvm-1def2579e10dd84405465f403e8c31acebff0c97.zip
llvm-1def2579e10dd84405465f403e8c31acebff0c97.tar.gz
llvm-1def2579e10dd84405465f403e8c31acebff0c97.tar.bz2
PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23
C++23 will make these conversions ambiguous - so fix them to make the codebase forward-compatible with C++23 (& a follow-up change I've made will make this ambiguous/invalid even in <C++23 so we don't regress this & it generally improves the code anyway)
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 0cc8273..8cf7d5b 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -864,7 +864,7 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringSaver &Saver,
// End the token if this is whitespace.
if (isWhitespace(C)) {
if (!Token.empty())
- NewArgv.push_back(Saver.save(StringRef(Token)).data());
+ NewArgv.push_back(Saver.save(Token.str()).data());
// Mark the end of lines in response files.
if (MarkEOLs && C == '\n')
NewArgv.push_back(nullptr);
@@ -878,7 +878,7 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringSaver &Saver,
// Append the last token after hitting EOF with no whitespace.
if (!Token.empty())
- NewArgv.push_back(Saver.save(StringRef(Token)).data());
+ NewArgv.push_back(Saver.save(Token.str()).data());
}
/// Backslashes are interpreted in a rather complicated way in the Windows-style