From d8d97ce857121b31ce2508f48cb3d2e46f72ec4b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 10 Nov 2002 06:47:03 +0000 Subject: [PATCH] Fix a problem where bad graphs could be generated git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4671 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/Support/GraphWriter.h | 4 +++- include/llvm/Support/GraphWriter.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/Support/GraphWriter.h b/include/Support/GraphWriter.h index 02269994e61..5481274a3f7 100644 --- a/include/Support/GraphWriter.h +++ b/include/Support/GraphWriter.h @@ -126,7 +126,6 @@ public: // Figure out which edge this targets... unsigned Offset = std::distance(GTraits::child_begin(TargetNode), TargetIt); - if (Offset > 64) Offset = 64; // Targetting the truncated part? DestPort = (int)Offset; } @@ -160,6 +159,9 @@ public: void emitEdge(const void *SrcNodeID, int SrcNodePort, const void *DestNodeID, int DestNodePort, const std::string &Attrs) { + if (SrcNodePort > 64) return; // Eminating from truncated part? + if (DestNodePort > 64) DestNodePort = 64; // Targetting the truncated part? + O << "\tNode" << SrcNodeID; if (SrcNodePort >= 0) O << ":g" << SrcNodePort; diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 02269994e61..5481274a3f7 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -126,7 +126,6 @@ public: // Figure out which edge this targets... unsigned Offset = std::distance(GTraits::child_begin(TargetNode), TargetIt); - if (Offset > 64) Offset = 64; // Targetting the truncated part? DestPort = (int)Offset; } @@ -160,6 +159,9 @@ public: void emitEdge(const void *SrcNodeID, int SrcNodePort, const void *DestNodeID, int DestNodePort, const std::string &Attrs) { + if (SrcNodePort > 64) return; // Eminating from truncated part? + if (DestNodePort > 64) DestNodePort = 64; // Targetting the truncated part? + O << "\tNode" << SrcNodeID; if (SrcNodePort >= 0) O << ":g" << SrcNodePort; -- 2.34.1