aboutsummaryrefslogtreecommitdiff
path: root/lib/CompilerDriver/CompilationGraph.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-08-23 19:24:08 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-08-23 19:24:08 +0000
commit7555f0a2bc8c6f052bb3563cd27c316bf68e7661 (patch)
tree0178c5707989637958769eb988472729c3fe7cfa /lib/CompilerDriver/CompilationGraph.cpp
parentc712edc785cf8a028115049ed7a05a4b4af15c00 (diff)
llvmc: Properly handle (error) in edge properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CompilerDriver/CompilationGraph.cpp')
-rw-r--r--lib/CompilerDriver/CompilationGraph.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/CompilerDriver/CompilationGraph.cpp b/lib/CompilerDriver/CompilationGraph.cpp
index 259911f713..a217078ffa 100644
--- a/lib/CompilerDriver/CompilationGraph.cpp
+++ b/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;
}