llvm.org GIT mirror llvm / 4c11a62
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 Mikhail Glushenkov 12 years ago
2 changed file(s) with 22 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
244244 return &getNode(ChooseEdge(TV, InLangs)->ToolName());
245245 }
246246
247 // Build the targets. Command-line options are passed through
248 // temporary variables.
249 int CompilationGraph::Build (const sys::Path& TempDir) {
250
251 InputLanguagesSet InLangs;
252
247 // Helper function used by Build().
248 // Traverses initial portions of the toolchains (up to the first Join node).
249 // This function is also responsible for handling the -x option.
250 void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs,
251 const sys::Path& TempDir) {
253252 // This is related to -x option handling.
254253 cl::list::const_iterator xIter = Languages.begin(),
255254 xBegin = xIter, xEnd = Languages.end();
302301 // Pass file through the chain starting at head.
303302 PassThroughGraph(In, N, InLangs, TempDir);
304303 }
304 }
305
306 // Build the targets. Command-line options are passed through
307 // temporary variables.
308 int CompilationGraph::Build (const sys::Path& TempDir) {
309
310 InputLanguagesSet InLangs;
311
312 // Traverse initial parts of the toolchains and fill in InLangs.
313 BuildInitial(InLangs, TempDir);
305314
306315 std::vector JTV;
307316 TopologicalSortFilterJoinNodes(JTV);
1919 #include "llvm/ADT/GraphTraits.h"
2020 #include "llvm/ADT/IntrusiveRefCntPtr.h"
2121 #include "llvm/ADT/iterator"
22 //#include "llvm/ADT/SmallSet.h"
22 #include "llvm/ADT/SmallSet.h"
2323 #include "llvm/ADT/SmallVector.h"
2424 #include "llvm/ADT/StringMap.h"
2525 #include "llvm/System/Path.h"
2626
27 #include
2827 #include
2928
3029 namespace llvmc {
3130
32 typedef std::set> InputLanguagesSet;
31 typedef llvm::SmallSet> InputLanguagesSet;
3332
3433 // An edge of the compilation graph.
3534 class Edge : public llvm::RefCountedBaseVPTR {
161160 // the given language name. Throws std::runtime_error.
162161 const tools_vector_type& getToolsVector(const std::string& LangName) const;
163162
164 // Pass the input file through the toolchain.
163 // Pass the input file through the toolchain starting at StartNode.
165164 void PassThroughGraph (const llvm::sys::Path& In, const Node* StartNode,
166165 const InputLanguagesSet& InLangs,
167166 const llvm::sys::Path& TempDir) const;
170169 const Node* FindToolChain(const llvm::sys::Path& In,
171170 const std::string* forceLanguage,
172171 InputLanguagesSet& InLangs) const;
172
173 // Traverse the initial parts of the toolchains.
174 void BuildInitial(InputLanguagesSet& InLangs,
175 const llvm::sys::Path& TempDir);
173176
174177 // Sort the nodes in topological order.
175178 void TopologicalSort(std::vector& Out);