diff options
author | David Greene <greened@obbligato.org> | 2007-08-17 15:13:55 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2007-08-17 15:13:55 +0000 |
commit | fd273b6ed51494a99b585a92e60cdc68102fe371 (patch) | |
tree | b0881709f123e512ee15b58492c263e37f4f3c2b /lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp | |
parent | be3e41928007b4df283cc16194a24904e99c8175 (diff) |
Fix GLIBCXX_DEBUG error of comparing two singular iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp index 62854f76f9..f12e285416 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp @@ -164,12 +164,14 @@ private: NodeInfo *NI; // Node info NIIterator NGI; // Node group iterator NIIterator NGE; // Node group iterator end + bool iter_valid; public: // Ctor. - NodeGroupIterator(NodeInfo *N) : NI(N) { + NodeGroupIterator(NodeInfo *N) : NI(N), iter_valid(false) { // If the node is in a group then set up the group iterator. Otherwise // the group iterators will trip first time out. + assert(N && "Bad node info"); if (N->isInGroup()) { // get Group NodeGroup *Group = NI->Group; @@ -177,14 +179,17 @@ public: NGE = Group->group_end(); // Prevent this node from being used (will be in members list NI = NULL; + iter_valid = true; } } /// next - Return the next node info, otherwise NULL. /// NodeInfo *next() { - // If members list - if (NGI != NGE) return *NGI++; + if (iter_valid) { + // If members list + if (NGI != NGE) return *NGI++; + } // Use node as the result (may be NULL) NodeInfo *Result = NI; // Only use once |