[llvm] [IR] PossiblyExactOperator -> PossiblyExactInst (NFC) (PR #72501)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 07:10:44 PST 2023
================
@@ -314,7 +314,9 @@ void Instruction::setHasNoSignedWrap(bool b) {
}
void Instruction::setIsExact(bool b) {
- cast<PossiblyExactOperator>(this)->setIsExact(b);
+ assert(isa<PossiblyExactInst>(this) && "Instruction must support exact flag");
----------------
preames wrote:
The idiomatic structure for these accessors appears to be to implement them on the subclass, and then dispatch via a cast to that subclass. The way you implemented this is perfectly valid, but I think it'd be better to follow the convention just to keep the code structure analogous.
https://github.com/llvm/llvm-project/pull/72501
More information about the llvm-commits
mailing list