diff --git a/include/llvm/CompilerDriver/CompilationGraph.h b/include/llvm/CompilerDriver/CompilationGraph.h index b03f144f1bc..6bb649b99c3 100644 --- a/include/llvm/CompilerDriver/CompilationGraph.h +++ b/include/llvm/CompilerDriver/CompilationGraph.h @@ -261,16 +261,19 @@ namespace llvmc { return *this; } - inline bool operator==(const ThisType& I) const - { return EdgeIter == I.EdgeIter; } - inline bool operator!=(const ThisType& I) const - { return EdgeIter != I.EdgeIter; } + inline bool operator==(const ThisType& I) const { + assert(OwningGraph == I.OwningGraph); + return EdgeIter == I.EdgeIter; + } + inline bool operator!=(const ThisType& I) const { + return !this->operator==(I); + } inline pointer operator*() const { return &OwningGraph->getNode((*EdgeIter)->ToolName()); } inline pointer operator->() const { - return &OwningGraph->getNode((*EdgeIter)->ToolName()); + return this->operator*(); } ThisType& operator++() { ++EdgeIter; return *this; } // Preincrement