From 40c7e4142e2327a540eceb640392a6da4ccfb3bf Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 20 Jul 2011 22:18:50 +0000 Subject: There are two ways to map a variable to its lexical scope. Lexical scope information is embedded in MDNode describing the variable. It is also available as a part of DebugLoc attached with DBG_VALUE instruction. DebugLoc attached with an instruction is less reliable in optimized code so use information embedded in the MDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135629 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DebugInfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Analysis/DebugInfo.cpp') diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 4dcf04ef21..dd85a4fcc8 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -116,6 +116,12 @@ unsigned DIVariable::getNumAddrElements() const { return DbgNode->getNumOperands()-8; } +/// getInlinedAt - If this variable is inlined then return inline location. +MDNode *DIVariable::getInlinedAt() { + if (getVersion() <= llvm::LLVMDebugVersion9) + return NULL; + return dyn_cast_or_null(DbgNode->getOperand(7)); +} //===----------------------------------------------------------------------===// // Predicates -- cgit v1.2.3