Skip to content

Commit

Permalink
[llvm-dlltool] Clarify parameters, simplify ArgList usage. NFC.
Browse files Browse the repository at this point in the history
Add comments about unclear bool arguments to functions, switch to
hasArg instead of getLastArg for cases where we don't need to check
the argument's value.

Differential Revision: https://reviews.llvm.org/D152360
  • Loading branch information
mstorsjo committed Jun 8, 2023
1 parent 9080f61 commit 8deeaef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
}

Expected<COFFModuleDefinition> Def =
parseCOFFModuleDefinition(*MB, Machine, true);
parseCOFFModuleDefinition(*MB, Machine, /*MingwDef=*/true);

if (!Def) {
llvm::errs() << "error parsing definition\n"
Expand Down Expand Up @@ -197,7 +197,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
}
}

if (Machine == IMAGE_FILE_MACHINE_I386 && Args.getLastArg(OPT_k)) {
if (Machine == IMAGE_FILE_MACHINE_I386 && Args.hasArg(OPT_k)) {
for (COFFShortExport& E : Def->Exports) {
if (!E.AliasTarget.empty() || (!E.Name.empty() && E.Name[0] == '?'))
continue;
Expand All @@ -214,8 +214,8 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
}
}

if (!Path.empty() &&
writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true))
if (!Path.empty() && writeImportLibrary(Def->OutputFile, Path, Def->Exports,
Machine, /*MinGW=*/true))
return 1;
return 0;
}

0 comments on commit 8deeaef

Please sign in to comment.