diff options
author | Devang Patel <dpatel@apple.com> | 2010-03-24 18:48:00 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-03-24 18:48:00 +0000 |
commit | 8fe7979c416cc5aad167329a2d7e7f5000f445fe (patch) | |
tree | 1d74c51db961abec994b875108ab5cf61ef46069 /include | |
parent | 7d85ac09f864bd0756c2a5be781e14b41b7521e6 (diff) | |
download | llvm-8fe7979c416cc5aad167329a2d7e7f5000f445fe.tar.gz llvm-8fe7979c416cc5aad167329a2d7e7f5000f445fe.tar.bz2 llvm-8fe7979c416cc5aad167329a2d7e7f5000f445fe.tar.xz |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 9b1d1b306f..4e8c4c85bf 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -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; |