IR: Split out getOperandAs(), NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 5 Feb 2015 01:07:47 +0000 (01:07 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 5 Feb 2015 01:07:47 +0000 (01:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228250 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/DebugInfoMetadata.h

index 0439e7f7b238636d060b71f3bf866499ac8d3928..ba0c2320f636b6038f79fe902a5d28b638756711 100644 (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();
   }