aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-10-28 20:08:13 +0000
committerDevang Patel <dpatel@apple.com>2010-10-28 20:08:13 +0000
commit8f6a281e979df1578526fc8a72a3c1bd33aa3efa (patch)
tree474c7247464ed259ec96c158d5ce53b990ad58a1
parent787c33718da09d3f0e4600b30c7d59e6c2632966 (diff)
Backward compatibility. Gracefully handle older versions of debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117595 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DebugInfo.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 41d8e14aae..54508a77b1 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -272,10 +272,16 @@ namespace llvm {
return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
}
StringRef getDirectory() const {
+ if (getVersion() == llvm::LLVMDebugVersion7)
+ return getCompileUnit().getDirectory();
+
DIFile F = getFieldAs<DIFile>(3);
return F.getDirectory();
}
StringRef getFilename() const {
+ if (getVersion() == llvm::LLVMDebugVersion7)
+ return getCompileUnit().getFilename();
+
DIFile F = getFieldAs<DIFile>(3);
return F.getFilename();
}