diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2009-01-09 16:16:27 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2009-01-09 16:16:27 +0000 |
commit | f8c430b3da9a9f6ebd9fc070bf409435d65bb4f2 (patch) | |
tree | a3d5dc61c2579b6e0eae1edafddc27bb96f00d87 /include | |
parent | b24380804cdaab8b2ecc044acf7ee239027b3094 (diff) | |
download | external_llvm-f8c430b3da9a9f6ebd9fc070bf409435d65bb4f2.zip external_llvm-f8c430b3da9a9f6ebd9fc070bf409435d65bb4f2.tar.gz external_llvm-f8c430b3da9a9f6ebd9fc070bf409435d65bb4f2.tar.bz2 |
Add a --check-graph option to llvmc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CompilerDriver/CompilationGraph.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/include/llvm/CompilerDriver/CompilationGraph.h b/include/llvm/CompilerDriver/CompilationGraph.h index 029623f..090ff5f 100644 --- a/include/llvm/CompilerDriver/CompilationGraph.h +++ b/include/llvm/CompilerDriver/CompilationGraph.h @@ -123,6 +123,9 @@ namespace llvmc { public: + typedef nodes_map_type::iterator nodes_iterator; + typedef nodes_map_type::const_iterator const_nodes_iterator; + CompilationGraph(); /// insertNode - Insert a new node into the graph. Takes @@ -137,6 +140,11 @@ namespace llvmc { /// options are passed implicitly as global variables. int Build(llvm::sys::Path const& TempDir, const LanguageMap& LangMap); + /// Check - Check the compilation graph for common errors like + /// cycles, input/output language mismatch and multiple default + /// edges. Prints error messages and in case it finds any errors. + int Check(); + /// getNode - Return a reference to the node correponding to the /// given tool name. Throws std::runtime_error. Node& getNode(const std::string& ToolName); @@ -171,7 +179,8 @@ namespace llvmc { const llvm::sys::Path& TempDir, const LanguageMap& LangMap) const; - /// FindToolChain - Find head of the toolchain corresponding to the given file. + /// FindToolChain - Find head of the toolchain corresponding to + /// the given file. const Node* FindToolChain(const llvm::sys::Path& In, const std::string* ForceLanguage, InputLanguagesSet& InLangs, @@ -187,6 +196,18 @@ namespace llvmc { /// TopologicalSortFilterJoinNodes - Call TopologicalSort and /// filter the resulting list to include only Join nodes. void TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out); + + // Functions used to implement Check(). + + /// CheckLanguageNames - Check that output/input language names + /// match for all nodes. + int CheckLanguageNames() const; + /// CheckMultipleDefaultEdges - check that there are no multiple + /// default default edges. + int CheckMultipleDefaultEdges() const; + /// CheckCycles - Check that there are no cycles in the graph. + int CheckCycles(); + }; // GraphTraits support code. @@ -194,8 +215,8 @@ namespace llvmc { /// NodesIterator - Auxiliary class needed to implement GraphTraits /// support. Can be generalised to something like value_iterator /// for map-like containers. - class NodesIterator : public llvm::StringMap<Node>::iterator { - typedef llvm::StringMap<Node>::iterator super; + class NodesIterator : public CompilationGraph::nodes_iterator { + typedef CompilationGraph::nodes_iterator super; typedef NodesIterator ThisType; typedef Node* pointer; typedef Node& reference; |