Skip to content

Commit 3da7c73

Browse files
committed
Address non-test review comments.
1 parent ea25797 commit 3da7c73

File tree

10 files changed

+28
-30
lines changed

10 files changed

+28
-30
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4092,7 +4092,7 @@ def fno_finite_loops: Flag<["-"], "fno-finite-loops">, Group<f_Group>,
40924092
HelpText<"Do not assume that any loop is finite.">,
40934093
Visibility<[ClangOption, CC1Option]>;
40944094
def fthinlto_distributor_EQ : Joined<["-"], "fthinlto-distributor=">, Group<f_Group>,
4095-
HelpText<"Specifies the <path> to the distributor process executable.">, MetaVarName<"<path>">,
4095+
HelpText<"Specifies the <path> to the distributor process executable">, MetaVarName<"<path>">,
40964096
Visibility<[ClangOption, CLOption]>;
40974097
def ftrigraphs : Flag<["-"], "ftrigraphs">, Group<f_Group>,
40984098
HelpText<"Process trigraph sequences">, Visibility<[ClangOption, CC1Option]>;

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
540540
// do LTO or not dependent upon whether there are any bitcode input files in
541541
// the link.
542542
if (Arg *A = Args.getLastArg(options::OPT_fthinlto_distributor_EQ)) {
543-
A->claim();
544543
CmdArgs.push_back(
545544
Args.MakeArgString("--thinlto-distributor=" + Twine(A->getValue())));
546545
CmdArgs.push_back(

lld/COFF/Config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ struct Configuration {
193193
llvm::CachePruningPolicy ltoCachePolicy;
194194

195195
// Used for --thinlto-distributor=
196-
StringRef DTLTODistributor;
196+
StringRef dtltoDistributor;
197197
// Used for --thinlto-remote-opt-tool=
198-
StringRef DTLTORemoteOptTool;
198+
StringRef dtltoRemoteOptTool;
199199

200200
// Used for /opt:[no]ltodebugpassmanager
201201
bool ltoDebugPassManager = false;

lld/COFF/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
15191519
config->mllvmOpts.emplace_back(arg->getValue());
15201520
}
15211521

1522-
if (!ctx.config.DTLTODistributor.empty())
1522+
if (!ctx.config.dtltoDistributor.empty())
15231523
for (auto o : {"-thinlto-remote-opt-tool-arg=-fdiagnostics-format",
15241524
"-thinlto-remote-opt-tool-arg=msvc"}) {
15251525
v.push_back(o);
@@ -2090,8 +2090,8 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
20902090
}
20912091

20922092
// Handle DTLTO options.
2093-
config->DTLTODistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
2094-
config->DTLTORemoteOptTool =
2093+
config->dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
2094+
config->dtltoRemoteOptTool =
20952095
args.getLastArgValue(OPT_thinlto_remote_opt_tool_eq);
20962096

20972097
// Handle /dwodir

lld/COFF/LTO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ BitcodeCompiler::BitcodeCompiler(COFFLinkerContext &c) : ctx(c) {
117117

118118
// Initialize ltoObj.
119119
lto::ThinBackend backend;
120-
if (!ctx.config.DTLTODistributor.empty()) {
120+
if (!ctx.config.dtltoDistributor.empty()) {
121121
StringRef version = getenv("LLD_VERSION"); // For testing only.
122122
if (version.empty())
123123
version = ctx.saver.save(getLLDVersion());
@@ -126,7 +126,7 @@ BitcodeCompiler::BitcodeCompiler(COFFLinkerContext &c) : ctx(c) {
126126
/*OnWrite=*/nullptr,
127127
/*ShouldEmitIndexFiles=*/false,
128128
/*ShouldEmitImportFiles=*/false, ctx.config.outputFile, version,
129-
ctx.config.DTLTORemoteOptTool, ctx.config.DTLTODistributor,
129+
ctx.config.dtltoRemoteOptTool, ctx.config.dtltoDistributor,
130130
!ctx.config.saveTempsArgs.empty());
131131
} else if (ctx.config.thinLTOIndexOnly) {
132132
auto OnIndexWrite = [&](StringRef S) { thinIndices.erase(S); };

lld/ELF/Config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ struct Config {
243243
llvm::SmallVector<llvm::StringRef, 0> searchPaths;
244244
llvm::SmallVector<llvm::StringRef, 0> symbolOrderingFile;
245245
llvm::SmallVector<llvm::StringRef, 0> thinLTOModulesToCompile;
246-
llvm::StringRef DTLTODistributor;
247-
llvm::StringRef DTLTORemoteOptTool;
246+
llvm::StringRef dtltoDistributor;
247+
llvm::StringRef dtltoRemoteOptTool;
248248
llvm::SmallVector<llvm::StringRef, 0> undefined;
249249
llvm::SmallVector<SymbolVersion, 0> dynamicList;
250250
llvm::SmallVector<uint8_t, 0> buildIdVector;

lld/ELF/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,8 +1341,8 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
13411341
args.hasFlag(OPT_dependent_libraries, OPT_no_dependent_libraries, true);
13421342
ctx.arg.disableVerify = args.hasArg(OPT_disable_verify);
13431343
ctx.arg.discard = getDiscard(args);
1344-
ctx.arg.DTLTODistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
1345-
ctx.arg.DTLTORemoteOptTool =
1344+
ctx.arg.dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
1345+
ctx.arg.dtltoRemoteOptTool =
13461346
args.getLastArgValue(OPT_thinlto_remote_opt_tool_eq);
13471347
ctx.arg.dwoDir = args.getLastArgValue(OPT_plugin_opt_dwo_dir_eq);
13481348
ctx.arg.dynamicLinker = getDynamicLinker(ctx, args);

lld/ELF/InputFiles.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,8 @@ static uint8_t getOsAbi(const Triple &t) {
17031703
}
17041704
}
17051705

1706-
namespace dtlto {
17071706
// Check if an archive file is a thin archive.
1708-
bool isThinArchive(Ctx &ctx, StringRef archiveFilePath) {
1707+
static bool isThinArchive(Ctx &ctx, StringRef archiveFilePath) {
17091708
const size_t thinArchiveMagicLen = sizeof(ThinArchiveMagic) - 1;
17101709

17111710
ErrorOr<std::unique_ptr<MemoryBuffer>> memBufferOrError =
@@ -1720,8 +1719,9 @@ bool isThinArchive(Ctx &ctx, StringRef archiveFilePath) {
17201719
}
17211720

17221721
// Compute a thin archive member full file path.
1723-
std::string computeFullThinArchiveMemberPath(const StringRef modulePath,
1724-
const StringRef archiveName) {
1722+
static std::string
1723+
computeThinArchiveMemberFullPath(const StringRef modulePath,
1724+
const StringRef archiveName) {
17251725
assert(!archiveName.empty());
17261726
SmallString<64> archiveMemberPath;
17271727
if (path::is_relative(modulePath)) {
@@ -1733,7 +1733,6 @@ std::string computeFullThinArchiveMemberPath(const StringRef modulePath,
17331733
path::remove_dots(archiveMemberPath, /*remove_dot_dot=*/true);
17341734
return archiveMemberPath.c_str();
17351735
}
1736-
} // namespace dtlto
17371736

17381737
BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17391738
uint64_t offsetInArchive, bool lazy)
@@ -1746,11 +1745,11 @@ BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17461745
path = replaceThinLTOSuffix(ctx, mb.getBufferIdentifier());
17471746

17481747
// For DTLTO the name needs to be a valid path to a bitcode file.
1749-
bool dtltoThinArchiveHandling = !ctx.arg.DTLTODistributor.empty() &&
1748+
bool dtltoThinArchiveHandling = !ctx.arg.dtltoDistributor.empty() &&
17501749
!archiveName.empty() &&
1751-
dtlto::isThinArchive(ctx, archiveName);
1750+
isThinArchive(ctx, archiveName);
17521751
if (dtltoThinArchiveHandling)
1753-
path = dtlto::computeFullThinArchiveMemberPath(path, archiveName);
1752+
path = computeThinArchiveMemberFullPath(path, archiveName);
17541753

17551754
// ThinLTO assumes that all MemoryBufferRefs given to it have a unique
17561755
// name. If two archives define two members with the same name, this

lld/ELF/LTO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ BitcodeCompiler::BitcodeCompiler(Ctx &ctx) : ctx(ctx) {
187187
std::string(ctx.arg.thinLTOPrefixReplaceNew),
188188
std::string(ctx.arg.thinLTOPrefixReplaceNativeObject),
189189
ctx.arg.thinLTOEmitImportsFiles, indexFile.get(), onIndexWrite);
190-
} else if (!ctx.arg.DTLTODistributor.empty() && !ctx.bitcodeFiles.empty()) {
190+
} else if (!ctx.arg.dtltoDistributor.empty() && !ctx.bitcodeFiles.empty()) {
191191
StringRef version = getenv("LLD_VERSION"); // For testing only.
192192
if (version.empty())
193193
version = ctx.saver.save(getLLDVersion());
194194
backend = lto::createOutOfProcessThinBackend(
195195
llvm::heavyweight_hardware_concurrency(ctx.arg.thinLTOJobs),
196196
onIndexWrite, ctx.arg.thinLTOEmitIndexFiles,
197197
ctx.arg.thinLTOEmitImportsFiles, ctx.arg.outputFile, version,
198-
ctx.arg.DTLTORemoteOptTool, ctx.arg.DTLTODistributor,
198+
ctx.arg.dtltoRemoteOptTool, ctx.arg.dtltoDistributor,
199199
!ctx.arg.saveTempsArgs.empty());
200200
} else {
201201
backend = lto::createInProcessThinBackend(

lld/docs/DTLTO.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ ELF LLD
1515

1616
The command line interface for DTLTO is:
1717

18-
- `--thinlto-distributor=<path>`
18+
- ``--thinlto-distributor=<path>``
1919
Specifies the file to execute as a distributor process.
2020
If specified, ThinLTO backend compilations will be distributed.
2121

22-
- `--thinlto-remote-opt-tool=<path>`
22+
- ``--thinlto-remote-opt-tool=<path>``
2323
Specifies the path to the tool that the distributor process will use for
2424
backend compilations.
2525

@@ -30,10 +30,10 @@ The command line interface for DTLTO is:
3030
This may occur in the future, at which point a different set of constraints
3131
will apply.
3232

33-
- `-mllvm -thinlto-distributor-arg=<arg>`
33+
- ``-mllvm -thinlto-distributor-arg=<arg>``
3434
Specifies `<arg>` on the command line when invoking the distributor.
3535

36-
- `-mllvm -thinlto-remote-opt-tool-arg=<arg>`
36+
- ``-mllvm -thinlto-remote-opt-tool-arg=<arg>``
3737
Specifies `<arg>` on the command line to the remote optimisation tool. These
3838
arguments are appended to the end of the command line for the remote
3939
optimisation tool.
@@ -44,10 +44,10 @@ properties of the distribution system (as such additional input/output files may
4444
not be pushed to or fetched from distribution system nodes correctly). If such
4545
options are required, then the distributor can be modified to accept switches
4646
that specify additional input/output dependencies, and
47-
`-Xdist`/`-thinlto-distributor-arg=` can be used to pass such options through
47+
``-Xdist``/``-thinlto-distributor-arg=`` can be used to pass such options through
4848
to the distributor.
4949

50-
Some LLD LTO options (e.g., `--lto-sample-profile=<file>`) are supported.
50+
Some LLD LTO options (e.g., ``--lto-sample-profile=<file>``) are supported.
5151
Currently, other options are silently accepted but do not have the desired
5252
effect. Support for such options will be expanded in the future.
5353

@@ -56,5 +56,5 @@ COFF LLD
5656

5757
The command line interface for COFF LLD is generally the same as for ELF LLD.
5858

59-
Currently, there is no DTLTO command line interface supplied for `Clang-cl`, as
59+
Currently, there is no DTLTO command line interface supplied for ``Clang-cl``, as
6060
users are expected to invoke LLD directly.

0 commit comments

Comments
 (0)