Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Reorder functions so that related functions come closer.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@312964 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rui314 committed Sep 11, 2017
1 parent b6bdc68 commit 478a7c9
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions MinGW/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
using namespace lld;
using namespace llvm;

LLVM_ATTRIBUTE_NORETURN static void error(const Twine &Msg) {
errs() << Msg << "\n";
exit(1);
}

// Create OptTable
enum {
OPT_INVALID = 0,
Expand Down Expand Up @@ -60,9 +65,20 @@ class MinGWOptTable : public opt::OptTable {
};
} // namespace

LLVM_ATTRIBUTE_NORETURN static void error(const Twine &Msg) {
errs() << Msg << "\n";
exit(1);
opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;

SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);

if (MissingCount)
error(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
error("unknown argument: " + Arg->getSpelling());
if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArgNoClaim(OPT_l))
error("no input files");
return Args;
}

// Find a file by concatenating given paths.
Expand Down Expand Up @@ -94,22 +110,6 @@ searchLibrary(StringRef Name, ArrayRef<StringRef> SearchPaths, bool BStatic) {
error("unable to find library -l" + Name);
}

opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;

SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);

if (MissingCount)
error(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
error("unknown argument: " + Arg->getSpelling());
if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArgNoClaim(OPT_l))
error("no input files");
return Args;
}

// Convert Unix-ish command line arguments to Windows-ish ones and
// then call coff::link.
bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
Expand Down

0 comments on commit 478a7c9

Please sign in to comment.