diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2010-08-23 19:24:08 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2010-08-23 19:24:08 +0000 |
commit | bf38e0749d83988140fac15b7c55050a089db159 (patch) | |
tree | cf9197727464241243fcc801f9d52acf85186377 /llvm/lib/CompilerDriver/CompilationGraph.cpp | |
parent | 0e6cfd74919c8573fa71cf5aabb86c38a7420ebf (diff) | |
download | bcm5719-llvm-bf38e0749d83988140fac15b7c55050a089db159.tar.gz bcm5719-llvm-bf38e0749d83988140fac15b7c55050a089db159.zip |
llvmc: Properly handle (error) in edge properties.
llvm-svn: 111827
Diffstat (limited to 'llvm/lib/CompilerDriver/CompilationGraph.cpp')
-rw-r--r-- | llvm/lib/CompilerDriver/CompilationGraph.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CompilerDriver/CompilationGraph.cpp b/llvm/lib/CompilerDriver/CompilationGraph.cpp index 259911f7137..a217078ffab 100644 --- a/llvm/lib/CompilerDriver/CompilationGraph.cpp +++ b/llvm/lib/CompilerDriver/CompilationGraph.cpp @@ -46,19 +46,24 @@ namespace llvmc { namespace { - /// ChooseEdge - Return the edge with the maximum weight. + /// ChooseEdge - Return the edge with the maximum weight. Returns 0 on error. template <class C> const Edge* ChooseEdge(const C& EdgesContainer, const InputLanguagesSet& InLangs, const std::string& NodeName = "root") { const Edge* MaxEdge = 0; - unsigned MaxWeight = 0; + int MaxWeight = 0; bool SingleMax = true; for (typename C::const_iterator B = EdgesContainer.begin(), E = EdgesContainer.end(); B != E; ++B) { const Edge* e = B->getPtr(); - unsigned EW = e->Weight(InLangs); + int EW = e->Weight(InLangs); + if (EW < 0) { + // (error) invocation in TableGen -> we don't need to print an error + // message. + return 0; + } if (EW > MaxWeight) { MaxEdge = e; MaxWeight = EW; @@ -474,7 +479,7 @@ int CompilationGraph::CheckMultipleDefaultEdges() const { for (const_nodes_iterator B = this->NodesMap.begin(), E = this->NodesMap.end(); B != E; ++B) { const Node& N = B->second; - unsigned MaxWeight = 0; + int MaxWeight = 0; // Ignore the root node. if (!N.ToolPtr) @@ -482,7 +487,7 @@ int CompilationGraph::CheckMultipleDefaultEdges() const { for (Node::const_iterator EB = N.EdgesBegin(), EE = N.EdgesEnd(); EB != EE; ++EB) { - unsigned EdgeWeight = (*EB)->Weight(Dummy); + int EdgeWeight = (*EB)->Weight(Dummy); if (EdgeWeight > MaxWeight) { MaxWeight = EdgeWeight; } |