내 llvm
코드에서 이터레이터 InsertPos이 다음 코드를 사용하여 기본 블록의 마지막 명령을 가리키는 지 확인하려고합니다.반복자의 동등성을 검사하는 방법은 무엇입니까?
BasicBlock::iterator InsertPos = BB->begin();
LLVMContext &Context = BB->getContext();
while (!(isa<CallInst>(InsertPos) ||
(InsertPos == BB->getTerminator()))) // <-- Error here
++InsertPos;
그러나 clang
은 다음과 같은 오류가 발생합니다.
Basic2.cpp:82:54: error: use of overloaded operator '==' is ambiguous (with operand types 'BasicBlock::iterator' (aka 'ilist_iterator<llvm::Instruction>')
and 'llvm::TerminatorInst *')
while (!(isa<CallInst>(InsertPos) || (InsertPos == BB->getTerminator())))
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/hmushtaq/llvm/include/llvm/ADT/ilist.h:204:8: note: candidate function
bool operator==(const ilist_iterator &RHS) const {
^
Basic2.cpp:82:54: note: built-in candidate operator==(class llvm::Instruction *, class llvm::Instruction *)
while (!(isa<CallInst>(InsertPos) || (InsertPos == BB->getTerminator())))
^
Basic2.cpp:82:54: note: built-in candidate operator==(restrict class llvm::Instruction *, restrict class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(const restrict class llvm::Instruction *, const restrict class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(volatile class llvm::Instruction *, volatile class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(const volatile class llvm::Instruction *, const volatile class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(volatile restrict class llvm::Instruction *, volatile restrict class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(const class llvm::Instruction *, const class llvm::Instruction *)
Basic2.cpp:82:54: note: built-in candidate operator==(const volatile restrict class llvm::Instruction *, const volatile restrict class llvm::Instruction *)
올바른 방법은 무엇입니까? InsertPos
이 반복자 (BasicBlock::iterator
가) 동안