bool Verify() const { return DbgNode != 0; }
- MDNode *getNode() const { return DbgNode; }
+ MDNode *getNode() const { return DbgNode; }
+ operator MDNode *() const { return DbgNode; }
+ MDNode *operator ->() const { return DbgNode; }
unsigned getVersion() const {
return getUnsignedField(0) & LLVMDebugVersionMask;
DICompositeType DCT(getFieldAs<DICompositeType>(8));
if (DCT.Verify()) {
DIArray A = DCT.getTypeArray();
- DIType T(A.getElement(0).getNode());
+ DIType T(A.getElement(0));
return T.getName();
}
DIType T(getFieldAs<DIType>(8));
// which, due to uniquing, has merged with the source. We shield clients from
// this detail by allowing a value to be replaced with replaceAllUsesWith()
// itself.
- if (getNode() != D.getNode()) {
+ if (getNode() != D) {
MDNode *Node = DbgNode;
- Node->replaceAllUsesWith(D.getNode());
+ Node->replaceAllUsesWith(D);
Node->destroy();
}
}
if (!BaseType.isValid())
return getSizeInBits();
if (BaseType.isDerivedType())
- return DIDerivedType(BaseType.getNode()).getOriginalTypeSize();
+ return DIDerivedType(BaseType).getOriginalTypeSize();
else
return BaseType.getSizeInBits();
}
return false;
// This variable is not inlined function argument if its scope
// does not describe current function.
- return !(DISubprogram(getContext().getNode()).describes(CurFn));
+ return !(DISubprogram(getContext()).describes(CurFn));
}
/// describes - Return true if this subprogram provides debugging
Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)));
else
for (unsigned i = 0; i != NumTys; ++i)
- Elts.push_back(Tys[i].getNode());
+ Elts.push_back(Tys[i]);
return DIArray(MDNode::get(VMContext,Elts.data(), Elts.size()));
}
GetTagConstant(dwarf::DW_TAG_file_type),
MDString::get(VMContext, Filename),
MDString::get(VMContext, Directory),
- CU.getNode()
+ CU
};
return DIFile(MDNode::get(VMContext, &Elts[0], 4));
unsigned Encoding) {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_base_type),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
unsigned Encoding) {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_base_type),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
SizeInBits,
AlignInBits,
return Ty;
SmallVector<Value *, 9> Elts;
- MDNode *N = Ty.getNode();
+ MDNode *N = Ty;
assert (N && "Unexpected input DIType!");
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
if (Value *V = N->getOperand(i))
DIType DerivedFrom) {
Value *Elts[] = {
GetTagConstant(Tag),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
- DerivedFrom.getNode(),
+ DerivedFrom,
};
return DIDerivedType(MDNode::get(VMContext, &Elts[0], 10));
}
DIType DerivedFrom) {
Value *Elts[] = {
GetTagConstant(Tag),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
SizeInBits,
AlignInBits,
OffsetInBits,
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
- DerivedFrom.getNode(),
+ DerivedFrom,
};
return DIDerivedType(MDNode::get(VMContext, &Elts[0], 10));
}
Value *Elts[] = {
GetTagConstant(Tag),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
- DerivedFrom.getNode(),
- Elements.getNode(),
+ DerivedFrom,
+ Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
ContainingType
};
Value *Elts[] = {
GetTagConstant(Tag),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
SizeInBits,
AlignInBits,
OffsetInBits,
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
- DerivedFrom.getNode(),
- Elements.getNode(),
+ DerivedFrom,
+ Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)
};
return DICompositeType(MDNode::get(VMContext, &Elts[0], 12));
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subprogram),
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
MDString::get(VMContext, DisplayName),
MDString::get(VMContext, LinkageName),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
- Ty.getNode(),
+ Ty,
ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
ConstantInt::get(Type::getInt32Ty(VMContext), (unsigned)VK),
ConstantInt::get(Type::getInt32Ty(VMContext), VIndex),
- ContainingType.getNode(),
+ ContainingType,
ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial),
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized)
};
/// given declaration.
DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration) {
if (SPDeclaration.isDefinition())
- return DISubprogram(SPDeclaration.getNode());
+ return DISubprogram(SPDeclaration);
- MDNode *DeclNode = SPDeclaration.getNode();
+ MDNode *DeclNode = SPDeclaration;
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subprogram),
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_variable),
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
MDString::get(VMContext, DisplayName),
MDString::get(VMContext, LinkageName),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
- Ty.getNode(),
+ Ty,
ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
Val
DIType Ty) {
Value *Elts[] = {
GetTagConstant(Tag),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
- Ty.getNode(),
+ Ty,
};
return DIVariable(MDNode::get(VMContext, &Elts[0], 6));
}
SmallVector<Value *, 9> &addr) {
SmallVector<Value *, 9> Elts;
Elts.push_back(GetTagConstant(Tag));
- Elts.push_back(Context.getNode());
+ Elts.push_back(Context);
Elts.push_back(MDString::get(VMContext, Name));
- Elts.push_back(F.getNode());
+ Elts.push_back(F);
Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext), LineNo));
- Elts.push_back(Ty.getNode());
+ Elts.push_back(Ty);
Elts.insert(Elts.end(), addr.begin(), addr.end());
return DIVariable(MDNode::get(VMContext, &Elts[0], 6+addr.size()));
unsigned LineNo, unsigned Col) {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_lexical_block),
- Context.getNode(),
+ Context,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
ConstantInt::get(Type::getInt32Ty(VMContext), Col)
};
unsigned LineNo) {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_namespace),
- Context.getNode(),
+ Context,
MDString::get(VMContext, Name),
- F.getNode(),
+ F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
};
return DINameSpace(MDNode::get(VMContext, &Elts[0], 5));
Value *Elts[] = {
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
- S.getNode(),
- OrigLoc.getNode(),
+ S,
+ OrigLoc,
};
return DILocation(MDNode::get(VMContext, &Elts[0], 4));
}
Value *Elts[] = {
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
- S.getNode(),
+ S,
OrigLoc
};
return DILocation(MDNode::get(VMContext, &Elts[0], 4));
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
Instruction *InsertBefore) {
assert(Storage && "no storage passed to dbg.declare");
- assert(D.getNode() && "empty DIVariable passed to dbg.declare");
+ assert(D && "empty DIVariable passed to dbg.declare");
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
Value *Args[] = { MDNode::get(Storage->getContext(), &Storage, 1),
- D.getNode() };
+ D };
return CallInst::Create(DeclareFn, Args, Args+2, "", InsertBefore);
}
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
BasicBlock *InsertAtEnd) {
assert(Storage && "no storage passed to dbg.declare");
- assert(D.getNode() && "empty DIVariable passed to dbg.declare");
+ assert(D && "empty DIVariable passed to dbg.declare");
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
Value *Args[] = { MDNode::get(Storage->getContext(), &Storage, 1),
- D.getNode() };
+ D };
// If this block already has a terminator then insert this intrinsic
// before the terminator.
DIVariable D,
Instruction *InsertBefore) {
assert(V && "no value passed to dbg.value");
- assert(D.getNode() && "empty DIVariable passed to dbg.value");
+ assert(D && "empty DIVariable passed to dbg.value");
if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
Value *Args[] = { MDNode::get(V->getContext(), &V, 1),
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
- D.getNode() };
+ D };
return CallInst::Create(ValueFn, Args, Args+3, "", InsertBefore);
}
DIVariable D,
BasicBlock *InsertAtEnd) {
assert(V && "no value passed to dbg.value");
- assert(D.getNode() && "empty DIVariable passed to dbg.value");
+ assert(D && "empty DIVariable passed to dbg.value");
if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
Value *Args[] = { MDNode::get(V->getContext(), &V, 1),
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
- D.getNode() };
+ D };
return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
}
DIDescriptor Scope(Loc.getScope(Ctx));
if (Scope.isCompileUnit())
- addCompileUnit(DICompileUnit(Scope.getNode()));
+ addCompileUnit(DICompileUnit(Scope));
else if (Scope.isSubprogram())
- processSubprogram(DISubprogram(Scope.getNode()));
+ processSubprogram(DISubprogram(Scope));
else if (Scope.isLexicalBlock())
- processLexicalBlock(DILexicalBlock(Scope.getNode()));
+ processLexicalBlock(DILexicalBlock(Scope));
if (MDNode *IA = Loc.getInlinedAt(Ctx))
processLocation(DILocation(IA));
/// processLocation - Process DILocation.
void DebugInfoFinder::processLocation(DILocation Loc) {
if (!Loc.Verify()) return;
- DIDescriptor S(Loc.getScope().getNode());
+ DIDescriptor S(Loc.getScope());
if (S.isCompileUnit())
- addCompileUnit(DICompileUnit(S.getNode()));
+ addCompileUnit(DICompileUnit(S));
else if (S.isSubprogram())
- processSubprogram(DISubprogram(S.getNode()));
+ processSubprogram(DISubprogram(S));
else if (S.isLexicalBlock())
- processLexicalBlock(DILexicalBlock(S.getNode()));
+ processLexicalBlock(DILexicalBlock(S));
processLocation(Loc.getOrigLocation());
}
addCompileUnit(DT.getCompileUnit());
if (DT.isCompositeType()) {
- DICompositeType DCT(DT.getNode());
+ DICompositeType DCT(DT);
processType(DCT.getTypeDerivedFrom());
DIArray DA = DCT.getTypeArray();
for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
DIDescriptor D = DA.getElement(i);
if (D.isType())
- processType(DIType(D.getNode()));
+ processType(DIType(D));
else if (D.isSubprogram())
- processSubprogram(DISubprogram(D.getNode()));
+ processSubprogram(DISubprogram(D));
}
} else if (DT.isDerivedType()) {
- DIDerivedType DDT(DT.getNode());
+ DIDerivedType DDT(DT);
processType(DDT.getTypeDerivedFrom());
}
}
void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
DIScope Context = LB.getContext();
if (Context.isLexicalBlock())
- return processLexicalBlock(DILexicalBlock(Context.getNode()));
+ return processLexicalBlock(DILexicalBlock(Context));
else
- return processSubprogram(DISubprogram(Context.getNode()));
+ return processSubprogram(DISubprogram(Context));
}
/// processSubprogram - Process DISubprogram.
if (!DV.isVariable())
return;
- if (!NodesSeen.insert(DV.getNode()))
+ if (!NodesSeen.insert(DV))
return;
addCompileUnit(DIVariable(N).getCompileUnit());
if (!DT.isValid())
return false;
- if (!NodesSeen.insert(DT.getNode()))
+ if (!NodesSeen.insert(DT))
return false;
- TYs.push_back(DT.getNode());
+ TYs.push_back(DT);
return true;
}
if (!CU.Verify())
return false;
- if (!NodesSeen.insert(CU.getNode()))
+ if (!NodesSeen.insert(CU))
return false;
- CUs.push_back(CU.getNode());
+ CUs.push_back(CU);
return true;
}
/// addGlobalVariable - Add global variable into GVs.
bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) {
- if (!DIDescriptor(DIG.getNode()).isGlobalVariable())
+ if (!DIDescriptor(DIG).isGlobalVariable())
return false;
- if (!NodesSeen.insert(DIG.getNode()))
+ if (!NodesSeen.insert(DIG))
return false;
- GVs.push_back(DIG.getNode());
+ GVs.push_back(DIG);
return true;
}
// addSubprogram - Add subprgoram into SPs.
bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
- if (!DIDescriptor(SP.getNode()).isSubprogram())
+ if (!DIDescriptor(SP).isSubprogram())
return false;
- if (!NodesSeen.insert(SP.getNode()))
+ if (!NodesSeen.insert(SP))
return false;
- SPs.push_back(SP.getNode());
+ SPs.push_back(SP);
return true;
}
DIDescriptor DIG(cast_or_null<MDNode>(NMD->getOperand(i)));
if (!DIG.isGlobalVariable())
continue;
- if (DIGlobalVariable(DIG.getNode()).getGlobal() == V)
- return DIG.getNode();
+ if (DIGlobalVariable(DIG).getGlobal() == V)
+ return DIG;
}
return 0;
}
return DISubprogram(Scope);
if (D.isLexicalBlock())
- return getDISubprogram(DILexicalBlock(Scope).getContext().getNode());
+ return getDISubprogram(DILexicalBlock(Scope).getContext());
return DISubprogram();
}
/// getDICompositeType - Find underlying composite type.
DICompositeType llvm::getDICompositeType(DIType T) {
if (T.isCompositeType())
- return DICompositeType(T.getNode());
+ return DICompositeType(T);
if (T.isDerivedType())
- return getDICompositeType(DIDerivedType(T.getNode()).getTypeDerivedFrom());
+ return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
return DICompositeType();
}
// cast away const; DIetc do not take const operands for some reason.
DIVariable V(const_cast<MDNode*>(MI->getOperand(2).getMetadata()));
if (V.getContext().isSubprogram())
- OS << DISubprogram(V.getContext().getNode()).getDisplayName() << ":";
+ OS << DISubprogram(V.getContext()).getDisplayName() << ":";
OS << V.getName() << " <- ";
// Register or immediate value. Register 0 means undef.
void setParent(DbgScope *P) { Parent = P; }
DIDescriptor getDesc() const { return Desc; }
MDNode *getInlinedAt() const { return InlinedAtLocation; }
- MDNode *getScopeNode() const { return Desc.getNode(); }
+ MDNode *getScopeNode() const { return Desc; }
const SmallVector<DbgScope *, 4> &getScopes() { return Scopes; }
const SmallVector<DbgVariable *, 8> &getVariables() { return Variables; }
const SmallVector<DbgRange, 4> &getRanges() { return Ranges; }
void DbgScope::dump() const {
raw_ostream &err = dbgs();
err.indent(IndentLevel);
- MDNode *N = Desc.getNode();
+ MDNode *N = Desc;
N->dump();
if (AbstractScope)
err << "Abstract Scope\n";
unsigned tag = Ty.getTag();
if (tag == dwarf::DW_TAG_pointer_type) {
- DIDerivedType DTy = DIDerivedType(Ty.getNode());
+ DIDerivedType DTy = DIDerivedType(Ty);
subType = DTy.getTypeDerivedFrom();
}
- DICompositeType blockStruct = DICompositeType(subType.getNode());
+ DICompositeType blockStruct = DICompositeType(subType);
DIArray Elements = blockStruct.getTypeArray();
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIDescriptor Element = Elements.getElement(i);
- DIDerivedType DT = DIDerivedType(Element.getNode());
+ DIDerivedType DT = DIDerivedType(Element);
if (Name == DT.getName())
return (DT.getTypeDerivedFrom());
}
StringRef varName = VD.getName();
if (Tag == dwarf::DW_TAG_pointer_type) {
- DIDerivedType DTy = DIDerivedType(Ty.getNode());
+ DIDerivedType DTy = DIDerivedType(Ty);
TmpTy = DTy.getTypeDerivedFrom();
isPointer = true;
}
- DICompositeType blockStruct = DICompositeType(TmpTy.getNode());
+ DICompositeType blockStruct = DICompositeType(TmpTy);
// Find the __forwarding field and the variable field in the __Block_byref
// struct.
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
DIDescriptor Element = Fields.getElement(i);
- DIDerivedType DT = DIDerivedType(Element.getNode());
+ DIDerivedType DT = DIDerivedType(Element);
StringRef fieldName = DT.getName();
if (fieldName == "__forwarding")
forwardingField = Element;
// Get the offsets for the forwarding field and the variable field.
unsigned forwardingFieldOffset =
- DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3;
+ DIDerivedType(forwardingField).getOffsetInBits() >> 3;
unsigned varFieldOffset =
- DIDerivedType(varField.getNode()).getOffsetInBits() >> 3;
+ DIDerivedType(varField).getOffsetInBits() >> 3;
// Decode the original location, and use that as the start of the byref
// variable's location.
/// addToContextOwner - Add Die into the list of its context owner's children.
void DwarfDebug::addToContextOwner(DIE *Die, DIDescriptor Context) {
if (Context.isType()) {
- DIE *ContextDIE = getOrCreateTypeDIE(DIType(Context.getNode()));
+ DIE *ContextDIE = getOrCreateTypeDIE(DIType(Context));
ContextDIE->addChild(Die);
} else if (Context.isNameSpace()) {
- DIE *ContextDIE = getOrCreateNameSpace(DINameSpace(Context.getNode()));
+ DIE *ContextDIE = getOrCreateNameSpace(DINameSpace(Context));
ContextDIE->addChild(Die);
- } else if (DIE *ContextDIE = ModuleCU->getDIE(Context.getNode()))
+ } else if (DIE *ContextDIE = ModuleCU->getDIE(Context))
ContextDIE->addChild(Die);
else
ModuleCU->addDie(Die);
/// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
/// given DIType.
DIE *DwarfDebug::getOrCreateTypeDIE(DIType Ty) {
- DIE *TyDIE = ModuleCU->getDIE(Ty.getNode());
+ DIE *TyDIE = ModuleCU->getDIE(Ty);
if (TyDIE)
return TyDIE;
// Create new type.
TyDIE = new DIE(dwarf::DW_TAG_base_type);
- ModuleCU->insertDIE(Ty.getNode(), TyDIE);
+ ModuleCU->insertDIE(Ty, TyDIE);
if (Ty.isBasicType())
- constructTypeDIE(*TyDIE, DIBasicType(Ty.getNode()));
+ constructTypeDIE(*TyDIE, DIBasicType(Ty));
else if (Ty.isCompositeType())
- constructTypeDIE(*TyDIE, DICompositeType(Ty.getNode()));
+ constructTypeDIE(*TyDIE, DICompositeType(Ty));
else {
assert(Ty.isDerivedType() && "Unknown kind of DIType");
- constructTypeDIE(*TyDIE, DIDerivedType(Ty.getNode()));
+ constructTypeDIE(*TyDIE, DIDerivedType(Ty));
}
addToContextOwner(TyDIE, Ty.getContext());
return;
// Check for pre-existence.
- DIEEntry *Entry = ModuleCU->getDIEEntry(Ty.getNode());
+ DIEEntry *Entry = ModuleCU->getDIEEntry(Ty);
// If it exists then use the existing value.
if (Entry) {
Entity->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, Entry);
// Set up proxy.
Entry = createDIEEntry(Buffer);
- ModuleCU->insertDIEEntry(Ty.getNode(), Entry);
+ ModuleCU->insertDIEEntry(Ty, Entry);
Entity->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, Entry);
}
// Add enumerators to enumeration type.
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIE *ElemDie = NULL;
- DIDescriptor Enum(Elements.getElement(i).getNode());
+ DIDescriptor Enum(Elements.getElement(i));
if (Enum.isEnumerator()) {
- ElemDie = constructEnumTypeDIE(DIEnumerator(Enum.getNode()));
+ ElemDie = constructEnumTypeDIE(DIEnumerator(Enum));
Buffer.addChild(ElemDie);
}
}
// Add return type.
DIArray Elements = CTy.getTypeArray();
DIDescriptor RTy = Elements.getElement(0);
- addType(&Buffer, DIType(RTy.getNode()));
+ addType(&Buffer, DIType(RTy));
// Add prototype flag.
addUInt(&Buffer, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1);
for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
DIDescriptor Ty = Elements.getElement(i);
- addType(Arg, DIType(Ty.getNode()));
+ addType(Arg, DIType(Ty));
Buffer.addChild(Arg);
}
}
DIDescriptor Element = Elements.getElement(i);
DIE *ElemDie = NULL;
if (Element.isSubprogram())
- ElemDie = createSubprogramDIE(DISubprogram(Element.getNode()));
+ ElemDie = createSubprogramDIE(DISubprogram(Element));
else if (Element.isVariable()) {
- DIVariable DV(Element.getNode());
+ DIVariable DV(Element);
ElemDie = new DIE(dwarf::DW_TAG_variable);
addString(ElemDie, dwarf::DW_AT_name, dwarf::DW_FORM_string,
DV.getName());
addUInt(ElemDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
addSourceLine(ElemDie, &DV);
} else if (Element.isDerivedType())
- ElemDie = createMemberDIE(DIDerivedType(Element.getNode()));
+ ElemDie = createMemberDIE(DIDerivedType(Element));
else
continue;
Buffer.addChild(ElemDie);
dwarf::DW_FORM_data1, RLang);
DICompositeType ContainingType = CTy.getContainingType();
- if (DIDescriptor(ContainingType.getNode()).isCompositeType())
+ if (DIDescriptor(ContainingType).isCompositeType())
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
- getOrCreateTypeDIE(DIType(ContainingType.getNode())));
+ getOrCreateTypeDIE(DIType(ContainingType)));
break;
}
default:
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIDescriptor Element = Elements.getElement(i);
if (Element.getTag() == dwarf::DW_TAG_subrange_type)
- constructSubrangeDIE(Buffer, DISubrange(Element.getNode()), IdxTy);
+ constructSubrangeDIE(Buffer, DISubrange(Element), IdxTy);
}
}
/// createSubprogramDIE - Create new DIE using SP.
DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) {
- DIE *SPDie = ModuleCU->getDIE(SP.getNode());
+ DIE *SPDie = ModuleCU->getDIE(SP);
if (SPDie)
return SPDie;
if (Args.getNumElements() == 0 || SPTag != dwarf::DW_TAG_subroutine_type)
addType(SPDie, SPTy);
else
- addType(SPDie, DIType(Args.getElement(0).getNode()));
+ addType(SPDie, DIType(Args.getElement(0)));
unsigned VK = SP.getVirtuality();
if (VK) {
addUInt(Block, 0, dwarf::DW_FORM_data1, SP.getVirtualIndex());
addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, 0, Block);
ContainingTypeMap.insert(std::make_pair(SPDie,
- SP.getContainingType().getNode()));
+ SP.getContainingType()));
}
if (MakeDecl || !SP.isDefinition()) {
if (SPTag == dwarf::DW_TAG_subroutine_type)
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
- DIType ATy = DIType(DIType(Args.getElement(i).getNode()));
+ DIType ATy = DIType(DIType(Args.getElement(i)));
addType(Arg, ATy);
if (ATy.isArtificial())
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
addUInt(SPDie, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1);
// DW_TAG_inlined_subroutine may refer to this DIE.
- ModuleCU->insertDIE(SP.getNode(), SPDie);
+ ModuleCU->insertDIE(SP, SPDie);
return SPDie;
}
if (Scope.isLexicalBlock()) {
DILexicalBlock DB(N);
DIDescriptor ParentDesc = DB.getContext();
- Parent = getOrCreateAbstractScope(ParentDesc.getNode());
+ Parent = getOrCreateAbstractScope(ParentDesc);
}
AScope = new DbgScope(Parent, DIDescriptor(N), NULL);
if (D.isSubprogram())
return true;
if (D.isType())
- return isSubprogramContext(DIType(Context).getContext().getNode());
+ return isSubprogramContext(DIType(Context).getContext());
return false;
}
// specification DIE for a function defined inside a function.
if (SP.isDefinition() && !SP.getContext().isCompileUnit() &&
!SP.getContext().isFile() &&
- !isSubprogramContext(SP.getContext().getNode())) {
+ !isSubprogramContext(SP.getContext())) {
addUInt(SPDie, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag, 1);
// Add arguments.
if (SPTag == dwarf::DW_TAG_subroutine_type)
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
- DIType ATy = DIType(DIType(Args.getElement(i).getNode()));
+ DIType ATy = DIType(DIType(Args.getElement(i)));
addType(Arg, ATy);
if (ATy.isArtificial())
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
DIScope DS(Scope->getScopeNode());
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
- DISubprogram InlinedSP = getDISubprogram(DS.getNode());
- DIE *OriginDIE = ModuleCU->getDIE(InlinedSP.getNode());
+ DISubprogram InlinedSP = getDISubprogram(DS);
+ DIE *OriginDIE = ModuleCU->getDIE(InlinedSP);
assert(OriginDIE && "Unable to find Origin DIE!");
addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin,
dwarf::DW_FORM_ref4, OriginDIE);
// Track the start label for this inlined function.
DenseMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator
- I = InlineInfo.find(InlinedSP.getNode());
+ I = InlineInfo.find(InlinedSP);
if (I == InlineInfo.end()) {
- InlineInfo[InlinedSP.getNode()].push_back(std::make_pair(StartLabel,
+ InlineInfo[InlinedSP].push_back(std::make_pair(StartLabel,
ScopeDIE));
- InlinedSPNodes.push_back(InlinedSP.getNode());
+ InlinedSPNodes.push_back(InlinedSP);
} else
I->second.push_back(std::make_pair(StartLabel, ScopeDIE));
if (AbsDIE) {
DIScope DS(Scope->getScopeNode());
- DISubprogram InlinedSP = getDISubprogram(DS.getNode());
- DIE *OriginSPDIE = ModuleCU->getDIE(InlinedSP.getNode());
+ DISubprogram InlinedSP = getDISubprogram(DS);
+ DIE *OriginSPDIE = ModuleCU->getDIE(InlinedSP);
(void) OriginSPDIE;
assert(OriginSPDIE && "Unable to find Origin DIE for the SP!");
DIE *AbsDIE = DV->getAbstractVariable()->getDIE();
DIArray Args = SPTy.getTypeArray();
for (unsigned i = 0, e = Args.getNumElements(); i != e; ++i) {
- DIType ATy(Args.getElement(i).getNode());
+ DIType ATy(Args.getElement(i));
if (!ATy.isValid())
continue;
DICompositeType CATy = getDICompositeType(ATy);
- if (DIDescriptor(CATy.getNode()).Verify() && !CATy.getName().empty()
+ if (DIDescriptor(CATy).Verify() && !CATy.getName().empty()
&& !CATy.isForwardDecl()) {
- if (DIEEntry *Entry = ModuleCU->getDIEEntry(CATy.getNode()))
+ if (DIEEntry *Entry = ModuleCU->getDIEEntry(CATy))
ModuleCU->addGlobalType(CATy.getName(), Entry->getEntry());
}
}
ScopeDIE = constructInlinedScopeDIE(Scope);
else if (DS.isSubprogram()) {
if (Scope->isAbstractScope())
- ScopeDIE = ModuleCU->getDIE(DS.getNode());
+ ScopeDIE = ModuleCU->getDIE(DS);
else
- ScopeDIE = updateSubprogramScopeDIE(DS.getNode());
+ ScopeDIE = updateSubprogramScopeDIE(DS);
}
else
ScopeDIE = constructLexicalScopeDIE(Scope);
}
if (DS.isSubprogram())
- addPubTypes(DISubprogram(DS.getNode()));
+ addPubTypes(DISubprogram(DS));
return ScopeDIE;
}
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
DIE *DwarfDebug::getOrCreateNameSpace(DINameSpace NS) {
- DIE *NDie = ModuleCU->getDIE(NS.getNode());
+ DIE *NDie = ModuleCU->getDIE(NS);
if (NDie)
return NDie;
NDie = new DIE(dwarf::DW_TAG_namespace);
- ModuleCU->insertDIE(NS.getNode(), NDie);
+ ModuleCU->insertDIE(NS, NDie);
if (!NS.getName().empty())
addString(NDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, NS.getName());
addSourceLine(NDie, &NS);
return;
// Check for pre-existence.
- if (ModuleCU->getDIE(DI_GV.getNode()))
+ if (ModuleCU->getDIE(DI_GV))
return;
DIE *VariableDie = createGlobalVariableDIE(DI_GV);
// or a subprogram.
if (DI_GV.isDefinition() && !GVContext.isCompileUnit() &&
!GVContext.isFile() &&
- !isSubprogramContext(GVContext.getNode())) {
+ !isSubprogramContext(GVContext)) {
// Create specification DIE.
DIE *VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification,
DIType GTy = DI_GV.getType();
if (GTy.isCompositeType() && !GTy.getName().empty()
&& !GTy.isForwardDecl()) {
- DIEEntry *Entry = ModuleCU->getDIEEntry(GTy.getNode());
+ DIEEntry *Entry = ModuleCU->getDIEEntry(GTy);
assert(Entry && "Missing global type!");
ModuleCU->addGlobalType(GTy.getName(), Entry->getEntry());
}
unsigned FrameIdx,
DebugLoc ScopeLoc) {
- DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var.getNode());
+ DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
if (AbsDbgVariable)
return AbsDbgVariable;
- LLVMContext &Ctx = Var.getNode()->getContext();
+ LLVMContext &Ctx = Var->getContext();
DbgScope *Scope = AbstractScopes.lookup(ScopeLoc.getScope(Ctx));
if (!Scope)
return NULL;
AbsDbgVariable = new DbgVariable(Var, FrameIdx,
NULL /* No more-abstract variable*/);
Scope->addVariable(AbsDbgVariable);
- AbstractVariables[Var.getNode()] = AbsDbgVariable;
+ AbstractVariables[Var] = AbsDbgVariable;
return AbsDbgVariable;
}
const MachineInstr *MI,
DebugLoc ScopeLoc) {
- DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var.getNode());
+ DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
if (AbsDbgVariable)
return AbsDbgVariable;
- LLVMContext &Ctx = Var.getNode()->getContext();
+ LLVMContext &Ctx = Var->getContext();
DbgScope *Scope = AbstractScopes.lookup(ScopeLoc.getScope(Ctx));
if (!Scope)
return NULL;
AbsDbgVariable = new DbgVariable(Var, MI,
NULL /* No more-abstract variable*/);
Scope->addVariable(AbsDbgVariable);
- AbstractVariables[Var.getNode()] = AbsDbgVariable;
+ AbstractVariables[Var] = AbsDbgVariable;
DbgValueStartMap[MI] = AbsDbgVariable;
return AbsDbgVariable;
}
DbgScopeMap.insert(std::make_pair(Scope, WScope));
if (DIDescriptor(Scope).isLexicalBlock()) {
DbgScope *Parent =
- getOrCreateDbgScope(DILexicalBlock(Scope).getContext().getNode(), NULL);
+ getOrCreateDbgScope(DILexicalBlock(Scope).getContext(), NULL);
WScope->setParent(Parent);
Parent->addScope(WScope);
}
DbgScopeMap.insert(std::make_pair(InlinedAt, WScope));
DILocation DL(InlinedAt);
DbgScope *Parent =
- getOrCreateDbgScope(DL.getScope().getNode(), DL.getOrigLocation().getNode());
+ getOrCreateDbgScope(DL.getScope(), DL.getOrigLocation());
WScope->setParent(Parent);
Parent->addScope(WScope);