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
This commit is contained in:
James Molloy
2011-09-26 17:40:42 +00:00
parent 6272c5d874
commit 439780eeae
3 changed files with 60 additions and 2 deletions

View File

@@ -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); }