Handle versioning of compile unit.

llvm-svn: 28855
This commit is contained in:
Jim Laskey 2006-06-19 12:54:15 +00:00
parent 14a59f5b6e
commit 005825407f
2 changed files with 11 additions and 0 deletions

@ -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);

@ -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();