return 0;
}
+void DIDescriptor::replaceFunctionField(unsigned Elt, Function *F) {
+ if (DbgNode == 0)
+ return;
+
+ if (Elt < DbgNode->getNumOperands()) {
+ MDNode *Node = const_cast<MDNode*>(DbgNode);
+ Node->replaceOperandWith(Elt, F);
+ }
+}
+
unsigned DIVariable::getNumAddrElements() const {
- if (getVersion() <= llvm::LLVMDebugVersion8)
+ if (getVersion() <= LLVMDebugVersion8)
return DbgNode->getNumOperands()-6;
- if (getVersion() == llvm::LLVMDebugVersion9)
+ if (getVersion() == LLVMDebugVersion9)
return DbgNode->getNumOperands()-7;
return DbgNode->getNumOperands()-8;
}
/// getInlinedAt - If this variable is inlined then return inline location.
MDNode *DIVariable::getInlinedAt() const {
- if (getVersion() <= llvm::LLVMDebugVersion9)
+ if (getVersion() <= LLVMDebugVersion9)
return NULL;
return dyn_cast_or_null<MDNode>(DbgNode->getOperand(7));
}
// Insert inlined scope as 7th element.
for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i)
i == 7 ?
- Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext))):
+ Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext))):
Elts.push_back(DV->getOperand(i));
return DIVariable(MDNode::get(VMContext, Elts));
}
void DIDescriptor::print(raw_ostream &OS) const {
if (!DbgNode) return;
- OS << "[" << dwarf::TagString(getTag()) << ']';
+ if (const char *Tag = dwarf::TagString(getTag()))
+ OS << "[ " << Tag << " ]";
if (this->isSubrange()) {
DISubrange(DbgNode).printInternal(OS);
- } else if (this->isScope()) {
- DIScope(DbgNode).printInternal(OS);
} else if (this->isCompileUnit()) {
DICompileUnit(DbgNode).printInternal(OS);
} else if (this->isFile()) {
DIGlobalVariable(DbgNode).printInternal(OS);
} else if (this->isVariable()) {
DIVariable(DbgNode).printInternal(OS);
+ } else if (this->isObjCProperty()) {
+ DIObjCProperty(DbgNode).printInternal(OS);
+ } else if (this->isScope()) {
+ DIScope(DbgNode).printInternal(OS);
}
}
<< ", align " << getAlignInBits()
<< ", offset " << getOffsetInBits();
if (isBasicType())
- OS << ", enc "
- << dwarf::AttributeEncodingString(DIBasicType(DbgNode).getEncoding());
+ if (const char *Enc =
+ dwarf::AttributeEncodingString(DIBasicType(DbgNode).getEncoding()))
+ OS << ", enc " << Enc;
OS << "]";
if (isPrivate())
}
void DISubprogram::printInternal(raw_ostream &OS) const {
- StringRef Res = getName();
- if (!Res.empty())
- OS << " [" << Res << ']';
-
// TODO : Print context
-
OS << " [line " << getLineNumber() << ']';
if (isLocalToUnit())
if (getScopeLineNumber() != getLineNumber())
OS << " [scope " << getScopeLineNumber() << "]";
+
+ StringRef Res = getName();
+ if (!Res.empty())
+ OS << " [" << Res << ']';
}
void DIGlobalVariable::printInternal(raw_ostream &OS) const {
OS << " [line " << getLineNumber() << ']';
}
+void DIObjCProperty::printInternal(raw_ostream &OS) const {
+ StringRef Name = getObjCPropertyName();
+ if (!Name.empty())
+ OS << " [" << Name << ']';
+
+ OS << " [line " << getLineNumber()
+ << ", properties " << getUnsignedField(6) << ']';
+}
+
static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
const LLVMContext &Ctx) {
if (!DL.isUnknown()) { // Print source line info.
}
}
}
-
-//===----------------------------------------------------------------------===//
-// DIDescriptor: vtable anchors for all descriptors.
-//===----------------------------------------------------------------------===//
-
-void DIScope::anchor() { }
-
-void DICompileUnit::anchor() { }
-
-void DIFile::anchor() { }
-
-void DIType::anchor() { }
-
-void DIBasicType::anchor() { }
-
-void DIDerivedType::anchor() { }
-
-void DICompositeType::anchor() { }
-
-void DISubprogram::anchor() { }
-
-void DILexicalBlock::anchor() { }
-
-void DINameSpace::anchor() { }
-
-void DILexicalBlockFile::anchor() { }