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

Commit 478a7c9

Browse files
committed
Reorder functions so that related functions come closer.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@312964 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b6bdc68 commit 478a7c9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

MinGW/Driver.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
using namespace lld;
3131
using namespace llvm;
3232

33+
LLVM_ATTRIBUTE_NORETURN static void error(const Twine &Msg) {
34+
errs() << Msg << "\n";
35+
exit(1);
36+
}
37+
3338
// Create OptTable
3439
enum {
3540
OPT_INVALID = 0,
@@ -60,9 +65,20 @@ class MinGWOptTable : public opt::OptTable {
6065
};
6166
} // namespace
6267

63-
LLVM_ATTRIBUTE_NORETURN static void error(const Twine &Msg) {
64-
errs() << Msg << "\n";
65-
exit(1);
68+
opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
69+
unsigned MissingIndex;
70+
unsigned MissingCount;
71+
72+
SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
73+
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
74+
75+
if (MissingCount)
76+
error(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
77+
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
78+
error("unknown argument: " + Arg->getSpelling());
79+
if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArgNoClaim(OPT_l))
80+
error("no input files");
81+
return Args;
6682
}
6783

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

97-
opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
98-
unsigned MissingIndex;
99-
unsigned MissingCount;
100-
101-
SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
102-
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
103-
104-
if (MissingCount)
105-
error(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
106-
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
107-
error("unknown argument: " + Arg->getSpelling());
108-
if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArgNoClaim(OPT_l))
109-
error("no input files");
110-
return Args;
111-
}
112-
113113
// Convert Unix-ish command line arguments to Windows-ish ones and
114114
// then call coff::link.
115115
bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {

0 commit comments

Comments
 (0)