Skip to content

Commit d20101d

Browse files
committed
[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.
1 parent 142aa1b commit d20101d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,13 @@ std::unique_ptr<raw_pwrite_stream> CompilerInstance::createDefaultOutputFile(
805805
bool Binary, StringRef InFile, StringRef Extension, bool RemoveFileOnSignal,
806806
bool CreateMissingDirectories, bool ForceUseTemporary) {
807807
StringRef OutputPath = getFrontendOpts().OutputFile;
808-
std::optional<SmallString<128>> PathStorage;
809808
if (OutputPath.empty()) {
810809
if (InFile == "-" || Extension.empty()) {
811810
OutputPath = "-";
812811
} else {
813-
PathStorage.emplace(InFile);
814-
llvm::sys::path::replace_extension(*PathStorage, Extension);
815-
OutputPath = *PathStorage;
812+
SmallString<128> PathStorage = InFile;
813+
llvm::sys::path::replace_extension(PathStorage, Extension);
814+
OutputPath = PathStorage;
816815
}
817816
}
818817

0 commit comments

Comments
 (0)