Do not rely on getCompileUnit() to find source file information for a subprogram.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99410 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2010-03-24 18:48:00 +00:00
parent 7d85ac09f8
commit 8fe7979c41
2 changed files with 77 additions and 2 deletions

View File

@@ -395,8 +395,21 @@ namespace llvm {
}
unsigned isArtificial() const { return getUnsignedField(14); }
StringRef getFilename() const { return getCompileUnit().getFilename();}
StringRef getDirectory() const { return getCompileUnit().getDirectory();}
StringRef getFilename() const {
if (getVersion() == llvm::LLVMDebugVersion7)
return getCompileUnit().getFilename();
DIFile F = getFieldAs<DIFile>(6);
return F.getFilename();
}
StringRef getDirectory() const {
if (getVersion() == llvm::LLVMDebugVersion7)
return getCompileUnit().getFilename();
DIFile F = getFieldAs<DIFile>(6);
return F.getDirectory();
}
/// Verify - Verify that a subprogram descriptor is well formed.
bool Verify() const;