aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2022-12-20 11:19:20 +0100
committerTimm Bäder <tbaeder@redhat.com>2022-12-20 11:29:44 +0100
commitd20101db48945e9d7a19ce3edcfd91d7e1aeadab (patch)
treeb1c735892f7b44d2405c1636b1ae5cc2c92fe302 /clang/lib/Frontend/CompilerInstance.cpp
parent142aa1bdd1dd1db9a7fecf9d157228019c794c94 (diff)
downloadllvm-d20101db48945e9d7a19ce3edcfd91d7e1aeadab.zip
llvm-d20101db48945e9d7a19ce3edcfd91d7e1aeadab.tar.gz
llvm-d20101db48945e9d7a19ce3edcfd91d7e1aeadab.tar.bz2
[clang][NFC] Clean up createDefaultOutputFile()
PathStorage is only used in one of the if branches, so doesn't need to be a std::optional anyway.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index a124566..858c580 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -805,14 +805,13 @@ std::unique_ptr<raw_pwrite_stream> CompilerInstance::createDefaultOutputFile(
bool Binary, StringRef InFile, StringRef Extension, bool RemoveFileOnSignal,
bool CreateMissingDirectories, bool ForceUseTemporary) {
StringRef OutputPath = getFrontendOpts().OutputFile;
- std::optional<SmallString<128>> PathStorage;
if (OutputPath.empty()) {
if (InFile == "-" || Extension.empty()) {
OutputPath = "-";
} else {
- PathStorage.emplace(InFile);
- llvm::sys::path::replace_extension(*PathStorage, Extension);
- OutputPath = *PathStorage;
+ SmallString<128> PathStorage = InFile;
+ llvm::sys::path::replace_extension(PathStorage, Extension);
+ OutputPath = PathStorage;
}
}