mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-29 22:50:55 +00:00
Add a way to enable '-opt=foo' forwarding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96916 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a3f173237d
commit
a04d4ed690
@ -46,6 +46,7 @@ def optional;
|
||||
def really_hidden;
|
||||
def required;
|
||||
def comma_separated;
|
||||
def forward_not_split;
|
||||
|
||||
// The 'case' construct.
|
||||
def case;
|
||||
|
@ -229,7 +229,7 @@ namespace OptionDescriptionFlags {
|
||||
enum OptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
|
||||
ReallyHidden = 0x4, Extern = 0x8,
|
||||
OneOrMore = 0x10, Optional = 0x20,
|
||||
CommaSeparated = 0x40 };
|
||||
CommaSeparated = 0x40, ForwardNotSplit = 0x80 };
|
||||
}
|
||||
|
||||
/// OptionDescription - Represents data contained in a single
|
||||
@ -271,6 +271,9 @@ struct OptionDescription {
|
||||
bool isExtern() const;
|
||||
void setExtern();
|
||||
|
||||
bool isForwardNotSplit() const;
|
||||
void setForwardNotSplit();
|
||||
|
||||
bool isRequired() const;
|
||||
void setRequired();
|
||||
|
||||
@ -327,6 +330,13 @@ void OptionDescription::setCommaSeparated() {
|
||||
Flags |= OptionDescriptionFlags::CommaSeparated;
|
||||
}
|
||||
|
||||
bool OptionDescription::isForwardNotSplit() const {
|
||||
return Flags & OptionDescriptionFlags::ForwardNotSplit;
|
||||
}
|
||||
void OptionDescription::setForwardNotSplit() {
|
||||
Flags |= OptionDescriptionFlags::ForwardNotSplit;
|
||||
}
|
||||
|
||||
bool OptionDescription::isExtern() const {
|
||||
return Flags & OptionDescriptionFlags::Extern;
|
||||
}
|
||||
@ -586,6 +596,8 @@ public:
|
||||
AddHandler("required", &CollectOptionProperties::onRequired);
|
||||
AddHandler("optional", &CollectOptionProperties::onOptional);
|
||||
AddHandler("comma_separated", &CollectOptionProperties::onCommaSeparated);
|
||||
AddHandler("forward_not_split",
|
||||
&CollectOptionProperties::onForwardNotSplit);
|
||||
|
||||
staticMembersInitialized_ = true;
|
||||
}
|
||||
@ -629,6 +641,13 @@ private:
|
||||
optDesc_.setCommaSeparated();
|
||||
}
|
||||
|
||||
void onForwardNotSplit (const DagInit& d) {
|
||||
CheckNumberOfArguments(d, 0);
|
||||
if (!optDesc_.isParameter())
|
||||
throw "'forward_not_split' is valid only for parameter options!";
|
||||
optDesc_.setForwardNotSplit();
|
||||
}
|
||||
|
||||
void onRequired (const DagInit& d) {
|
||||
CheckNumberOfArguments(d, 0);
|
||||
if (optDesc_.isOneOrMore() || optDesc_.isOptional())
|
||||
@ -1792,8 +1811,16 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
|
||||
O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
|
||||
break;
|
||||
case OptionType::Parameter:
|
||||
O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
|
||||
O.indent(IndentLevel) << "vec.push_back(" << D.GenVariableName() << ");\n";
|
||||
O.indent(IndentLevel) << "vec.push_back(\"" << Name;
|
||||
|
||||
if (!D.isForwardNotSplit()) {
|
||||
O << "\");\n";
|
||||
O.indent(IndentLevel) << "vec.push_back("
|
||||
<< D.GenVariableName() << ");\n";
|
||||
}
|
||||
else {
|
||||
O << "=\" + " << D.GenVariableName() << ");\n";
|
||||
}
|
||||
break;
|
||||
case OptionType::Prefix:
|
||||
O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\" + "
|
||||
|
Loading…
Reference in New Issue
Block a user