本文整理汇总了C++中Tool::GenerateAction方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::GenerateAction方法的具体用法?C++ Tool::GenerateAction怎么用?C++ Tool::GenerateAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::GenerateAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PassThroughGraph
// Pass input file through the chain until we bump into a Join node or
// a node that says that it is the last.
void CompilationGraph::PassThroughGraph (const sys::Path& InFile,
const Node* StartNode,
const InputLanguagesSet& InLangs,
const sys::Path& TempDir) const {
bool Last = false;
sys::Path In = InFile;
const Node* CurNode = StartNode;
while(!Last) {
sys::Path Out;
Tool* CurTool = CurNode->ToolPtr.getPtr();
if (CurTool->IsJoin()) {
JoinTool& JT = dynamic_cast<JoinTool&>(*CurTool);
JT.AddToJoinList(In);
break;
}
// Since toolchains do not have to end with a Join node, we should
// check if this Node is the last.
if (!CurNode->HasChildren() || CurTool->IsLast()) {
if (!OutputFilename.empty()) {
Out.set(OutputFilename);
}
else {
Out.set(In.getBasename());
Out.appendSuffix(CurTool->OutputSuffix());
}
Last = true;
}
else {
Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix());
}
if (CurTool->GenerateAction(In, Out).Execute() != 0)
throw std::runtime_error("Tool returned error code!");
if (Last)
return;
CurNode = &getNode(ChooseEdge(CurNode->OutEdges,
InLangs,
CurNode->Name())->ToolName());
In = Out;
Out.clear();
}
}
示例2: PassThroughGraph
// Pass input file through the chain until we bump into a Join node or
// a node that says that it is the last.
int CompilationGraph::PassThroughGraph (const sys::Path& InFile,
const Node* StartNode,
const InputLanguagesSet& InLangs,
const sys::Path& TempDir,
const LanguageMap& LangMap) const {
sys::Path In = InFile;
const Node* CurNode = StartNode;
while(true) {
Tool* CurTool = CurNode->ToolPtr.getPtr();
if (CurTool->IsJoin()) {
JoinTool& JT = static_cast<JoinTool&>(*CurTool);
JT.AddToJoinList(In);
break;
}
Action CurAction;
if (int ret = CurTool->GenerateAction(CurAction, In, CurNode->HasChildren(),
TempDir, InLangs, LangMap)) {
return ret;
}
if (int ret = CurAction.Execute())
return ret;
if (CurAction.StopCompilation())
return 0;
const Edge* Edg = ChooseEdge(CurNode->OutEdges, InLangs, CurNode->Name());
if (Edg == 0)
return 1;
CurNode = getNode(Edg->ToolName());
if (CurNode == 0)
return 1;
In = CurAction.OutFile();
}
return 0;
}