Index: lib/LTO/LTOBackend.cpp =================================================================== --- lib/LTO/LTOBackend.cpp +++ lib/LTO/LTOBackend.cpp @@ -40,7 +40,7 @@ std::error_code EC; ResolutionFile = llvm::make_unique( - OutputFileName + ".resolution.txt", EC, sys::fs::OpenFlags::F_Text); + OutputFileName + "resolution.txt", EC, sys::fs::OpenFlags::F_Text); if (EC) return errorCodeToError(EC); @@ -58,12 +58,10 @@ // user hasn't requested using the input module's path, emit to a file // named from the provided OutputFileName with the Task ID appended. if (M.getModuleIdentifier() == "ld-temp.o" || !UseInputModulePath) { - PathPrefix = OutputFileName; - if (Task != 0) - PathPrefix += "." + utostr(Task); + PathPrefix = OutputFileName + utostr(Task) + "."; } else PathPrefix = M.getModuleIdentifier(); - std::string Path = PathPrefix + "." + PathSuffix + ".bc"; + std::string Path = PathPrefix + PathSuffix + ".bc"; std::error_code EC; raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None); if (EC) { @@ -86,7 +84,7 @@ setHook("5.precodegen", PreCodeGenModuleHook); CombinedIndexHook = [=](const ModuleSummaryIndex &Index) { - std::string Path = OutputFileName + ".index.bc"; + std::string Path = OutputFileName + "index.bc"; std::error_code EC; raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None); if (EC) { Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -796,7 +796,8 @@ break; case options::OT_SAVE_TEMPS: - check(Conf.addSaveTemps(output_name, /* UseInputModulePath */ true)); + check(Conf.addSaveTemps(Twine(output_name) + ".", + /* UseInputModulePath */ true)); break; } Index: tools/llvm-lto2/llvm-lto2.cpp =================================================================== --- tools/llvm-lto2/llvm-lto2.cpp +++ tools/llvm-lto2/llvm-lto2.cpp @@ -136,7 +136,8 @@ }; if (SaveTemps) - check(Conf.addSaveTemps(OutputFilename), "Config::addSaveTemps failed"); + check(Conf.addSaveTemps(OutputFilename + "."), + "Config::addSaveTemps failed"); LTO Lto(std::move(Conf));