From d20101db48945e9d7a19ce3edcfd91d7e1aeadab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 20 Dec 2022 11:19:20 +0100 Subject: [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. --- clang/lib/Frontend/CompilerInstance.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'clang/lib/Frontend/CompilerInstance.cpp') 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 CompilerInstance::createDefaultOutputFile( bool Binary, StringRef InFile, StringRef Extension, bool RemoveFileOnSignal, bool CreateMissingDirectories, bool ForceUseTemporary) { StringRef OutputPath = getFrontendOpts().OutputFile; - std::optional> 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; } } -- cgit v1.1