aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc2/CompilationGraph.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:15:35 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:15:35 +0000
commit4c11a62d695d000260b41c80091dbec5683ff402 (patch)
tree6c4e15951834d6a5eb4f9d689f08699f24d3f481 /tools/llvmc2/CompilationGraph.cpp
parent76b1b24dc805c7a3adb4517443241ed3ecd0ba74 (diff)
Refactoring: split the function CompilationGraph::Build() into two parts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc2/CompilationGraph.cpp')
-rw-r--r--tools/llvmc2/CompilationGraph.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp
index f5cefbf0a9..4513d4a19a 100644
--- a/tools/llvmc2/CompilationGraph.cpp
+++ b/tools/llvmc2/CompilationGraph.cpp
@@ -245,12 +245,11 @@ FindToolChain(const sys::Path& In, const std::string* forceLanguage,
return &getNode(ChooseEdge(TV, InLangs)->ToolName());
}
-// Build the targets. Command-line options are passed through
-// temporary variables.
-int CompilationGraph::Build (const sys::Path& TempDir) {
-
- InputLanguagesSet InLangs;
-
+// Helper function used by Build().
+// Traverses initial portions of the toolchains (up to the first Join node).
+// This function is also responsible for handling the -x option.
+void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs,
+ const sys::Path& TempDir) {
// This is related to -x option handling.
cl::list<std::string>::const_iterator xIter = Languages.begin(),
xBegin = xIter, xEnd = Languages.end();
@@ -303,6 +302,16 @@ int CompilationGraph::Build (const sys::Path& TempDir) {
// Pass file through the chain starting at head.
PassThroughGraph(In, N, InLangs, TempDir);
}
+}
+
+// Build the targets. Command-line options are passed through
+// temporary variables.
+int CompilationGraph::Build (const sys::Path& TempDir) {
+
+ InputLanguagesSet InLangs;
+
+ // Traverse initial parts of the toolchains and fill in InLangs.
+ BuildInitial(InLangs, TempDir);
std::vector<const Node*> JTV;
TopologicalSortFilterJoinNodes(JTV);