File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1693,6 +1693,8 @@ class BBIterator {
16931693 // / \Returns the SBInstruction that corresponds to this iterator, or null if
16941694 // / the instruction is not found in the IR-to-SandboxIR tables.
16951695 pointer get () const { return getInstr (It); }
1696+ // / \Returns the parent BB.
1697+ BasicBlock *getNodeParent () const ;
16961698};
16971699
16981700// / Contains a list of sandboxir::Instruction's.
Original file line number Diff line number Diff line change @@ -306,6 +306,11 @@ BBIterator &BBIterator::operator--() {
306306 return *this ;
307307}
308308
309+ BasicBlock *BBIterator::getNodeParent () const {
310+ llvm::BasicBlock *Parent = const_cast <BBIterator *>(this )->It .getNodeParent ();
311+ return cast<BasicBlock>(Ctx->getValue (Parent));
312+ }
313+
309314const char *Instruction::getOpcodeName (Opcode Opc) {
310315 switch (Opc) {
311316#define OP (OPC ) \
Original file line number Diff line number Diff line change @@ -1575,12 +1575,16 @@ define void @foo(i32 %v1) {
15751575 for (sandboxir::Instruction &I : BB0) {
15761576 EXPECT_EQ (&I, Ctx.getValue (LLVMI));
15771577 LLVMI = LLVMI->getNextNode ();
1578+ // Check getNodeParent().
1579+ EXPECT_EQ (I.getIterator ().getNodeParent (), &BB0);
15781580 }
15791581 LLVMI = &*LLVMBB1->begin ();
15801582 for (sandboxir::Instruction &I : BB1) {
15811583 EXPECT_EQ (&I, Ctx.getValue (LLVMI));
15821584 LLVMI = LLVMI->getNextNode ();
15831585 }
1586+ // Check NodeParent() for BB::end().
1587+ EXPECT_EQ (BB0.end ().getNodeParent (), &BB0);
15841588
15851589 // Check BB.getTerminator()
15861590 EXPECT_EQ (BB0.getTerminator (), Ctx.getValue (LLVMBB0->getTerminator ()));
You can’t perform that action at this time.
0 commit comments