Skip to content

Commit 5275bba

Browse files
committed
[DTLTO] Code refactor - Fix format errors.
1 parent 7acd666 commit 5275bba

5 files changed

Lines changed: 23 additions & 30 deletions

File tree

llvm/include/llvm/DTLTO/DTLTO.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ class DTLTO : public LTO {
321321
ArrayRef<StringRef> RemoteCompilerPrependArgsArg,
322322
ArrayRef<StringRef> RemoteCompilerArgsArg,
323323
StringRef LinkerOutputFileArg)
324-
: LinkerOutputFile(LinkerOutputFileArg), DistributorPath(DistributorArg),
325-
DistributorArgs(DistributorArgsArg), RemoteCompiler(RemoteCompilerArg),
324+
: LinkerOutputFile(LinkerOutputFileArg),
325+
DistributorPath(DistributorArg), DistributorArgs(DistributorArgsArg),
326+
RemoteCompiler(RemoteCompilerArg),
326327
RemoteCompilerPrependArgs(RemoteCompilerPrependArgsArg),
327328
RemoteCompilerArgs(RemoteCompilerArgsArg) {}
328329

@@ -356,8 +357,8 @@ class DTLTO : public LTO {
356357

357358
// Record a file for cleanup and register signal-time removal if requested.
358359
void addToCleanup(StringRef Filename) {
359-
CleanupList.push_back(Filename.str());
360-
sys::RemoveFileOnSignal(Filename);
360+
CleanupList.push_back(Filename.str());
361+
sys::RemoveFileOnSignal(Filename);
361362
}
362363
};
363364

llvm/include/llvm/LTO/LTO.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,24 @@ class ThinBackendProc {
287287
virtual bool isSensitiveToInputOrder() { return false; }
288288

289289
// Write sharded indices and (optionally) imports to disk
290-
LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
291-
StringRef ModulePath,
290+
LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList,
291+
unsigned Task, StringRef ModulePath,
292292
const std::string &NewModulePath) const;
293293

294294
// Write sharded indices to SummaryPath, (optionally) imports to disk, and
295295
// (optionally) record imports in ImportsFiles. When cache key parameters are
296296
// provided and GetCacheKeysListRefFunc is set, also computes and stores the
297297
// LTO cache key for the module.
298298
LLVM_ABI Error emitFiles(
299-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, StringRef ModulePath,
300-
const std::string &NewModulePath, StringRef SummaryPath,
299+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
300+
StringRef ModulePath, const std::string &NewModulePath,
301+
StringRef SummaryPath,
301302
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
302303
const FunctionImporter::ExportSetTy *ExportList = nullptr,
303-
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR =
304-
nullptr,
304+
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>
305+
*ResolvedODR = nullptr,
305306
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs = nullptr,
306-
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr)
307-
const;
307+
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr) const;
308308
};
309309

310310
/// This callable defines the behavior of a ThinLTO backend after the thin-link
@@ -664,8 +664,6 @@ class LTO {
664664
addInput(std::unique_ptr<lto::InputFile> InputPtr) {
665665
return std::shared_ptr<lto::InputFile>(InputPtr.release());
666666
}
667-
668-
669667
};
670668

671669
/// The resolution for a symbol. The linker must provide a SymbolResolution for

llvm/lib/DTLTO/DTLTO.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ Error save(StringRef Buffer, StringRef Path) {
5454
return Error::success();
5555
}
5656

57-
// Saves the content of Input to Path overwriting any existing file.
58-
Error save(lto::InputFile *Input, StringRef Path) {
59-
MemoryBufferRef MB = Input->getFileBuffer();
60-
return save(MB.getBuffer(), Path);
61-
}
62-
6357
// Normalize and save a path. Aside from expanding Windows 8.3 short paths,
6458
// no other normalization is currently required here. These paths are
6559
// machine-local and break distribution systems; other normalization is

llvm/lib/LTO/LTO.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,23 +1514,23 @@ SmallVector<StringRef> LTO::getLibFuncSymbols(const Triple &TT,
15141514
}
15151515

15161516
Error ThinBackendProc::emitFiles(
1517-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
1518-
const std::string &NewModulePath) const {
1517+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
1518+
llvm::StringRef ModulePath, const std::string &NewModulePath) const {
15191519
return emitFiles(ImportList, Task, ModulePath, NewModulePath,
15201520
NewModulePath + ".thinlto.bc",
15211521
/*ImportsFiles=*/std::nullopt, nullptr, nullptr, nullptr,
15221522
nullptr);
15231523
}
15241524

15251525
Error ThinBackendProc::emitFiles(
1526-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
1527-
const std::string &NewModulePath, StringRef SummaryPath,
1526+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
1527+
llvm::StringRef ModulePath, const std::string &NewModulePath,
1528+
StringRef SummaryPath,
15281529
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
15291530
const FunctionImporter::ExportSetTy *ExportList,
15301531
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR,
15311532
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs,
1532-
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls)
1533-
const {
1533+
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls) const {
15341534
ModuleToSummariesForIndexTy ModuleToSummariesForIndex;
15351535
GVSummaryPtrSet DeclarationSummaries;
15361536

@@ -2007,9 +2007,9 @@ class WriteIndexesThinBackend : public ThinBackendProc {
20072007
std::string NewModulePath =
20082008
getThinLTOOutputFile(ModulePath, OldPrefix, NewPrefix);
20092009
auto E = emitFiles(ImportList, Task, ModulePath, NewModulePath,
2010-
NewModulePath + ".thinlto.bc",
2011-
/*ImportsFiles=*/std::nullopt, &ExportList,
2012-
&ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
2010+
NewModulePath + ".thinlto.bc",
2011+
/*ImportsFiles=*/std::nullopt, &ExportList,
2012+
&ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
20132013
if (E) {
20142014
std::unique_lock<std::mutex> L(ErrMu);
20152015
if (Err)

llvm/tools/llvm-lto2/llvm-lto2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "llvm/ADT/ScopeExit.h"
1919
#include "llvm/Bitcode/BitcodeReader.h"
2020
#include "llvm/CodeGen/CommandFlags.h"
21-
#include "llvm/IR/DiagnosticPrinter.h"
2221
#include "llvm/DTLTO/DTLTO.h"
22+
#include "llvm/IR/DiagnosticPrinter.h"
2323
#include "llvm/LTO/LTO.h"
2424
#include "llvm/Plugins/PassPlugin.h"
2525
#include "llvm/Remarks/HotnessThresholdParser.h"

0 commit comments

Comments
 (0)