8000 [Frontend] Avoid creating a temporary instance of std::string (NFC) (… · llvm/llvm-project@6963309 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6963309

Browse files
[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.
1 parent dfac044 commit 6963309

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Frontend/CompilerInvocation.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2055,8 +2055,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
20552055
// The memory profile runtime appends the pid to make this name more unique.
20562056
const char *MemProfileBasename = "memprof.profraw";
20572057
if (Args.hasArg(OPT_fmemory_profile_EQ)) {
2058-
SmallString<128> Path(
2059-
std::string(Args.getLastArgValue(OPT_fmemory_profile_EQ)));
2058+
SmallString<128> Path(Args.getLastArgValue(OPT_fmemory_profile_EQ));
20602059
llvm::sys::path::append(Path, MemProfileBasename);
20612060
Opts.MemoryProfileOutput = std::string(Path);
20622061
} else if (Args.hasArg(OPT_fmemory_profile))

0 commit comments

Comments
 (0)
0