Backward compatibility. Gracefully handle older versions of debug info.
authorDevang Patel <dpatel@apple.com>
Thu, 28 Oct 2010 20:08:13 +0000 (20:08 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 28 Oct 2010 20:08:13 +0000 (20:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117595 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h

index 41d8e14aaed5b129d34f593a6af3a32643bcb568..54508a77b138d1a5c86122ad71960697eaa8eb64 100644 (file)
@@ -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();
     }