Driver: Add "d" flag to Options.def for options which are completely
handled by driver.
- This is not very precise, we use it to drive the "forward-to-gcc"
predicate, when trying to talk to a generic gcc tool.
- Slightly better than what ccc was doing, and should be good
enough. Platforms which want a robust driver should implement a
proper tool chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67181 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp
index 54e5ee1..7b7e2a7 100644
--- a/lib/Driver/OptTable.cpp
+++ b/lib/Driver/OptTable.cpp
@@ -29,7 +29,7 @@
static Info OptionInfos[] = {
// The InputOption info
- { "<input>", "", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
+ { "<input>", "d", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
// The UnknownOption info
{ "<unknown>", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
@@ -107,14 +107,24 @@
for (const char *s = info.Flags; *s; ++s) {
switch (*s) {
default: assert(0 && "Invalid option flag.");
- case 'J': Opt->setForceJoinedRender(true); break;
- case 'S': Opt->setForceSeparateRender(true); break;
+ case 'J':
+ assert(info.Kind == Option::SeparateClass && "Invalid option.");
+ Opt->setForceJoinedRender(true); break;
+ case 'S':
+ assert(info.Kind == Option::JoinedClass && "Invalid option.");
+ Opt->setForceSeparateRender(true); break;
+ case 'd': Opt->setForwardToGCC(false); break;
case 'i': Opt->setNoOptAsInput(true); break;
case 'l': Opt->setLinkerInput(true); break;
case 'u': Opt->setUnsupported(true); break;
}
}
+ // Linker inputs shouldn't be forwarded to GCC as arguments (they
+ // will, however, be forwarded as inputs).
+ if (Opt->isLinkerInput())
+ Opt->setForwardToGCC(false);
+
return Opt;
}