summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2011-09-26 17:40:42 +0000
committerJames Molloy <james.molloy@arm.com>2011-09-26 17:40:42 +0000
commit439780eeaef1a2c6a1105fb705a27c5c819e8d0e (patch)
tree46b65cbbddb15ffedd5e7fd1ab952d194a2e5b04 /include
parent6272c5d874bb2b342b02a16aacc9806b4ac55ffe (diff)
downloadllvm-439780eeaef1a2c6a1105fb705a27c5c819e8d0e.tar.gz
llvm-439780eeaef1a2c6a1105fb705a27c5c819e8d0e.tar.bz2
llvm-439780eeaef1a2c6a1105fb705a27c5c819e8d0e.tar.xz
Fix emission of debug data for global variables. getContext() on DIGlobalVariables is not valid any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DebugInfo.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index b0cf17afc0..1022302868 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -579,6 +579,17 @@ namespace llvm {
DIFile F = getFieldAs<DIFile>(6);
return F.getCompileUnit();
}
+ StringRef getFilename() const {
+ if (getVersion() <= llvm::LLVMDebugVersion10)
+ return getContext().getFilename();
+ return getFieldAs<DIFile>(6).getFilename();
+ }
+ StringRef getDirectory() const {
+ if (getVersion() <= llvm::LLVMDebugVersion10)
+ return getContext().getDirectory();
+ return getFieldAs<DIFile>(6).getDirectory();
+
+ }
unsigned getLineNumber() const { return getUnsignedField(7); }
DIType getType() const { return getFieldAs<DIType>(8); }