[cfe-commits] r66067 - in /cfe/trunk: include/clang/Driver/Option.h lib/Driver/OptTable.cpp lib/Driver/Option.cpp
Daniel Dunbar
daniel at zuster.org
Wed Mar 4 13:05:25 PST 2009
Author: ddunbar
Date: Wed Mar 4 15:05:23 2009
New Revision: 66067
URL: http://llvm.org/viewvc/llvm-project?rev=66067&view=rev
Log:
Driver: Add Option flags.
Modified:
cfe/trunk/include/clang/Driver/Option.h
cfe/trunk/lib/Driver/OptTable.cpp
cfe/trunk/lib/Driver/Option.cpp
Modified: cfe/trunk/include/clang/Driver/Option.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=66067&r1=66066&r2=66067&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Option.h (original)
+++ cfe/trunk/include/clang/Driver/Option.h Wed Mar 4 15:05:23 2009
@@ -61,6 +61,23 @@
/// Option that this is an alias for, if any.
const Option *Alias;
+ /// Unsupported options will not be rejected.
+ bool Unsupported : 1;
+
+ /// Treat this option like a linker input?
+ bool LinkerInput : 1;
+
+ /// When rendering as an input, don't render the option.
+
+ // FIXME: We should ditch the render/renderAsInput distinction.
+ bool NoOptAsInput : 1;
+
+ /// Always render this option as separate form its value.
+ bool ForceSeparateRender : 1;
+
+ /// Always render this option joined with its value.
+ bool ForceJoinedRender : 1;
+
protected:
Option(OptionClass Kind, const char *Name,
const OptionGroup *Group, const Option *Alias);
@@ -72,6 +89,21 @@
const OptionGroup *getGroup() const { return Group; }
const Option *getAlias() const { return Alias; }
+ bool isUnsupported() const { return Unsupported; }
+ void setUnsupported(bool Value) { Unsupported = Value; }
+
+ bool isLinkerInput() const { return LinkerInput; }
+ void setLinkerInput(bool Value) { LinkerInput = Value; }
+
+ bool isNoOptAsInput() const { return NoOptAsInput; }
+ void setNoOptAsInput(bool Value) { NoOptAsInput = Value; }
+
+ bool isForceSeparateRender() const { return ForceSeparateRender; }
+ void setForceSeparateRender(bool Value) { ForceSeparateRender = Value; }
+
+ bool isForceJoinedRender() const { return ForceJoinedRender; }
+ void setForceJoinedRender(bool Value) { ForceJoinedRender = Value; }
+
/// getUnaliasedOption - Return the final option this option
/// aliases (itself, if the option has no alias).
const Option *getUnaliasedOption() const {
Modified: cfe/trunk/lib/Driver/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=66067&r1=66066&r2=66067&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/OptTable.cpp (original)
+++ cfe/trunk/lib/Driver/OptTable.cpp Wed Mar 4 15:05:23 2009
@@ -95,21 +95,14 @@
Opt = new JoinedAndSeparateOption(info.Name, Group, Alias); break;
}
- // FIXME: Set flags.
for (const char *s = info.Flags; *s; ++s) {
switch (*s) {
- default:
- assert(0 && "Invalid option flag.");
- case 'l':
- break;
- case 'i':
- break;
- case 'J':
- break;
- case 'S':
- break;
- case 'U':
- break;
+ default: assert(0 && "Invalid option flag.");
+ case 'l': Opt->setLinkerInput(true); break;
+ case 'i': Opt->setNoOptAsInput(true); break;
+ case 'J': Opt->setForceJoinedRender(true); break;
+ case 'S': Opt->setForceSeparateRender(true); break;
+ case 'U': Opt->setUnsupported(true); break;
}
}
Modified: cfe/trunk/lib/Driver/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=66067&r1=66066&r2=66067&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Option.cpp (original)
+++ cfe/trunk/lib/Driver/Option.cpp Wed Mar 4 15:05:23 2009
@@ -15,7 +15,10 @@
Option::Option(OptionClass _Kind, const char *_Name,
const OptionGroup *_Group, const Option *_Alias)
- : Kind(_Kind), Name(_Name), Group(_Group), Alias(_Alias) {
+ : Kind(_Kind), Name(_Name), Group(_Group), Alias(_Alias),
+ Unsupported(false), LinkerInput(false), NoOptAsInput(false),
+ ForceSeparateRender(false), ForceJoinedRender(false)
+{
// Multi-level aliases are not supported, and alias options cannot
// have groups. This just simplifies option tracking, it is not an
More information about the cfe-commits
mailing list