[clang] d20101d - [clang][NFC] Clean up createDefaultOutputFile()
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 20 02:30:26 PST 2022
Author: Timm Bäder
Date: 2022-12-20T11:29:44+01:00
New Revision: d20101db48945e9d7a19ce3edcfd91d7e1aeadab
URL: https://github.com/llvm/llvm-project/commit/d20101db48945e9d7a19ce3edcfd91d7e1aeadab
DIFF: https://github.com/llvm/llvm-project/commit/d20101db48945e9d7a19ce3edcfd91d7e1aeadab.diff
LOG: [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.
Added:
Modified:
clang/lib/Frontend/CompilerInstance.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index a12456640c7ac..858c5805b3abb 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;
}
}
More information about the cfe-commits
mailing list