forked from OSchip/llvm-project
parent
4fc84a0dcd
commit
1432699cb2
|
@ -1853,6 +1853,24 @@ void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// EmitForEachListElementCycleHeader - Emit common code for iterating through
|
||||||
|
/// all elements of a list. Helper function used by
|
||||||
|
/// EmitForwardOptionPropertyHandlingCode.
|
||||||
|
void EmitForEachListElementCycleHeader (const OptionDescription& D,
|
||||||
|
unsigned IndentLevel,
|
||||||
|
raw_ostream& O) {
|
||||||
|
unsigned IndentLevel1 = IndentLevel + Indent1;
|
||||||
|
|
||||||
|
O.indent(IndentLevel)
|
||||||
|
<< "for (" << D.GenTypeDeclaration()
|
||||||
|
<< "::iterator B = " << D.GenVariableName() << ".begin(),\n";
|
||||||
|
O.indent(IndentLevel)
|
||||||
|
<< "E = " << D.GenVariableName() << ".end(); B != E;) {\n";
|
||||||
|
O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
|
||||||
|
<< ".getPosition(B - " << D.GenVariableName()
|
||||||
|
<< ".begin());\n";
|
||||||
|
}
|
||||||
|
|
||||||
/// EmitForwardOptionPropertyHandlingCode - Helper function used to
|
/// EmitForwardOptionPropertyHandlingCode - Helper function used to
|
||||||
/// implement EmitActionHandler. Emits code for
|
/// implement EmitActionHandler. Emits code for
|
||||||
/// handling the (forward) and (forward_as) option properties.
|
/// handling the (forward) and (forward_as) option properties.
|
||||||
|
@ -1893,16 +1911,7 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
|
||||||
<< D.GenVariableName() << "));\n";
|
<< D.GenVariableName() << "));\n";
|
||||||
break;
|
break;
|
||||||
case OptionType::PrefixList:
|
case OptionType::PrefixList:
|
||||||
// TODO: remove duplication across PrefixList / ParameterList / SwitchList
|
EmitForEachListElementCycleHeader(D, IndentLevel, O);
|
||||||
// branches
|
|
||||||
O.indent(IndentLevel)
|
|
||||||
<< "for (" << D.GenTypeDeclaration()
|
|
||||||
<< "::iterator B = " << D.GenVariableName() << ".begin(),\n";
|
|
||||||
O.indent(IndentLevel)
|
|
||||||
<< "E = " << D.GenVariableName() << ".end(); B != E;) {\n";
|
|
||||||
O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
|
|
||||||
<< ".getPosition(B - " << D.GenVariableName()
|
|
||||||
<< ".begin());\n";
|
|
||||||
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
||||||
<< Name << "\" + " << "*B));\n";
|
<< Name << "\" + " << "*B));\n";
|
||||||
O.indent(IndentLevel1) << "++B;\n";
|
O.indent(IndentLevel1) << "++B;\n";
|
||||||
|
@ -1915,14 +1924,7 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
|
||||||
O.indent(IndentLevel) << "}\n";
|
O.indent(IndentLevel) << "}\n";
|
||||||
break;
|
break;
|
||||||
case OptionType::ParameterList:
|
case OptionType::ParameterList:
|
||||||
O.indent(IndentLevel)
|
EmitForEachListElementCycleHeader(D, IndentLevel, O);
|
||||||
<< "for (" << D.GenTypeDeclaration() << "::iterator B = "
|
|
||||||
<< D.GenVariableName() << ".begin(),\n";
|
|
||||||
O.indent(IndentLevel) << "E = " << D.GenVariableName()
|
|
||||||
<< ".end() ; B != E;) {\n";
|
|
||||||
O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
|
|
||||||
<< ".getPosition(B - " << D.GenVariableName()
|
|
||||||
<< ".begin());\n";
|
|
||||||
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
||||||
<< Name << "\"));\n";
|
<< Name << "\"));\n";
|
||||||
|
|
||||||
|
@ -1934,14 +1936,7 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
|
||||||
O.indent(IndentLevel) << "}\n";
|
O.indent(IndentLevel) << "}\n";
|
||||||
break;
|
break;
|
||||||
case OptionType::SwitchList:
|
case OptionType::SwitchList:
|
||||||
O.indent(IndentLevel)
|
EmitForEachListElementCycleHeader(D, IndentLevel, O);
|
||||||
<< "for (" << D.GenTypeDeclaration() << "::iterator B = "
|
|
||||||
<< D.GenVariableName() << ".begin(),\n";
|
|
||||||
O.indent(IndentLevel) << "E = " << D.GenVariableName()
|
|
||||||
<< ".end() ; B != E;) {\n";
|
|
||||||
O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
|
|
||||||
<< ".getPosition(B - " << D.GenVariableName()
|
|
||||||
<< ".begin());\n";
|
|
||||||
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
|
||||||
<< Name << "\"));\n";
|
<< Name << "\"));\n";
|
||||||
O.indent(IndentLevel1) << "++B;\n";
|
O.indent(IndentLevel1) << "++B;\n";
|
||||||
|
|
Loading…
Reference in New Issue