llvm.org GIT mirror llvm / d57a1ba
[PBQP] Check for out of bound access in DEBUG builds It is just too easy to use a virtual register intead of a NodeId without a compiler warning. This does not fix the fundamental problem, i.e. both have the same underlying types, but increases the likelyhood to detect it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220303 91177308-0d34-0410-b5e6-96231b3b80d8 Arnaud A. de Grandmaison 5 years ago
1 changed file(s) with 8 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
189189
190190 // ----- INTERNAL METHODS -----
191191
192 NodeEntry& getNode(NodeId NId) { return Nodes[NId]; }
193 const NodeEntry& getNode(NodeId NId) const { return Nodes[NId]; }
192 NodeEntry &getNode(NodeId NId) {
193 assert(NId < Nodes.size() && "Out of bound NodeId");
194 return Nodes[NId];
195 }
196 const NodeEntry &getNode(NodeId NId) const {
197 assert(NId < Nodes.size() && "Out of bound NodeId");
198 return Nodes[NId];
199 }
194200
195201 EdgeEntry& getEdge(EdgeId EId) { return Edges[EId]; }
196202 const EdgeEntry& getEdge(EdgeId EId) const { return Edges[EId]; }