diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-01-26 02:07:05 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-01-26 02:07:05 +0000 |
commit | 289792dbcaee2a2ff7345e3291971e9d3aa27b28 (patch) | |
tree | 5847b5012638f5c1a86a7f70d428141d210d7be4 /tools/gold | |
parent | f544b74edf97fbee50e1f5d95a6f2048b12f1510 (diff) |
gold-plugin: Simplify naming of object files created with save-temps or obj-path.
Now we never append a number to the file name for task ID 0.
Differential Revision: https://reviews.llvm.org/D29160
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 1ac542b28764..f8e708076131 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -106,7 +106,6 @@ static DenseMap<int, void *> FDToLeaderHandle; static StringMap<ResolutionInfo> ResInfo; static std::vector<std::string> Cleanup; static llvm::TargetOptions TargetOpts; -static size_t MaxTasks; namespace options { enum OutputType { @@ -637,7 +636,7 @@ static void recordFile(std::string Filename, bool TempOutFile) { /// indicating whether a temp file should be generated, and an optional task id. /// The new filename generated is returned in \p NewFilename. static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile, - SmallString<128> &NewFilename, int TaskID = -1) { + SmallString<128> &NewFilename, int TaskID) { if (TempOutFile) { std::error_code EC = sys::fs::createTemporaryFile("lto-llvm", "o", NewFilename); @@ -646,7 +645,7 @@ static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile, EC.message().c_str()); } else { NewFilename = InFilename; - if (TaskID >= 0) + if (TaskID > 0) NewFilename += utostr(TaskID); } } @@ -813,7 +812,7 @@ static ld_plugin_status allSymbolsReadHook() { Filename = output_name + ".o"; bool SaveTemps = !Filename.empty(); - MaxTasks = Lto->getMaxTasks(); + size_t MaxTasks = Lto->getMaxTasks(); std::vector<uintptr_t> IsTemporary(MaxTasks); std::vector<SmallString<128>> Filenames(MaxTasks); @@ -821,7 +820,7 @@ static ld_plugin_status allSymbolsReadHook() { [&](size_t Task) -> std::unique_ptr<lto::NativeObjectStream> { IsTemporary[Task] = !SaveTemps; getOutputFileName(Filename, /*TempOutFile=*/!SaveTemps, Filenames[Task], - MaxTasks > 1 ? Task : -1); + Task); int FD; std::error_code EC = sys::fs::openFileForWrite(Filenames[Task], FD, sys::fs::F_None); |