From 788b96702b5f36cde16615588e771050bfd97fc9 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 20 Feb 2015 01:18:47 +0000 Subject: [PATCH] IR: Add getRaw() helper, NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229947 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DebugInfo.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index d31f107d913..f7d71e53702 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -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(get()); } + public: explicit DILocation(const MDNode *N) : DIDescriptor(N) {} unsigned getLineNumber() const { - if (auto *L = dyn_cast_or_null(DbgNode)) + if (auto *L = getRaw()) return L->getLine(); return 0; } unsigned getColumnNumber() const { - if (auto *L = dyn_cast_or_null(DbgNode)) + if (auto *L = getRaw()) return L->getColumn(); return 0; } DIScope getScope() const { - if (auto *L = dyn_cast_or_null(DbgNode)) + if (auto *L = getRaw()) return DIScope(dyn_cast_or_null(L->getScope())); return DIScope(nullptr); } DILocation getOrigLocation() const { - if (auto *L = dyn_cast_or_null(DbgNode)) + if (auto *L = getRaw()) return DILocation(dyn_cast_or_null(L->getInlinedAt())); return DILocation(nullptr); } -- 2.34.1