aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-05-16 20:02:50 -0700
committerGitHub <noreply@github.com>2025-05-16 20:02:50 -0700
commit6963309af12f8d1a688fa2c42019d83e78a0024c (patch)
tree0c1833dbdb2d8a1d1102342ae8d81fcb78a84101 /clang/lib/Frontend/CompilerInvocation.cpp
parentdfac0445d0813abe2260ffdc9eeb23671cefd812 (diff)
downloadllvm-6963309af12f8d1a688fa2c42019d83e78a0024c.zip
llvm-6963309af12f8d1a688fa2c42019d83e78a0024c.tar.gz
llvm-6963309af12f8d1a688fa2c42019d83e78a0024c.tar.bz2
[Frontend] Avoid creating a temporary instance of std::string (NFC) (#140326)
Since getLastArgValue returns StringRef, and the constructor of SmallString accepts StringRef, we do not need to go through a temporary instance of std::string.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index fd48e42..3c23073 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2055,8 +2055,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
// The memory profile runtime appends the pid to make this name more unique.
const char *MemProfileBasename = "memprof.profraw";
if (Args.hasArg(OPT_fmemory_profile_EQ)) {
- SmallString<128> Path(
- std::string(Args.getLastArgValue(OPT_fmemory_profile_EQ)));
+ SmallString<128> Path(Args.getLastArgValue(OPT_fmemory_profile_EQ));
llvm::sys::path::append(Path, MemProfileBasename);
Opts.MemoryProfileOutput = std::string(Path);
} else if (Args.hasArg(OPT_fmemory_profile))