Handle versioning of compile unit.
authorJim Laskey <jlaskey@mac.com>
Mon, 19 Jun 2006 12:54:15 +0000 (12:54 +0000)
committerJim Laskey <jlaskey@mac.com>
Mon, 19 Jun 2006 12:54:15 +0000 (12:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28855 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineDebugInfo.cpp
lib/VMCore/IntrinsicInst.cpp

index 97fecb482ba300a3a65725eb35c790800e6675b1..706beb8a8c371253aa40ccae268831ed373e926a 100644 (file)
@@ -614,6 +614,12 @@ bool CompileUnitDesc::classof(const DebugInfoDesc *D) {
 ///
 void CompileUnitDesc::ApplyToFields(DIVisitor *Visitor) {
   AnchoredDesc::ApplyToFields(Visitor);
+  
+  // Handle cases out of sync with compiler.
+  if (getVersion() == 0) {
+    unsigned DebugVersion;
+    Visitor->Apply(DebugVersion);
+  }
 
   Visitor->Apply(Language);
   Visitor->Apply(FileName);
index 2f3ade34c13950f0e03a6468228c76db8e0e33fc..9c2efc3881686aa6aa0529a04073a28830b83f3d 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "llvm/Constants.h"
 #include "llvm/GlobalVariable.h"
+#include "llvm/CodeGen/MachineDebugInfo.h"
 
 using namespace llvm;
 
@@ -59,12 +60,16 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) {
 ///
 
 std::string DbgStopPointInst::getFileName() const {
+  // Once the operand indices are verified, update this assert
+  assert(LLVMDebugVersion == (4 << 16) && "Verify operand indices");
   GlobalVariable *GV = cast<GlobalVariable>(getContext());
   ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
   return CS->getOperand(3)->getStringValue();
 }
 
 std::string DbgStopPointInst::getDirectory() const {
+  // Once the operand indices are verified, update this assert
+  assert(LLVMDebugVersion == (4 << 16) && "Verify operand indices");
   GlobalVariable *GV = cast<GlobalVariable>(getContext());
   ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
   return CS->getOperand(4)->getStringValue();