[llvm] r229947 - IR: Add getRaw() helper, NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Feb 19 17:18:47 PST 2015


Author: dexonsmith
Date: Thu Feb 19 19:18:47 2015
New Revision: 229947

URL: http://llvm.org/viewvc/llvm-project?rev=229947&view=rev
Log:
IR: Add getRaw() helper, NFC

Modified:
    llvm/trunk/include/llvm/IR/DebugInfo.h

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=229947&r1=229946&r2=229947&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Thu Feb 19 19:18:47 2015
@@ -928,26 +928,28 @@ public:
 ///
 /// This object is not associated with any DWARF tag.
 class DILocation : public DIDescriptor {
+  MDLocation *getRaw() const { return dyn_cast_or_null<MDLocation>(get()); }
+
 public:
   explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
 
   unsigned getLineNumber() const {
-    if (auto *L = dyn_cast_or_null<MDLocation>(DbgNode))
+    if (auto *L = getRaw())
       return L->getLine();
     return 0;
   }
   unsigned getColumnNumber() const {
-    if (auto *L = dyn_cast_or_null<MDLocation>(DbgNode))
+    if (auto *L = getRaw())
       return L->getColumn();
     return 0;
   }
   DIScope getScope() const {
-    if (auto *L = dyn_cast_or_null<MDLocation>(DbgNode))
+    if (auto *L = getRaw())
       return DIScope(dyn_cast_or_null<MDNode>(L->getScope()));
     return DIScope(nullptr);
   }
   DILocation getOrigLocation() const {
-    if (auto *L = dyn_cast_or_null<MDLocation>(DbgNode))
+    if (auto *L = getRaw())
       return DILocation(dyn_cast_or_null<MDNode>(L->getInlinedAt()));
     return DILocation(nullptr);
   }





More information about the llvm-commits mailing list