Skip to content

Commit

Permalink
IR: Add getRaw() helper, NFC
Browse files Browse the repository at this point in the history
llvm-svn: 229947
  • Loading branch information
dexonsmith committed Feb 20, 2015
1 parent d16a9b1 commit 9c73c4a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions llvm/include/llvm/IR/DebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -928,26 +928,28 @@ class DIExpression : public DIDescriptor {
///
/// 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);
}
Expand Down

0 comments on commit 9c73c4a

Please sign in to comment.