IR: Split out getOperandAs(), NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-02-05 01:07:47 +00:00
parent a875e3d4d6
commit c760eff69f

View File

@ -105,8 +105,12 @@ protected:
}
~DebugNode() {}
template <class Ty> Ty *getOperandAs(unsigned I) const {
return cast_or_null<Ty>(getOperand(I));
}
StringRef getStringOperand(unsigned I) const {
if (auto *S = cast_or_null<MDString>(getOperand(I)))
if (auto *S = getOperandAs<MDString>(I))
return S->getString();
return StringRef();
}