[llvm] r228250 - IR: Split out getOperandAs(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed Feb 4 17:07:47 PST 2015
Author: dexonsmith
Date: Wed Feb 4 19:07:47 2015
New Revision: 228250
URL: http://llvm.org/viewvc/llvm-project?rev=228250&view=rev
Log:
IR: Split out getOperandAs(), NFC
Modified:
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=228250&r1=228249&r2=228250&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Wed Feb 4 19:07:47 2015
@@ -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();
}
More information about the llvm-commits
mailing list