[llvm-commits] [lld] r171577 - in /lld/trunk: include/lld/Driver/Driver.h lib/Driver/CoreOptions.td lib/Driver/Drivers.cpp tools/lld/lld.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Fri Jan 4 16:46:45 PST 2013
Author: mspencer
Date: Fri Jan 4 18:46:45 2013
New Revision: 171577
URL: http://llvm.org/viewvc/llvm-project?rev=171577&view=rev
Log:
[Driver] Add -flavor core support. This will be tested by other tests using -flavor core.
Modified:
lld/trunk/include/lld/Driver/Driver.h
lld/trunk/lib/Driver/CoreOptions.td
lld/trunk/lib/Driver/Drivers.cpp
lld/trunk/tools/lld/lld.cpp
Modified: lld/trunk/include/lld/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=171577&r1=171576&r2=171577&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/Driver.h (original)
+++ lld/trunk/include/lld/Driver/Driver.h Fri Jan 4 18:46:45 2013
@@ -58,6 +58,9 @@
StringRef defaultTargetTriple);
};
+std::unique_ptr<llvm::opt::ArgList>
+parseCoreArgs(llvm::ArrayRef<const char *> args);
+
LinkerOptions generateOptions(const llvm::opt::ArgList &args);
} // end namespace lld
Modified: lld/trunk/lib/Driver/CoreOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreOptions.td?rev=171577&r1=171576&r2=171577&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CoreOptions.td (original)
+++ lld/trunk/lib/Driver/CoreOptions.td Fri Jan 4 18:46:45 2013
@@ -1,5 +1,6 @@
include "llvm/Option/OptParser.td"
+def flavor : Separate<["-"], "flavor">;
def target : Separate<["-"], "target">, HelpText<"Target triple to link for">;
def output : Joined<["-"], "output=">;
Modified: lld/trunk/lib/Driver/Drivers.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Drivers.cpp?rev=171577&r1=171576&r2=171577&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Drivers.cpp (original)
+++ lld/trunk/lib/Driver/Drivers.cpp Fri Jan 4 18:46:45 2013
@@ -166,6 +166,23 @@
}
}
+std::unique_ptr<llvm::opt::ArgList>
+lld::parseCoreArgs(llvm::ArrayRef<const char *> args) {
+ core::CoreOptTable core;
+ unsigned missingIndex, missingCount;
+ std::unique_ptr<llvm::opt::ArgList> list(
+ core.ParseArgs( args.begin(), args.end(), missingIndex, missingCount));
+
+ if (missingCount) {
+ llvm::errs() << "error: missing arg value for '"
+ << list->getArgString(missingIndex)
+ << "' expected " << missingCount << " argument(s).\n";
+ return std::unique_ptr<llvm::opt::ArgList>();
+ }
+
+ return list;
+}
+
LinkerOptions lld::generateOptions(const llvm::opt::ArgList &args) {
LinkerOptions ret;
Modified: lld/trunk/tools/lld/lld.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld/lld.cpp?rev=171577&r1=171576&r2=171577&view=diff
==============================================================================
--- lld/trunk/tools/lld/lld.cpp (original)
+++ lld/trunk/tools/lld/lld.cpp Fri Jan 4 18:46:45 2013
@@ -124,6 +124,9 @@
driver = Driver::create(iHazAFlavor, getDefaultTarget(argc, argv));
coreArgs = driver->transform(
llvm::ArrayRef<const char *>(argv + 1, argv + argc));
+ } else {
+ coreArgs = parseCoreArgs(
+ llvm::ArrayRef<const char *>(argv + 1, argv + argc));
}
if (!coreArgs)
More information about the llvm-commits
mailing list