diff options
author | Timm Bäder <tbaeder@redhat.com> | 2022-12-20 11:19:20 +0100 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2022-12-20 11:29:44 +0100 |
commit | d20101db48945e9d7a19ce3edcfd91d7e1aeadab (patch) | |
tree | b1c735892f7b44d2405c1636b1ae5cc2c92fe302 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 142aa1bdd1dd1db9a7fecf9d157228019c794c94 (diff) | |
download | llvm-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.cpp | 7 |
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; } } |