summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp106
-rw-r--r--llvm/lib/IR/DIBuilder.cpp522
-rw-r--r--llvm/lib/IR/DebugInfo.cpp84
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp211
-rw-r--r--llvm/lib/IR/DebugLoc.cpp16
-rw-r--r--llvm/lib/IR/DiagnosticInfo.cpp2
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h132
-rw-r--r--llvm/lib/IR/Verifier.cpp206
8 files changed, 639 insertions, 640 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 0564513c94a..6dfb7fa6b0f 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1375,7 +1375,7 @@ struct MDFieldPrinter {
SlotTracker *Machine, const Module *Context)
: Out(Out), TypePrinter(TypePrinter), Machine(Machine), Context(Context) {
}
- void printTag(const DebugNode *N);
+ void printTag(const DINode *N);
void printString(StringRef Name, StringRef Value,
bool ShouldSkipEmpty = true);
void printMetadata(StringRef Name, const Metadata *MD,
@@ -1390,7 +1390,7 @@ struct MDFieldPrinter {
};
} // end namespace
-void MDFieldPrinter::printTag(const DebugNode *N) {
+void MDFieldPrinter::printTag(const DINode *N) {
Out << FS << "tag: ";
if (const char *Tag = dwarf::TagString(N->getTag()))
Out << Tag;
@@ -1447,11 +1447,11 @@ void MDFieldPrinter::printDIFlags(StringRef Name, unsigned Flags) {
Out << FS << Name << ": ";
SmallVector<unsigned, 8> SplitFlags;
- unsigned Extra = DebugNode::splitFlags(Flags, SplitFlags);
+ unsigned Extra = DINode::splitFlags(Flags, SplitFlags);
FieldSeparator FlagsFS(" | ");
for (unsigned F : SplitFlags) {
- const char *StringF = DebugNode::getFlagString(F);
+ const char *StringF = DINode::getFlagString(F);
assert(StringF && "Expected valid flag");
Out << FlagsFS << StringF;
}
@@ -1472,10 +1472,10 @@ void MDFieldPrinter::printDwarfEnum(StringRef Name, IntTy Value,
Out << Value;
}
-static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N,
- TypePrinting *TypePrinter,
- SlotTracker *Machine, const Module *Context) {
- Out << "!GenericDebugNode(";
+static void writeGenericDINode(raw_ostream &Out, const GenericDINode *N,
+ TypePrinting *TypePrinter, SlotTracker *Machine,
+ const Module *Context) {
+ Out << "!GenericDINode(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printTag(N);
Printer.printString("header", N->getHeader());
@@ -1491,10 +1491,10 @@ static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N,
Out << ")";
}
-static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,
+static void writeDILocation(raw_ostream &Out, const DILocation *DL,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDLocation(";
+ Out << "!DILocation(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
// Always output the line, since 0 is a relevant and important value for it.
Printer.printInt("line", DL->getLine(), /* ShouldSkipZero */ false);
@@ -1504,27 +1504,27 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,
Out << ")";
}
-static void writeMDSubrange(raw_ostream &Out, const MDSubrange *N,
+static void writeDISubrange(raw_ostream &Out, const DISubrange *N,
TypePrinting *, SlotTracker *, const Module *) {
- Out << "!MDSubrange(";
+ Out << "!DISubrange(";
MDFieldPrinter Printer(Out);
Printer.printInt("count", N->getCount(), /* ShouldSkipZero */ false);
Printer.printInt("lowerBound", N->getLowerBound());
Out << ")";
}
-static void writeMDEnumerator(raw_ostream &Out, const MDEnumerator *N,
+static void writeDIEnumerator(raw_ostream &Out, const DIEnumerator *N,
TypePrinting *, SlotTracker *, const Module *) {
- Out << "!MDEnumerator(";
+ Out << "!DIEnumerator(";
MDFieldPrinter Printer(Out);
Printer.printString("name", N->getName(), /* ShouldSkipEmpty */ false);
Printer.printInt("value", N->getValue(), /* ShouldSkipZero */ false);
Out << ")";
}
-static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N,
+static void writeDIBasicType(raw_ostream &Out, const DIBasicType *N,
TypePrinting *, SlotTracker *, const Module *) {
- Out << "!MDBasicType(";
+ Out << "!DIBasicType(";
MDFieldPrinter Printer(Out);
if (N->getTag() != dwarf::DW_TAG_base_type)
Printer.printTag(N);
@@ -1536,10 +1536,10 @@ static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N,
Out << ")";
}
-static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N,
+static void writeDIDerivedType(raw_ostream &Out, const DIDerivedType *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDDerivedType(";
+ Out << "!DIDerivedType(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printTag(N);
Printer.printString("name", N->getName());
@@ -1556,10 +1556,10 @@ static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N,
Out << ")";
}
-static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N,
+static void writeDICompositeType(raw_ostream &Out, const DICompositeType *N,
TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context) {
- Out << "!MDCompositeType(";
+ Out << "!DICompositeType(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printTag(N);
Printer.printString("name", N->getName());
@@ -1580,10 +1580,10 @@ static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N,
Out << ")";
}
-static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N,
+static void writeDISubroutineType(raw_ostream &Out, const DISubroutineType *N,
TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context) {
- Out << "!MDSubroutineType(";
+ Out << "!DISubroutineType(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printDIFlags("flags", N->getFlags());
Printer.printMetadata("types", N->getRawTypeArray(),
@@ -1591,9 +1591,9 @@ static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N,
Out << ")";
}
-static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *,
+static void writeDIFile(raw_ostream &Out, const DIFile *N, TypePrinting *,
SlotTracker *, const Module *) {
- Out << "!MDFile(";
+ Out << "!DIFile(";
MDFieldPrinter Printer(Out);
Printer.printString("filename", N->getFilename(),
/* ShouldSkipEmpty */ false);
@@ -1602,10 +1602,10 @@ static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *,
Out << ")";
}
-static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N,
+static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDCompileUnit(";
+ Out << "!DICompileUnit(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printDwarfEnum("language", N->getSourceLanguage(),
dwarf::LanguageString, /* ShouldSkipZero */ false);
@@ -1626,10 +1626,10 @@ static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N,
Out << ")";
}
-static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N,
+static void writeDISubprogram(raw_ostream &Out, const DISubprogram *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDSubprogram(";
+ Out << "!DISubprogram(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printString("linkageName", N->getLinkageName());
@@ -1653,10 +1653,10 @@ static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N,
Out << ")";
}
-static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N,
- TypePrinting *TypePrinter, SlotTracker *Machine,
- const Module *Context) {
- Out << "!MDLexicalBlock(";
+static void writeDILexicalBlock(raw_ostream &Out, const DILexicalBlock *N,
+ TypePrinting *TypePrinter, SlotTracker *Machine,
+ const Module *Context) {
+ Out << "!DILexicalBlock(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
Printer.printMetadata("file", N->getRawFile());
@@ -1665,12 +1665,12 @@ static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N,
Out << ")";
}
-static void writeMDLexicalBlockFile(raw_ostream &Out,
- const MDLexicalBlockFile *N,
+static void writeDILexicalBlockFile(raw_ostream &Out,
+ const DILexicalBlockFile *N,
TypePrinting *TypePrinter,
SlotTracker *Machine,
const Module *Context) {
- Out << "!MDLexicalBlockFile(";
+ Out << "!DILexicalBlockFile(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
Printer.printMetadata("file", N->getRawFile());
@@ -1679,10 +1679,10 @@ static void writeMDLexicalBlockFile(raw_ostream &Out,
Out << ")";
}
-static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N,
+static void writeDINamespace(raw_ostream &Out, const DINamespace *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDNamespace(";
+ Out << "!DINamespace(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
@@ -1691,24 +1691,24 @@ static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N,
Out << ")";
}
-static void writeMDTemplateTypeParameter(raw_ostream &Out,
- const MDTemplateTypeParameter *N,
+static void writeDITemplateTypeParameter(raw_ostream &Out,
+ const DITemplateTypeParameter *N,
TypePrinting *TypePrinter,
SlotTracker *Machine,
const Module *Context) {
- Out << "!MDTemplateTypeParameter(";
+ Out << "!DITemplateTypeParameter(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printMetadata("type", N->getRawType(), /* ShouldSkipNull */ false);
Out << ")";
}
-static void writeMDTemplateValueParameter(raw_ostream &Out,
- const MDTemplateValueParameter *N,
+static void writeDITemplateValueParameter(raw_ostream &Out,
+ const DITemplateValueParameter *N,
TypePrinting *TypePrinter,
SlotTracker *Machine,
const Module *Context) {
- Out << "!MDTemplateValueParameter(";
+ Out << "!DITemplateValueParameter(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
if (N->getTag() != dwarf::DW_TAG_template_value_parameter)
Printer.printTag(N);
@@ -1718,10 +1718,10 @@ static void writeMDTemplateValueParameter(raw_ostream &Out,
Out << ")";
}
-static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N,
+static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N,
TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context) {
- Out << "!MDGlobalVariable(";
+ Out << "!DIGlobalVariable(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printString("linkageName", N->getLinkageName());
@@ -1736,10 +1736,10 @@ static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N,
Out << ")";
}
-static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
+static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N,
TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context) {
- Out << "!MDLocalVariable(";
+ Out << "!DILocalVariable(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printTag(N);
Printer.printString("name", N->getName());
@@ -1754,10 +1754,10 @@ static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
Out << ")";
}
-static void writeMDExpression(raw_ostream &Out, const MDExpression *N,
+static void writeDIExpression(raw_ostream &Out, const DIExpression *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDExpression(";
+ Out << "!DIExpression(";
FieldSeparator FS;
if (N->isValid()) {
for (auto I = N->expr_op_begin(), E = N->expr_op_end(); I != E; ++I) {
@@ -1775,10 +1775,10 @@ static void writeMDExpression(raw_ostream &Out, const MDExpression *N,
Out << ")";
}
-static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N,
+static void writeDIObjCProperty(raw_ostream &Out, const DIObjCProperty *N,
TypePrinting *TypePrinter, SlotTracker *Machine,
const Module *Context) {
- Out << "!MDObjCProperty(";
+ Out << "!DIObjCProperty(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printString("name", N->getName());
Printer.printMetadata("file", N->getRawFile());
@@ -1790,10 +1790,10 @@ static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N,
Out << ")";
}
-static void writeMDImportedEntity(raw_ostream &Out, const MDImportedEntity *N,
+static void writeDIImportedEntity(raw_ostream &Out, const DIImportedEntity *N,
TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context) {
- Out << "!MDImportedEntity(";
+ Out << "!DIImportedEntity(";
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
Printer.printTag(N);
Printer.printString("name", N->getName());
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index c849f1030bc..3baa4680905 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -87,13 +87,13 @@ void DIBuilder::finalize() {
RetainValues.push_back(AllRetainTypes[I]);
TempRetainTypes->replaceAllUsesWith(MDTuple::get(VMContext, RetainValues));
- MDSubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
+ DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
TempSubprograms->replaceAllUsesWith(SPs.get());
for (auto *SP : SPs) {
if (MDTuple *Temp = SP->getVariables().get()) {
const auto &PV = PreservedVariables.lookup(SP);
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
- DebugNodeArray AV = getOrCreateArray(Variables);
+ DINodeArray AV = getOrCreateArray(Variables);
TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
}
}
@@ -116,13 +116,13 @@ void DIBuilder::finalize() {
}
/// If N is compile unit return NULL otherwise return N.
-static MDScope *getNonCompileUnitScope(MDScope *N) {
- if (!N || isa<MDCompileUnit>(N))
+static DIScope *getNonCompileUnitScope(DIScope *N) {
+ if (!N || isa<DICompileUnit>(N))
return nullptr;
- return cast<MDScope>(N);
+ return cast<DIScope>(N);
}
-MDCompileUnit *DIBuilder::createCompileUnit(
+DICompileUnit *DIBuilder::createCompileUnit(
unsigned Lang, StringRef Filename, StringRef Directory, StringRef Producer,
bool isOptimized, StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
DebugEmissionKind Kind, bool EmitDebugInfo) {
@@ -133,7 +133,7 @@ MDCompileUnit *DIBuilder::createCompileUnit(
assert(!Filename.empty() &&
"Unable to create compile unit without filename");
- // TODO: Once we make MDCompileUnit distinct, stop using temporaries here
+ // TODO: Once we make DICompileUnit distinct, stop using temporaries here
// (just start with operands assigned to nullptr).
TempEnumTypes = MDTuple::getTemporary(VMContext, None);
TempRetainTypes = MDTuple::getTemporary(VMContext, None);
@@ -143,8 +143,8 @@ MDCompileUnit *DIBuilder::createCompileUnit(
// TODO: Switch to getDistinct(). We never want to merge compile units based
// on contents.
- MDCompileUnit *CUNode = MDCompileUnit::get(
- VMContext, Lang, MDFile::get(VMContext, Filename, Directory), Producer,
+ DICompileUnit *CUNode = DICompileUnit::get(
+ VMContext, Lang, DIFile::get(VMContext, Filename, Directory), Producer,
isOptimized, Flags, RunTimeVer, SplitName, Kind, TempEnumTypes.get(),
TempRetainTypes.get(), TempSubprograms.get(), TempGVs.get(),
TempImportedModules.get());
@@ -163,132 +163,132 @@ MDCompileUnit *DIBuilder::createCompileUnit(
return CUNode;
}
-static MDImportedEntity*
-createImportedModule(LLVMContext &C, dwarf::Tag Tag, MDScope* Context,
+static DIImportedEntity *
+createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context,
Metadata *NS, unsigned Line, StringRef Name,
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
- auto *M =
- MDImportedEntity::get(C, Tag, Context, DebugNodeRef(NS), Line, Name);
+ auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name);
AllImportedModules.emplace_back(M);
return M;
}
-MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context,
- MDNamespace* NS,
- unsigned Line) {
+DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context,
+ DINamespace *NS,
+ unsigned Line) {
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
Context, NS, Line, StringRef(), AllImportedModules);
}
-MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context,
- MDImportedEntity* NS,
- unsigned Line) {
+DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context,
+ DIImportedEntity *NS,
+ unsigned Line) {
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
Context, NS, Line, StringRef(), AllImportedModules);
}
-MDImportedEntity *DIBuilder::createImportedDeclaration(MDScope *Context,
- DebugNode *Decl,
+DIImportedEntity *DIBuilder::createImportedDeclaration(DIScope *Context,
+ DINode *Decl,
unsigned Line,
StringRef Name) {
// Make sure to use the unique identifier based metadata reference for
// types that have one.
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
- Context, DebugNodeRef::get(Decl), Line, Name,
+ Context, DINodeRef::get(Decl), Line, Name,
AllImportedModules);
}
-MDFile* DIBuilder::createFile(StringRef Filename, StringRef Directory) {
- return MDFile::get(VMContext, Filename, Directory);
+DIFile *DIBuilder::createFile(StringRef Filename, StringRef Directory) {
+ return DIFile::get(VMContext, Filename, Directory);
}
-MDEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
+DIEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
assert(!Name.empty() && "Unable to create enumerator without name");
- return MDEnumerator::get(VMContext, Val, Name);
+ return DIEnumerator::get(VMContext, Val, Name);
}
-MDBasicType *DIBuilder::createUnspecifiedType(StringRef Name) {
+DIBasicType *DIBuilder::createUnspecifiedType(StringRef Name) {
assert(!Name.empty() && "Unable to create type without name");
- return MDBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
+ return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
}
-MDBasicType *DIBuilder::createNullPtrType() {
+DIBasicType *DIBuilder::createNullPtrType() {
return createUnspecifiedType("decltype(nullptr)");
}
-MDBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
+DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
uint64_t AlignInBits,
unsigned Encoding) {
assert(!Name.empty() && "Unable to create type without name");
- return MDBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
+ return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
AlignInBits, Encoding);
}
-MDDerivedType *DIBuilder::createQualifiedType(unsigned Tag, MDType *FromTy) {
- return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
- MDTypeRef::get(FromTy), 0, 0, 0, 0);
+DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
+ return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
+ DITypeRef::get(FromTy), 0, 0, 0, 0);
}
-MDDerivedType *DIBuilder::createPointerType(MDType *PointeeTy,
+DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
uint64_t SizeInBits,
uint64_t AlignInBits,
StringRef Name) {
// FIXME: Why is there a name here?
- return MDDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
- nullptr, 0, nullptr, MDTypeRef::get(PointeeTy),
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
+ nullptr, 0, nullptr, DITypeRef::get(PointeeTy),
SizeInBits, AlignInBits, 0, 0);
}
-MDDerivedType *DIBuilder::createMemberPointerType(MDType *PointeeTy,
- MDType *Base,
+DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy,
+ DIType *Base,
uint64_t SizeInBits,
uint64_t AlignInBits) {
- return MDDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
- nullptr, 0, nullptr, MDTypeRef::get(PointeeTy),
- SizeInBits, AlignInBits, 0, 0, MDTypeRef::get(Base));
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
+ nullptr, 0, nullptr, DITypeRef::get(PointeeTy),
+ SizeInBits, AlignInBits, 0, 0,
+ DITypeRef::get(Base));
}
-MDDerivedType *DIBuilder::createReferenceType(unsigned Tag, MDType *RTy) {
+DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy) {
assert(RTy && "Unable to create reference type");
- return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
- MDTypeRef::get(RTy), 0, 0, 0, 0);
+ return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
+ DITypeRef::get(RTy), 0, 0, 0, 0);
}
-MDDerivedType *DIBuilder::createTypedef(MDType *Ty, StringRef Name,
- MDFile *File, unsigned LineNo,
- MDScope *Context) {
- return MDDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
+DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
+ DIFile *File, unsigned LineNo,
+ DIScope *Context) {
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
LineNo,
- MDScopeRef::get(getNonCompileUnitScope(Context)),
- MDTypeRef::get(Ty), 0, 0, 0, 0);
+ DIScopeRef::get(getNonCompileUnitScope(Context)),
+ DITypeRef::get(Ty), 0, 0, 0, 0);
}
-MDDerivedType *DIBuilder::createFriend(MDType *Ty, MDType *FriendTy) {
+DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
assert(Ty && "Invalid type!");
assert(FriendTy && "Invalid friend type!");
- return MDDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0,
- MDTypeRef::get(Ty), MDTypeRef::get(FriendTy), 0, 0,
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0,
+ DITypeRef::get(Ty), DITypeRef::get(FriendTy), 0, 0,
0, 0);
}
-MDDerivedType *DIBuilder::createInheritance(MDType *Ty, MDType *BaseTy,
+DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy,
uint64_t BaseOffset,
unsigned Flags) {
assert(Ty && "Unable to create inheritance");
- return MDDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
- 0, MDTypeRef::get(Ty), MDTypeRef::get(BaseTy), 0, 0,
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
+ 0, DITypeRef::get(Ty), DITypeRef::get(BaseTy), 0, 0,
BaseOffset, Flags);
}
-MDDerivedType *DIBuilder::createMemberType(MDScope *Scope, StringRef Name,
- MDFile *File, unsigned LineNumber,
+DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name,
+ DIFile *File, unsigned LineNumber,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint64_t OffsetInBits,
- unsigned Flags, MDType *Ty) {
- return MDDerivedType::get(
+ unsigned Flags, DIType *Ty) {
+ return DIDerivedType::get(
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty),
+ DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty),
SizeInBits, AlignInBits, OffsetInBits, Flags);
}
@@ -298,91 +298,91 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) {
return nullptr;
}
-MDDerivedType *DIBuilder::createStaticMemberType(MDScope *Scope, StringRef Name,
- MDFile *File,
+DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
+ DIFile *File,
unsigned LineNumber,
- MDType *Ty, unsigned Flags,
+ DIType *Ty, unsigned Flags,
llvm::Constant *Val) {
- Flags |= DebugNode::FlagStaticMember;
- return MDDerivedType::get(
+ Flags |= DINode::FlagStaticMember;
+ return DIDerivedType::get(
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty), 0, 0,
+ DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty), 0, 0,
0, Flags, getConstantOrNull(Val));
}
-MDDerivedType *DIBuilder::createObjCIVar(StringRef Name, MDFile *File,
+DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File,
unsigned LineNumber,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
- MDType *Ty, MDNode *PropertyNode) {
- return MDDerivedType::get(
+ DIType *Ty, MDNode *PropertyNode) {
+ return DIDerivedType::get(
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(File)), MDTypeRef::get(Ty),
+ DIScopeRef::get(getNonCompileUnitScope(File)), DITypeRef::get(Ty),
SizeInBits, AlignInBits, OffsetInBits, Flags, PropertyNode);
}
-MDObjCProperty *
-DIBuilder::createObjCProperty(StringRef Name, MDFile *File, unsigned LineNumber,
+DIObjCProperty *
+DIBuilder::createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
StringRef GetterName, StringRef SetterName,
- unsigned PropertyAttributes, MDType *Ty) {
- return MDObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
+ unsigned PropertyAttributes, DIType *Ty) {
+ return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
SetterName, PropertyAttributes, Ty);
}
-MDTemplateTypeParameter *
-DIBuilder::createTemplateTypeParameter(MDScope *Context, StringRef Name,
- MDType *Ty) {
- assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit");
- return MDTemplateTypeParameter::get(VMContext, Name, MDTypeRef::get(Ty));
+DITemplateTypeParameter *
+DIBuilder::createTemplateTypeParameter(DIScope *Context, StringRef Name,
+ DIType *Ty) {
+ assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
+ return DITemplateTypeParameter::get(VMContext, Name, DITypeRef::get(Ty));
}
-static MDTemplateValueParameter *
+static DITemplateValueParameter *
createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag,
- MDScope *Context, StringRef Name, MDType *Ty,
+ DIScope *Context, StringRef Name, DIType *Ty,
Metadata *MD) {
- assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit");
- return MDTemplateValueParameter::get(VMContext, Tag, Name, MDTypeRef::get(Ty),
+ assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
+ return DITemplateValueParameter::get(VMContext, Tag, Name, DITypeRef::get(Ty),
MD);
}
-MDTemplateValueParameter *
-DIBuilder::createTemplateValueParameter(MDScope *Context, StringRef Name,
- MDType *Ty, Constant *Val) {
+DITemplateValueParameter *
+DIBuilder::createTemplateValueParameter(DIScope *Context, StringRef Name,
+ DIType *Ty, Constant *Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
getConstantOrNull(Val));
}
-MDTemplateValueParameter *
-DIBuilder::createTemplateTemplateParameter(MDScope *Context, StringRef Name,
- MDType *Ty, StringRef Val) {
+DITemplateValueParameter *
+DIBuilder::createTemplateTemplateParameter(DIScope *Context, StringRef Name,
+ DIType *Ty, StringRef Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
MDString::get(VMContext, Val));
}
-MDTemplateValueParameter *
-DIBuilder::createTemplateParameterPack(MDScope *Context, StringRef Name,
- MDType *Ty, DebugNodeArray Val) {
+DITemplateValueParameter *
+DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name,
+ DIType *Ty, DINodeArray Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
Val.get());
}
-MDCompositeType *DIBuilder::createClassType(
- MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
+DICompositeType *DIBuilder::createClassType(
+ DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
- unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
- MDType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
- assert((!Context || isa<MDScope>(Context)) &&
+ unsigned Flags, DIType *DerivedFrom, DINodeArray Elements,
+ DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
+ assert((!Context || isa<DIScope>(Context)) &&
"createClassType should be called with a valid Context");
- auto *R = MDCompositeType::get(
+ auto *R = DICompositeType::get(
VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Context)),
- MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags,
- Elements, 0, MDTypeRef::get(VTableHolder),
+ DIScopeRef::get(getNonCompileUnitScope(Context)),
+ DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags,
+ Elements, 0, DITypeRef::get(VTableHolder),
cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
if (!UniqueIdentifier.empty())
retainType(R);
@@ -390,29 +390,29 @@ MDCompositeType *DIBuilder::createClassType(
return R;
}
-MDCompositeType *DIBuilder::createStructType(
- MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
+DICompositeType *DIBuilder::createStructType(
+ DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
- MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang,
- MDType *VTableHolder, StringRef UniqueIdentifier) {
- auto *R = MDCompositeType::get(
+ DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
+ DIType *VTableHolder, StringRef UniqueIdentifier) {
+ auto *R = DICompositeType::get(
VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Context)),
- MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements,
- RunTimeLang, MDTypeRef::get(VTableHolder), nullptr, UniqueIdentifier);
+ DIScopeRef::get(getNonCompileUnitScope(Context)),
+ DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements,
+ RunTimeLang, DITypeRef::get(VTableHolder), nullptr, UniqueIdentifier);
if (!UniqueIdentifier.empty())
retainType(R);
trackIfUnresolved(R);
return R;
}
-MDCompositeType *DIBuilder::createUnionType(
- MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
+DICompositeType *DIBuilder::createUnionType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
- DebugNodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
- auto *R = MDCompositeType::get(
+ DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
+ auto *R = DICompositeType::get(
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
+ DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
AlignInBits, 0, Flags, Elements, RunTimeLang, nullptr, nullptr,
UniqueIdentifier);
if (!UniqueIdentifier.empty())
@@ -421,20 +421,20 @@ MDCompositeType *DIBuilder::createUnionType(
return R;
}
-MDSubroutineType *DIBuilder::createSubroutineType(MDFile *File,
- MDTypeRefArray ParameterTypes,
+DISubroutineType *DIBuilder::createSubroutineType(DIFile *File,
+ DITypeRefArray ParameterTypes,
unsigned Flags) {
- return MDSubroutineType::get(VMContext, Flags, ParameterTypes);
+ return DISubroutineType::get(VMContext, Flags, ParameterTypes);
}
-MDCompositeType *DIBuilder::createEnumerationType(
- MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
- uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
- MDType *UnderlyingType, StringRef UniqueIdentifier) {
- auto *CTy = MDCompositeType::get(
+DICompositeType *DIBuilder::createEnumerationType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
+ uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements,
+ DIType *UnderlyingType, StringRef UniqueIdentifier) {
+ auto *CTy = DICompositeType::get(
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
- MDScopeRef::get(getNonCompileUnitScope(Scope)),
- MDTypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements,
+ DIScopeRef::get(getNonCompileUnitScope(Scope)),
+ DITypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements,
0, nullptr, nullptr, UniqueIdentifier);
AllEnumTypes.push_back(CTy);
if (!UniqueIdentifier.empty())
@@ -443,67 +443,67 @@ MDCompositeType *DIBuilder::createEnumerationType(
return CTy;
}
-MDCompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
- MDType *Ty,
- DebugNodeArray Subscripts) {
- auto *R = MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
- nullptr, 0, nullptr, MDTypeRef::get(Ty), Size,
+DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
+ DIType *Ty,
+ DINodeArray Subscripts) {
+ auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
+ nullptr, 0, nullptr, DITypeRef::get(Ty), Size,
AlignInBits, 0, 0, Subscripts, 0, nullptr);
trackIfUnresolved(R);
return R;
}
-MDCompositeType *DIBuilder::createVectorType(uint64_t Size,
- uint64_t AlignInBits, MDType *Ty,
- DebugNodeArray Subscripts) {
+DICompositeType *DIBuilder::createVectorType(uint64_t Size,
+ uint64_t AlignInBits, DIType *Ty,
+ DINodeArray Subscripts) {
auto *R =
- MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
- nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0,
- DebugNode::FlagVector, Subscripts, 0, nullptr);
+ DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
+ nullptr, DITypeRef::get(Ty), Size, AlignInBits, 0,
+ DINode::FlagVector, Subscripts, 0, nullptr);
trackIfUnresolved(R);
return R;
}
-static MDType *createTypeWithFlags(LLVMContext &Context, MDType *Ty,
+static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty,
unsigned FlagsToSet) {
auto NewTy = Ty->clone();
NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
return MDNode::replaceWithUniqued(std::move(NewTy));
}
-MDType *DIBuilder::createArtificialType(MDType *Ty) {
+DIType *DIBuilder::createArtificialType(DIType *Ty) {
// FIXME: Restrict this to the nodes where it's valid.
if (Ty->isArtificial())
return Ty;
- return createTypeWithFlags(VMContext, Ty, DebugNode::FlagArtificial);
+ return createTypeWithFlags(VMContext, Ty, DINode::FlagArtificial);
}
-MDType *DIBuilder::createObjectPointerType(MDType *Ty) {
+DIType *DIBuilder::createObjectPointerType(DIType *Ty) {
// FIXME: Restrict this to the nodes where it's valid.
if (Ty->isObjectPointer())
return Ty;
- unsigned Flags = DebugNode::FlagObjectPointer | DebugNode::FlagArtificial;
+ unsigned Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
return createTypeWithFlags(VMContext, Ty, Flags);
}
-void DIBuilder::retainType(MDType *T) {
+void DIBuilder::retainType(DIType *T) {
assert(T && "Expected non-null type");
AllRetainTypes.emplace_back(T);
}
-MDBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; }
+DIBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; }
-MDCompositeType*
-DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope,
- MDFile* F, unsigned Line, unsigned RuntimeLang,
+DICompositeType *
+DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope,
+ DIFile *F, unsigned Line, unsigned RuntimeLang,
uint64_t SizeInBits, uint64_t AlignInBits,
StringRef UniqueIdentifier) {
// FIXME: Define in terms of createReplaceableForwardDecl() by calling
// replaceWithUniqued().
- auto *RetTy = MDCompositeType::get(
+ auto *RetTy = DICompositeType::get(
VMContext, Tag, Name, F, Line,
- MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
- AlignInBits, 0, DebugNode::FlagFwdDecl, nullptr, RuntimeLang, nullptr,
+ DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
+ AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, nullptr,
nullptr, UniqueIdentifier);
if (!UniqueIdentifier.empty())
retainType(RetTy);
@@ -511,118 +511,119 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope,
return RetTy;
}
-MDCompositeType* DIBuilder::createReplaceableCompositeType(
- unsigned Tag, StringRef Name, MDScope * Scope, MDFile* F, unsigned Line,
+DICompositeType *DIBuilder::createReplaceableCompositeType(
+ unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
unsigned Flags, StringRef UniqueIdentifier) {
- auto *RetTy = MDCompositeType::getTemporary(
+ auto *RetTy = DICompositeType::getTemporary(
VMContext, Tag, Name, F, Line,
- MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr,
+ DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr,
SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang,
- nullptr, nullptr, UniqueIdentifier).release();
+ nullptr, nullptr, UniqueIdentifier)
+ .release();
if (!UniqueIdentifier.empty())
retainType(RetTy);
trackIfUnresolved(RetTy);
return RetTy;
}
-DebugNodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
+DINodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
return MDTuple::get(VMContext, Elements);
}
-MDTypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
+DITypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
SmallVector<llvm::Metadata *, 16> Elts;
for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
if (Elements[i] && isa<MDNode>(Elements[i]))
- Elts.push_back(MDTypeRef::get(cast<MDType>(Elements[i])));
+ Elts.push_back(DITypeRef::get(cast<DIType>(Elements[i])));
else
Elts.push_back(Elements[i]);
}
- return MDTypeRefArray(MDNode::get(VMContext, Elts));
+ return DITypeRefArray(MDNode::get(VMContext, Elts));
}
-MDSubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
- return MDSubrange::get(VMContext, Count, Lo);
+DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
+ return DISubrange::get(VMContext, Count, Lo);
}
-static void checkGlobalVariableScope(MDScope * Context) {
+static void checkGlobalVariableScope(DIScope *Context) {
#ifndef NDEBUG
if (auto *CT =
- dyn_cast_or_null<MDCompositeType>(getNonCompileUnitScope(Context)))
+ dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
assert(CT->getIdentifier().empty() &&
"Context of a global variable should not be a type with identifier");
#endif
}
-MDGlobalVariable *DIBuilder::createGlobalVariable(
- MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F,
- unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val,
+DIGlobalVariable *DIBuilder::createGlobalVariable(
+ DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
+ unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
MDNode *Decl) {
checkGlobalVariableScope(Context);
- auto *N = MDGlobalVariable::get(VMContext, cast_or_null<MDScope>(Context),
+ auto *N = DIGlobalVariable::get(VMContext, cast_or_null<DIScope>(Context),
Name, LinkageName, F, LineNumber,
- MDTypeRef::get(Ty), isLocalToUnit, true, Val,
- cast_or_null<MDDerivedType>(Decl));
+ DITypeRef::get(Ty), isLocalToUnit, true, Val,
+ cast_or_null<DIDerivedType>(Decl));
AllGVs.push_back(N);
return N;
}
-MDGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
- MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F,
- unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val,
+DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
+ DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
+ unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
MDNode *Decl) {
checkGlobalVariableScope(Context);
- return MDGlobalVariable::getTemporary(
- VMContext, cast_or_null<MDScope>(Context), Name, LinkageName, F,
- LineNumber, MDTypeRef::get(Ty), isLocalToUnit, false, Val,
- cast_or_null<MDDerivedType>(Decl))
+ return DIGlobalVariable::getTemporary(
+ VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
+ LineNumber, DITypeRef::get(Ty), isLocalToUnit, false, Val,
+ cast_or_null<DIDerivedType>(Decl))
.release();
}
-MDLocalVariable *DIBuilder::createLocalVariable(
- unsigned Tag, MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNo,
- MDType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
+DILocalVariable *DIBuilder::createLocalVariable(
+ unsigned Tag, DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
+ DIType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
// FIXME: Why getNonCompileUnitScope()?
// FIXME: Why is "!Context" okay here?
// FIXME: WHy doesn't this check for a subprogram or lexical block (AFAICT
// the only valid scopes)?
- MDScope* Context = getNonCompileUnitScope(Scope);
+ DIScope *Context = getNonCompileUnitScope(Scope);
- auto *Node = MDLocalVariable::get(
- VMContext, Tag, cast_or_null<MDLocalScope>(Context), Name, File, LineNo,
- MDTypeRef::get(Ty), ArgNo, Flags);
+ auto *Node = DILocalVariable::get(
+ VMContext, Tag, cast_or_null<DILocalScope>(Context), Name, File, LineNo,
+ DITypeRef::get(Ty), ArgNo, Flags);
if (AlwaysPreserve) {
// The optimizer may remove local variable. If there is an interest
// to preserve variable info in such situation then stash it in a
// named mdnode.
- MDSubprogram *Fn = getDISubprogram(Scope);
+ DISubprogram *Fn = getDISubprogram(Scope);
assert(Fn && "Missing subprogram for local variable");
PreservedVariables[Fn].emplace_back(Node);
}
return Node;
}
-MDExpression* DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
- return MDExpression::get(VMContext, Addr);
+DIExpression *DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
+ return DIExpression::get(VMContext, Addr);
}
-MDExpression* DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
+DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
// TODO: Remove the callers of this signed version and delete.
SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end());
return createExpression(Addr);
}
-MDExpression* DIBuilder::createBitPieceExpression(unsigned OffsetInBytes,
- unsigned SizeInBytes) {
+DIExpression *DIBuilder::createBitPieceExpression(unsigned OffsetInBytes,
+ unsigned SizeInBytes) {
uint64_t Addr[] = {dwarf::DW_OP_bit_piece, OffsetInBytes, SizeInBytes};
- return MDExpression::get(VMContext, Addr);
+ return DIExpression::get(VMContext, Addr);
}
-MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name,
- StringRef LinkageName, MDFile *File,
- unsigned LineNo, MDSubroutineType *Ty,
+DISubprogram *DIBuilder::createFunction(DIScopeRef Context, StringRef Name,
+ StringRef LinkageName, DIFile *File,
+ unsigned LineNo, DISubroutineType *Ty,
bool isLocalToUnit, bool isDefinition,
unsigned ScopeLine, unsigned Flags,
bool isOptimized, Function *Fn,
@@ -635,20 +636,20 @@ MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name,
Flags, isOptimized, Fn, TParams, Decl);
}
-MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name,
- StringRef LinkageName, MDFile* File,
- unsigned LineNo, MDSubroutineType* Ty,
- bool isLocalToUnit, bool isDefinition,
- unsigned ScopeLine, unsigned Flags,
- bool isOptimized, Function *Fn,
- MDNode *TParams, MDNode *Decl) {
+DISubprogram *DIBuilder::createFunction(DIScope *Context, StringRef Name,
+ StringRef LinkageName, DIFile *File,
+ unsigned LineNo, DISubroutineType *Ty,
+ bool isLocalToUnit, bool isDefinition,
+ unsigned ScopeLine, unsigned Flags,
+ bool isOptimized, Function *Fn,
+ MDNode *TParams, MDNode *Decl) {
assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
"function types should be subroutines");
- auto *Node = MDSubprogram::get(
- VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name,
- LinkageName, File, LineNo, Ty,
- isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
- Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
+ auto *Node = DISubprogram::get(
+ VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name,
+ LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
+ nullptr, 0, 0, Flags, isOptimized, Fn, cast_or_null<MDTuple>(TParams),
+ cast_or_null<DISubprogram>(Decl),
MDTuple::getTemporary(VMContext, None).release());
if (isDefinition)
@@ -657,27 +658,25 @@ MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name,
return Node;
}
-MDSubprogram*
-DIBuilder::createTempFunctionFwdDecl(MDScope * Context, StringRef Name,
- StringRef LinkageName, MDFile* File,
- unsigned LineNo, MDSubroutineType* Ty,
- bool isLocalToUnit, bool isDefinition,
- unsigned ScopeLine, unsigned Flags,
- bool isOptimized, Function *Fn,
- MDNode *TParams, MDNode *Decl) {
- return MDSubprogram::getTemporary(
- VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name,
- LinkageName, File, LineNo, Ty,
- isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags,
- isOptimized, Fn, cast_or_null<MDTuple>(TParams),
- cast_or_null<MDSubprogram>(Decl), nullptr).release();
-}
-
-MDSubprogram *
-DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
- MDFile *F, unsigned LineNo, MDSubroutineType *Ty,
+DISubprogram *DIBuilder::createTempFunctionFwdDecl(
+ DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
+ unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
+ bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
+ Function *Fn, MDNode *TParams, MDNode *Decl) {
+ return DISubprogram::getTemporary(
+ VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name,
+ LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
+ ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
+ cast_or_null<MDTuple>(TParams), cast_or_null<DISubprogram>(Decl),
+ nullptr)
+ .release();
+}
+
+DISubprogram *
+DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
+ DIFile *F, unsigned LineNo, DISubroutineType *Ty,
bool isLocalToUnit, bool isDefinition, unsigned VK,
- unsigned VIndex, MDType *VTableHolder, unsigned Flags,
+ unsigned VIndex, DIType *VTableHolder, unsigned Flags,
bool isOptimized, Function *Fn, MDNode *TParam) {
assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
"function types should be subroutines");
@@ -685,10 +684,10 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
"Methods should have both a Context and a context that isn't "
"the compile unit.");
// FIXME: Do we want to use different scope/lines?
- auto *SP = MDSubprogram::get(
- VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F,
+ auto *SP = DISubprogram::get(
+ VMContext, DIScopeRef::get(cast<DIScope>(Context)), Name, LinkageName, F,
LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
- MDTypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn,
+ DITypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn,
cast_or_null<MDTuple>(TParam), nullptr, nullptr);
if (isDefinition)
@@ -697,23 +696,23 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
return SP;
}
-MDNamespace* DIBuilder::createNameSpace(MDScope * Scope, StringRef Name,
- MDFile* File, unsigned LineNo) {
- return MDNamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name,
+DINamespace *DIBuilder::createNameSpace(DIScope *Scope, StringRef Name,
+ DIFile *File, unsigned LineNo) {
+ return DINamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name,
LineNo);
}
-MDLexicalBlockFile* DIBuilder::createLexicalBlockFile(MDScope * Scope,
- MDFile* File,
- unsigned Discriminator) {
- return MDLexicalBlockFile::get(VMContext, Scope, File, Discriminator);
+DILexicalBlockFile *DIBuilder::createLexicalBlockFile(DIScope *Scope,
+ DIFile *File,
+ unsigned Discriminator) {
+ return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
}
-MDLexicalBlock* DIBuilder::createLexicalBlock(MDScope * Scope, MDFile* File,
- unsigned Line, unsigned Col) {
+DILexicalBlock *DIBuilder::createLexicalBlock(DIScope *Scope, DIFile *File,
+ unsigned Line, unsigned Col) {
// Make these distinct, to avoid merging two lexical blocks on the same
// file/line/column.
- return MDLexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
+ return DILexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
File, Line, Col);
}
@@ -722,15 +721,15 @@ static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {
return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
}
-static Instruction *withDebugLoc(Instruction *I, const MDLocation *DL) {
- I->setDebugLoc(const_cast<MDLocation *>(DL));
+static Instruction *withDebugLoc(Instruction *I, const DILocation *DL) {
+ I->setDebugLoc(const_cast<DILocation *>(DL));
return I;
}
-Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
- MDExpression* Expr, const MDLocation *DL,
+Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
+ DIExpression *Expr, const DILocation *DL,
Instruction *InsertBefore) {
- assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare");
+ assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
assert(DL && "Expected debug loc");
assert(DL->getScope()->getSubprogram() ==
VarInfo->getScope()->getSubprogram() &&
@@ -746,10 +745,10 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
return withDebugLoc(CallInst::Create(DeclareFn, Args, "", InsertBefore), DL);
}
-Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
- MDExpression* Expr, const MDLocation *DL,
+Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
+ DIExpression *Expr, const DILocation *DL,
BasicBlock *InsertAtEnd) {
- assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare");
+ assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
assert(DL && "Expected debug loc");
assert(DL->getScope()->getSubprogram() ==
VarInfo->getScope()->getSubprogram() &&
@@ -771,12 +770,12 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
}
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
- MDLocalVariable* VarInfo,
- MDExpression* Expr,
- const MDLocation *DL,
+ DILocalVariable *VarInfo,
+ DIExpression *Expr,
+ const DILocation *DL,
Instruction *InsertBefore) {
assert(V && "no value passed to dbg.value");
- assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value");
+ assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
assert(DL && "Expected debug loc");
assert(DL->getScope()->getSubprogram() ==
VarInfo->getScope()->getSubprogram() &&
@@ -794,12 +793,12 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
}
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
- MDLocalVariable* VarInfo,
- MDExpression* Expr,
- const MDLocation *DL,
+ DILocalVariable *VarInfo,
+ DIExpression *Expr,
+ const DILocation *DL,
BasicBlock *InsertAtEnd) {
assert(V && "no value passed to dbg.value");
- assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value");
+ assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
assert(DL && "Expected debug loc");
assert(DL->getScope()->getSubprogram() ==
VarInfo->getScope()->getSubprogram() &&
@@ -817,10 +816,11 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
return withDebugLoc(CallInst::Create(ValueFn, Args, "", InsertAtEnd), DL);
}
-void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTableHolder) {
+void DIBuilder::replaceVTableHolder(DICompositeType *&T,
+ DICompositeType *VTableHolder) {
{
- TypedTrackingMDRef<MDCompositeType> N(T);
- N->replaceVTableHolder(MDTypeRef::get(VTableHolder));
+ TypedTrackingMDRef<DICompositeType> N(T);
+ N->replaceVTableHolder(DITypeRef::get(VTableHolder));
T = N.get();
}
@@ -836,14 +836,14 @@ void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTable
trackIfUnresolved(N);
}
-void DIBuilder::replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
- DebugNodeArray TParams) {
+void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
+ DINodeArray TParams) {
{
- TypedTrackingMDRef<MDCompositeType> N(T);
+ TypedTrackingMDRef<DICompositeType> N(T);
if (Elements)
N->replaceElements(Elements);
if (TParams)
- N->replaceTemplateParams(MDTemplateParameterArray(TParams));
+ N->replaceTemplateParams(DITemplateParameterArray(TParams));
T = N.get();
}
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index ccc2c7c72e9..2e161c2ba6c 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -33,13 +33,13 @@
using namespace llvm;
using namespace llvm::dwarf;
-MDSubprogram *llvm::getDISubprogram(const MDNode *Scope) {
- if (auto *LocalScope = dyn_cast_or_null<MDLocalScope>(Scope))
+DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
+ if (auto *LocalScope = dyn_cast_or_null<DILocalScope>(Scope))
return LocalScope->getSubprogram();
return nullptr;
}
-MDSubprogram *llvm::getDISubprogram(const Function *F) {
+DISubprogram *llvm::getDISubprogram(const Function *F) {
// We look for the first instr that has a debug annotation leading back to F.
for (auto &BB : *F) {
auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction &Inst) {
@@ -56,11 +56,11 @@ MDSubprogram *llvm::getDISubprogram(const Function *F) {
return nullptr;
}
-MDCompositeTypeBase *llvm::getDICompositeType(MDType *T) {
- if (auto *C = dyn_cast_or_null<MDCompositeTypeBase>(T))
+DICompositeTypeBase *llvm::getDICompositeType(DIType *T) {
+ if (auto *C = dyn_cast_or_null<DICompositeTypeBase>(T))
return C;
- if (auto *D = dyn_cast_or_null<MDDerivedTypeBase>(T)) {
+ if (auto *D = dyn_cast_or_null<DIDerivedTypeBase>(T)) {
// This function is currently used by dragonegg and dragonegg does
// not generate identifier for types, so using an empty map to resolve
// DerivedFrom should be fine.
@@ -75,12 +75,12 @@ DITypeIdentifierMap
llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) {
DITypeIdentifierMap Map;
for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) {
- auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi));
- DebugNodeArray Retain = CU->getRetainedTypes();
+ auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(CUi));
+ DINodeArray Retain = CU->getRetainedTypes();
for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) {
- if (!isa<MDCompositeType>(Retain[Ti]))
+ if (!isa<DICompositeType>(Retain[Ti]))
continue;
- auto *Ty = cast<MDCompositeType>(Retain[Ti]);
+ auto *Ty = cast<DICompositeType>(Retain[Ti]);
if (MDString *TypeId = Ty->getRawIdentifier()) {
// Definition has priority over declaration.
// Try to insert (TypeId, Ty) to Map.
@@ -123,7 +123,7 @@ void DebugInfoFinder::processModule(const Module &M) {
InitializeTypeMap(M);
if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
- auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i));
+ auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
addCompileUnit(CU);
for (auto *DIG : CU->getGlobalVariables()) {
if (addGlobalVariable(DIG)) {
@@ -139,18 +139,18 @@ void DebugInfoFinder::processModule(const Module &M) {
processType(RT);
for (auto *Import : CU->getImportedEntities()) {
auto *Entity = Import->getEntity().resolve(TypeIdentifierMap);
- if (auto *T = dyn_cast<MDType>(Entity))
+ if (auto *T = dyn_cast<DIType>(Entity))
processType(T);
- else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
+ else if (auto *SP = dyn_cast<DISubprogram>(Entity))
processSubprogram(SP);
- else if (auto *NS = dyn_cast<MDNamespace>(Entity))
+ else if (auto *NS = dyn_cast<DINamespace>(Entity))
processScope(NS->getScope());
}
}
}
}
-void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) {
+void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
if (!Loc)
return;
InitializeTypeMap(M);
@@ -158,61 +158,61 @@ void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) {
processLocation(M, Loc->getInlinedAt());
}
-void DebugInfoFinder::processType(MDType *DT) {
+void DebugInfoFinder::processType(DIType *DT) {
if (!addType(DT))
return;
processScope(DT->getScope().resolve(TypeIdentifierMap));
- if (auto *DCT = dyn_cast<MDCompositeTypeBase>(DT)) {
+ if (auto *DCT = dyn_cast<DICompositeTypeBase>(DT)) {
processType(DCT->getBaseType().resolve(TypeIdentifierMap));
- if (auto *ST = dyn_cast<MDSubroutineType>(DCT)) {
- for (MDTypeRef Ref : ST->getTypeArray())
+ if (auto *ST = dyn_cast<DISubroutineType>(DCT)) {
+ for (DITypeRef Ref : ST->getTypeArray())
processType(Ref.resolve(TypeIdentifierMap));
return;
}
for (Metadata *D : DCT->getElements()) {
- if (auto *T = dyn_cast<MDType>(D))
+ if (auto *T = dyn_cast<DIType>(D))
processType(T);
- else if (auto *SP = dyn_cast<MDSubprogram>(D))
+ else if (auto *SP = dyn_cast<DISubprogram>(D))
processSubprogram(SP);
}
- } else if (auto *DDT = dyn_cast<MDDerivedTypeBase>(DT)) {
+ } else if (auto *DDT = dyn_cast<DIDerivedTypeBase>(DT)) {
processType(DDT->getBaseType().resolve(TypeIdentifierMap));
}
}
-void DebugInfoFinder::processScope(MDScope *Scope) {
+void DebugInfoFinder::processScope(DIScope *Scope) {
if (!Scope)
return;
- if (auto *Ty = dyn_cast<MDType>(Scope)) {
+ if (auto *Ty = dyn_cast<DIType>(Scope)) {
processType(Ty);
return;
}
- if (auto *CU = dyn_cast<MDCompileUnit>(Scope)) {
+ if (auto *CU = dyn_cast<DICompileUnit>(Scope)) {
addCompileUnit(CU);
return;
}
- if (auto *SP = dyn_cast<MDSubprogram>(Scope)) {
+ if (auto *SP = dyn_cast<DISubprogram>(Scope)) {
processSubprogram(SP);
return;
}
if (!addScope(Scope))
return;
- if (auto *LB = dyn_cast<MDLexicalBlockBase>(Scope)) {
+ if (auto *LB = dyn_cast<DILexicalBlockBase>(Scope)) {
processScope(LB->getScope());
- } else if (auto *NS = dyn_cast<MDNamespace>(Scope)) {
+ } else if (auto *NS = dyn_cast<DINamespace>(Scope)) {
processScope(NS->getScope());
}
}
-void DebugInfoFinder::processSubprogram(MDSubprogram *SP) {
+void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
if (!addSubprogram(SP))
return;
processScope(SP->getScope().resolve(TypeIdentifierMap));
processType(SP->getType());
for (auto *Element : SP->getTemplateParams()) {
- if (auto *TType = dyn_cast<MDTemplateTypeParameter>(Element)) {
+ if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
processType(TType->getType().resolve(TypeIdentifierMap));
- } else if (auto *TVal = dyn_cast<MDTemplateValueParameter>(Element)) {
+ } else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
processType(TVal->getType().resolve(TypeIdentifierMap));
}
}
@@ -225,7 +225,7 @@ void DebugInfoFinder::processDeclare(const Module &M,
return;
InitializeTypeMap(M);
- auto *DV = dyn_cast<MDLocalVariable>(N);
+ auto *DV = dyn_cast<DILocalVariable>(N);
if (!DV)
return;
@@ -241,7 +241,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
return;
InitializeTypeMap(M);
- auto *DV = dyn_cast<MDLocalVariable>(N);
+ auto *DV = dyn_cast<DILocalVariable>(N);
if (!DV)
return;
@@ -251,18 +251,18 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
processType(DV->getType().resolve(TypeIdentifierMap));
}
-bool DebugInfoFinder::addType(MDType *DT) {
+bool DebugInfoFinder::addType(DIType *DT) {
if (!DT)
return false;
if (!NodesSeen.insert(DT).second)
return false;
- TYs.push_back(const_cast<MDType *>(DT));
+ TYs.push_back(const_cast<DIType *>(DT));
return true;
}
-bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) {
+bool DebugInfoFinder::addCompileUnit(DICompileUnit *CU) {
if (!CU)
return false;
if (!NodesSeen.insert(CU).second)
@@ -272,7 +272,7 @@ bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) {
return true;
}
-bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) {
+bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable *DIG) {
if (!DIG)
return false;
@@ -283,7 +283,7 @@ bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) {
return true;
}
-bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) {
+bool DebugInfoFinder::addSubprogram(DISubprogram *SP) {
if (!SP)
return false;
@@ -294,7 +294,7 @@ bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) {
return true;
}
-bool DebugInfoFinder::addScope(MDScope *Scope) {
+bool DebugInfoFinder::addScope(DIScope *Scope) {
if (!Scope)
return false;
// FIXME: Ocaml binding generates a scope with no content, we treat it
@@ -369,16 +369,16 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) {
return 0;
}
-DenseMap<const llvm::Function *, MDSubprogram *>
+DenseMap<const llvm::Function *, DISubprogram *>
llvm::makeSubprogramMap(const Module &M) {
- DenseMap<const Function *, MDSubprogram *> R;
+ DenseMap<const Function *, DISubprogram *> R;
NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes)
return R;
for (MDNode *N : CU_Nodes->operands()) {
- auto *CUNode = cast<MDCompileUnit>(N);
+ auto *CUNode = cast<DICompileUnit>(N);
for (auto *SP : CUNode->getSubprograms()) {
if (Function *F = SP->getFunction())
R.insert(std::make_pair(F, SP));
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 4be35636cf8..85335d547b1 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -19,9 +19,9 @@
using namespace llvm;
-MDLocation::MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
+DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
unsigned Column, ArrayRef<Metadata *> MDs)
- : MDNode(C, MDLocationKind, Storage, MDs) {
+ : MDNode(C, DILocationKind, Storage, MDs) {
assert((MDs.size() == 1 || MDs.size() == 2) &&
"Expected a scope and optional inlined-at");
@@ -38,7 +38,7 @@ static void adjustColumn(unsigned &Column) {
Column = 0;
}
-MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
+DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
unsigned Column, Metadata *Scope,
Metadata *InlinedAt, StorageType Storage,
bool ShouldCreate) {
@@ -48,8 +48,8 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
assert(Scope && "Expected scope");
if (Storage == Uniqued) {
if (auto *N =
- getUniqued(Context.pImpl->MDLocations,
- MDLocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
+ getUniqued(Context.pImpl->DILocations,
+ DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
return N;
if (!ShouldCreate)
return nullptr;
@@ -62,11 +62,11 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
if (InlinedAt)
Ops.push_back(InlinedAt);
return storeImpl(new (Ops.size())
- MDLocation(Context, Storage, Line, Column, Ops),
- Storage, Context.pImpl->MDLocations);
+ DILocation(Context, Storage, Line, Column, Ops),
+ Storage, Context.pImpl->DILocations);
}
-unsigned MDLocation::computeNewDiscriminator() const {
+unsigned DILocation::computeNewDiscriminator() const {
// FIXME: This seems completely wrong.
//
// 1. If two modules are generated in the same context, then the second
@@ -83,14 +83,14 @@ unsigned MDLocation::computeNewDiscriminator() const {
return ++getContext().pImpl->DiscriminatorTable[Key];
}
-unsigned DebugNode::getFlag(StringRef Flag) {
+unsigned DINode::getFlag(StringRef Flag) {
return StringSwitch<unsigned>(Flag)
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
#include "llvm/IR/DebugInfoFlags.def"
.Default(0);
}
-const char *DebugNode::getFlagString(unsigned Flag) {
+const char *DINode::getFlagString(unsigned Flag) {
switch (Flag) {
default:
return "";
@@ -101,8 +101,8 @@ const char *DebugNode::getFlagString(unsigned Flag) {
}
}
-unsigned DebugNode::splitFlags(unsigned Flags,
- SmallVectorImpl<unsigned> &SplitFlags) {
+unsigned DINode::splitFlags(unsigned Flags,
+ SmallVectorImpl<unsigned> &SplitFlags) {
// Accessibility flags need to be specially handled, since they're packed
// together.
if (unsigned A = Flags & FlagAccessibility) {
@@ -125,33 +125,33 @@ unsigned DebugNode::splitFlags(unsigned Flags,
return Flags;
}
-MDScopeRef MDScope::getScope() const {
- if (auto *T = dyn_cast<MDType>(this))
+DIScopeRef DIScope::getScope() const {
+ if (auto *T = dyn_cast<DIType>(this))
return T->getScope();
- if (auto *SP = dyn_cast<MDSubprogram>(this))
+ if (auto *SP = dyn_cast<DISubprogram>(this))
return SP->getScope();
- if (auto *LB = dyn_cast<MDLexicalBlockBase>(this))
- return MDScopeRef(LB->getScope());
+ if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
+ return DIScopeRef(LB->getScope());
- if (auto *NS = dyn_cast<MDNamespace>(this))
- return MDScopeRef(NS->getScope());
+ if (auto *NS = dyn_cast<DINamespace>(this))
+ return DIScopeRef(NS->getScope());
- assert((isa<MDFile>(this) || isa<MDCompileUnit>(this)) &&
+ assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
"Unhandled type of scope.");
return nullptr;
}
-StringRef MDScope::getName() const {
- if (auto *T = dyn_cast<MDType>(this))
+StringRef DIScope::getName() const {
+ if (auto *T = dyn_cast<DIType>(this))
return T->getName();
- if (auto *SP = dyn_cast<MDSubprogram>(this))
+ if (auto *SP = dyn_cast<DISubprogram>(this))
return SP->getName();
- if (auto *NS = dyn_cast<MDNamespace>(this))
+ if (auto *NS = dyn_cast<DINamespace>(this))
return NS->getName();
- assert((isa<MDLexicalBlockBase>(this) || isa<MDFile>(this) ||
- isa<MDCompileUnit>(this)) &&
+ assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
+ isa<DICompileUnit>(this)) &&
"Unhandled type of scope.");
return "";
}
@@ -168,15 +168,14 @@ static bool isCanonical(const MDString *S) {
}
#endif
-GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Header,
- ArrayRef<Metadata *> DwarfOps,
- StorageType Storage,
- bool ShouldCreate) {
+GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
+ MDString *Header,
+ ArrayRef<Metadata *> DwarfOps,
+ StorageType Storage, bool ShouldCreate) {
unsigned Hash = 0;
if (Storage == Uniqued) {
- GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
- if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key))
+ GenericDINodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
+ if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
return N;
if (!ShouldCreate)
return nullptr;
@@ -188,13 +187,13 @@ GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
// Use a nullptr for empty headers.
assert(isCanonical(Header) && "Expected canonical MDString");
Metadata *PreOps[] = {Header};
- return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
+ return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
Context, Storage, Hash, Tag, PreOps, DwarfOps),
- Storage, Context.pImpl->GenericDebugNodes);
+ Storage, Context.pImpl->GenericDINodes);
}
-void GenericDebugNode::recalculateHash() {
- setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this));
+void GenericDINode::recalculateHash() {
+ setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
}
#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
@@ -224,49 +223,49 @@ void GenericDebugNode::recalculateHash() {
CLASS(Context, Storage, OPS), \
Storage, Context.pImpl->CLASS##s)
-MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
+DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
StorageType Storage, bool ShouldCreate) {
- DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo));
- DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo));
+ DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo));
+ DEFINE_GETIMPL_STORE_NO_OPS(DISubrange, (Count, Lo));
}
-MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value,
+DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
MDString *Name, StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name)));
+ DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, getString(Name)));
Metadata *Ops[] = {Name};
- DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops);
+ DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops);
}
-MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag,
+DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
MDString *Name, uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Encoding,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(
- MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
+ DIBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
Metadata *Ops[] = {nullptr, nullptr, Name};
- DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
+ DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
Ops);
}
-MDDerivedType *MDDerivedType::getImpl(
+DIDerivedType *DIDerivedType::getImpl(
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope,
+ DEFINE_GETIMPL_LOOKUP(DIDerivedType, (Tag, getString(Name), File, Line, Scope,
BaseType, SizeInBits, AlignInBits,
OffsetInBits, Flags, ExtraData));
Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
DEFINE_GETIMPL_STORE(
- MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
+ DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
Ops);
}
-MDCompositeType *MDCompositeType::getImpl(
+DICompositeType *DICompositeType::getImpl(
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
@@ -274,39 +273,39 @@ MDCompositeType *MDCompositeType::getImpl(
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDCompositeType,
+ DEFINE_GETIMPL_LOOKUP(DICompositeType,
(Tag, getString(Name), File, Line, Scope, BaseType,
SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
RuntimeLang, VTableHolder, TemplateParams,
getString(Identifier)));
Metadata *Ops[] = {File, Scope, Name, BaseType,
Elements, VTableHolder, TemplateParams, Identifier};
- DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits,
+ DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
AlignInBits, OffsetInBits, Flags),
Ops);
}
-MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context,
+DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
unsigned Flags, Metadata *TypeArray,
StorageType Storage,
bool ShouldCreate) {
- DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray));
+ DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray));
Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
TypeArray, nullptr, nullptr, nullptr};
- DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops);
+ DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops);
}
-MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename,
+DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
MDString *Directory, StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Filename) && "Expected canonical MDString");
assert(isCanonical(Directory) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory)));
+ DEFINE_GETIMPL_LOOKUP(DIFile, (getString(Filename), getString(Directory)));
Metadata *Ops[] = {Filename, Directory};
- DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops);
+ DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIFile, Ops);
}
-MDCompileUnit *MDCompileUnit::getImpl(
+DICompileUnit *DICompileUnit::getImpl(
LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
MDString *Producer, bool IsOptimized, MDString *Flags,
unsigned RuntimeVersion, MDString *SplitDebugFilename,
@@ -317,7 +316,7 @@ MDCompileUnit *MDCompileUnit::getImpl(
assert(isCanonical(Flags) && "Expected canonical MDString");
assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(
- MDCompileUnit,
+ DICompileUnit,
(SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
RetainedTypes, Subprograms, GlobalVariables, ImportedEntities));
@@ -325,17 +324,17 @@ MDCompileUnit *MDCompileUnit::getImpl(
RetainedTypes, Subprograms, GlobalVariables,
ImportedEntities};
DEFINE_GETIMPL_STORE(
- MDCompileUnit,
+ DICompileUnit,
(SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops);
}
-MDSubprogram *MDLocalScope::getSubprogram() const {
- if (auto *Block = dyn_cast<MDLexicalBlockBase>(this))
+DISubprogram *DILocalScope::getSubprogram() const {
+ if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
return Block->getScope()->getSubprogram();
- return const_cast<MDSubprogram *>(cast<MDSubprogram>(this));
+ return const_cast<DISubprogram *>(cast<DISubprogram>(this));
}
-MDSubprogram *MDSubprogram::getImpl(
+DISubprogram *DISubprogram::getImpl(
LLVMContext &Context, Metadata *Scope, MDString *Name,
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
@@ -345,7 +344,7 @@ MDSubprogram *MDSubprogram::getImpl(
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(LinkageName) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDSubprogram,
+ DEFINE_GETIMPL_LOOKUP(DISubprogram,
(Scope, getString(Name), getString(LinkageName), File,
Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
ContainingType, Virtuality, VirtualIndex, Flags,
@@ -354,18 +353,18 @@ MDSubprogram *MDSubprogram::getImpl(
Metadata *Ops[] = {File, Scope, Name, Name,
LinkageName, Type, ContainingType, Function,
TemplateParams, Declaration, Variables};
- DEFINE_GETIMPL_STORE(MDSubprogram,
+ DEFINE_GETIMPL_STORE(DISubprogram,
(Line, ScopeLine, Virtuality, VirtualIndex, Flags,
IsLocalToUnit, IsDefinition, IsOptimized),
Ops);
}
-Function *MDSubprogram::getFunction() const {
+Function *DISubprogram::getFunction() const {
// FIXME: Should this be looking through bitcasts?
return dyn_cast_or_null<Function>(getFunctionConstant());
}
-bool MDSubprogram::describes(const Function *F) const {
+bool DISubprogram::describes(const Function *F) const {
assert(F && "Invalid function");
if (F == getFunction())
return true;
@@ -375,64 +374,64 @@ bool MDSubprogram::describes(const Function *F) const {
return F->getName() == Name;
}
-void MDSubprogram::replaceFunction(Function *F) {
+void DISubprogram::replaceFunction(Function *F) {
replaceFunction(F ? ConstantAsMetadata::get(F)
: static_cast<ConstantAsMetadata *>(nullptr));
}
-MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
+DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *File, unsigned Line,
unsigned Column, StorageType Storage,
bool ShouldCreate) {
assert(Scope && "Expected scope");
- DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column));
+ DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
Metadata *Ops[] = {File, Scope};
- DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops);
+ DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
}
-MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context,
+DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
Metadata *Scope, Metadata *File,
unsigned Discriminator,
StorageType Storage,
bool ShouldCreate) {
assert(Scope && "Expected scope");
- DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator));
+ DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
Metadata *Ops[] = {File, Scope};
- DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops);
+ DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
}
-MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope,
+DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *File, MDString *Name, unsigned Line,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line));
+ DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, getString(Name), Line));
Metadata *Ops[] = {File, Scope, Name};
- DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops);
+ DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
}
-MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context,
+DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
MDString *Name,
Metadata *Type,
StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type));
+ DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (getString(Name), Type));
Metadata *Ops[] = {Name, Type};
- DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops);
+ DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
}
-MDTemplateValueParameter *MDTemplateValueParameter::getImpl(
+DITemplateValueParameter *DITemplateValueParameter::getImpl(
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
Metadata *Value, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter,
+ DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter,
(Tag, getString(Name), Type, Value));
Metadata *Ops[] = {Name, Type, Value};
- DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops);
+ DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
}
-MDGlobalVariable *
-MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
+DIGlobalVariable *
+DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
MDString *LinkageName, Metadata *File, unsigned Line,
Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
Metadata *Variable,
@@ -440,17 +439,17 @@ MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(LinkageName) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDGlobalVariable,
+ DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
(Scope, getString(Name), getString(LinkageName), File,
Line, Type, IsLocalToUnit, IsDefinition, Variable,
StaticDataMemberDeclaration));
Metadata *Ops[] = {Scope, Name, File, Type,
Name, LinkageName, Variable, StaticDataMemberDeclaration};
- DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
+ DEFINE_GETIMPL_STORE(DIGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
Ops);
}
-MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
+DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg,
@@ -461,20 +460,20 @@ MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
assert(Scope && "Expected scope");
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File,
+ DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
Line, Type, Arg, Flags));
Metadata *Ops[] = {Scope, Name, File, Type};
- DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops);
+ DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
}
-MDExpression *MDExpression::getImpl(LLVMContext &Context,
+DIExpression *DIExpression::getImpl(LLVMContext &Context,
ArrayRef<uint64_t> Elements,
StorageType Storage, bool ShouldCreate) {
- DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements));
- DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements));
+ DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
+ DEFINE_GETIMPL_STORE_NO_OPS(DIExpression, (Elements));
}
-unsigned MDExpression::ExprOperand::getSize() const {
+unsigned DIExpression::ExprOperand::getSize() const {
switch (getOp()) {
case dwarf::DW_OP_bit_piece:
return 3;
@@ -485,7 +484,7 @@ unsigned MDExpression::ExprOperand::getSize() const {
}
}
-bool MDExpression::isValid() const {
+bool DIExpression::isValid() const {
for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
// Check that there's space for the operand.
if (I->get() + I->getSize() > E->get())
@@ -506,7 +505,7 @@ bool MDExpression::isValid() const {
return true;
}
-bool MDExpression::isBitPiece() const {
+bool DIExpression::isBitPiece() const {
assert(isValid() && "Expected valid expression");
if (unsigned N = getNumElements())
if (N >= 3)
@@ -514,38 +513,38 @@ bool MDExpression::isBitPiece() const {
return false;
}
-uint64_t MDExpression::getBitPieceOffset() const {
+uint64_t DIExpression::getBitPieceOffset() const {
assert(isBitPiece() && "Expected bit piece");
return getElement(getNumElements() - 2);
}
-uint64_t MDExpression::getBitPieceSize() const {
+uint64_t DIExpression::getBitPieceSize() const {
assert(isBitPiece() && "Expected bit piece");
return getElement(getNumElements() - 1);
}
-MDObjCProperty *MDObjCProperty::getImpl(
+DIObjCProperty *DIObjCProperty::getImpl(
LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
MDString *GetterName, MDString *SetterName, unsigned Attributes,
Metadata *Type, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(GetterName) && "Expected canonical MDString");
assert(isCanonical(SetterName) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDObjCProperty,
+ DEFINE_GETIMPL_LOOKUP(DIObjCProperty,
(getString(Name), File, Line, getString(GetterName),
getString(SetterName), Attributes, Type));
Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
- DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops);
+ DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
}
-MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
+DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
Metadata *Scope, Metadata *Entity,
unsigned Line, MDString *Name,
StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(MDImportedEntity,
+ DEFINE_GETIMPL_LOOKUP(DIImportedEntity,
(Tag, Scope, Entity, Line, getString(Name)));
Metadata *Ops[] = {Scope, Entity, Name};
- DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops);
+ DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
}
diff --git a/llvm/lib/IR/DebugLoc.cpp b/llvm/lib/IR/DebugLoc.cpp
index 2d00c983311..72d5c0e6188 100644
--- a/llvm/lib/IR/DebugLoc.cpp
+++ b/llvm/lib/IR/DebugLoc.cpp
@@ -16,11 +16,11 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
// DebugLoc Implementation
//===----------------------------------------------------------------------===//
-DebugLoc::DebugLoc(const MDLocation *L) : Loc(const_cast<MDLocation *>(L)) {}
+DebugLoc::DebugLoc(const DILocation *L) : Loc(const_cast<DILocation *>(L)) {}
DebugLoc::DebugLoc(const MDNode *L) : Loc(const_cast<MDNode *>(L)) {}
-MDLocation *DebugLoc::get() const {
- return cast_or_null<MDLocation>(Loc.get());
+DILocation *DebugLoc::get() const {
+ return cast_or_null<DILocation>(Loc.get());
}
unsigned DebugLoc::getLine() const {
@@ -38,17 +38,17 @@ MDNode *DebugLoc::getScope() const {
return get()->getScope();
}
-MDLocation *DebugLoc::getInlinedAt() const {
+DILocation *DebugLoc::getInlinedAt() const {
assert(get() && "Expected valid DebugLoc");
return get()->getInlinedAt();
}
MDNode *DebugLoc::getInlinedAtScope() const {
- return cast<MDLocation>(Loc)->getInlinedAtScope();
+ return cast<DILocation>(Loc)->getInlinedAtScope();
}
DebugLoc DebugLoc::getFnDebugLoc() const {
- // FIXME: Add a method on \a MDLocation that does this work.
+ // FIXME: Add a method on \a DILocation that does this work.
const MDNode *Scope = getInlinedAtScope();
if (auto *SP = getDISubprogram(Scope))
return DebugLoc::get(SP->getScopeLine(), 0, SP);
@@ -62,7 +62,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope,
if (!Scope)
return DebugLoc();
- return MDLocation::get(Scope->getContext(), Line, Col,
+ return DILocation::get(Scope->getContext(), Line, Col,
const_cast<MDNode *>(Scope),
const_cast<MDNode *>(InlinedAt));
}
@@ -88,7 +88,7 @@ void DebugLoc::print(raw_ostream &OS) const {
return;
// Print source line info.
- auto *Scope = cast<MDScope>(getScope());
+ auto *Scope = cast<DIScope>(getScope());
OS << Scope->getFilename();
OS << ':' << getLine();
if (getCol() != 0)
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 91635f67959..b161d07ac98 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -135,7 +135,7 @@ bool DiagnosticInfoOptimizationBase::isLocationAvailable() const {
void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename,
unsigned *Line,
unsigned *Column) const {
- MDLocation *L = getDebugLoc();
+ DILocation *L = getDebugLoc();
*Filename = L->getFilename();
*Line = L->getLine();
*Column = L->getColumn();
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index edffef31511..09c28838fe8 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -228,8 +228,8 @@ template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
}
};
-/// \brief DenseMapInfo for MDLocation.
-template <> struct MDNodeKeyImpl<MDLocation> {
+/// \brief DenseMapInfo for DILocation.
+template <> struct MDNodeKeyImpl<DILocation> {
unsigned Line;
unsigned Column;
Metadata *Scope;
@@ -239,11 +239,11 @@ template <> struct MDNodeKeyImpl<MDLocation> {
Metadata *InlinedAt)
: Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {}
- MDNodeKeyImpl(const MDLocation *L)
+ MDNodeKeyImpl(const DILocation *L)
: Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
InlinedAt(L->getRawInlinedAt()) {}
- bool isKeyOf(const MDLocation *RHS) const {
+ bool isKeyOf(const DILocation *RHS) const {
return Line == RHS->getLine() && Column == RHS->getColumn() &&
Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt();
}
@@ -252,57 +252,57 @@ template <> struct MDNodeKeyImpl<MDLocation> {
}
};
-/// \brief DenseMapInfo for GenericDebugNode.
-template <> struct MDNodeKeyImpl<GenericDebugNode> : MDNodeOpsKey {
+/// \brief DenseMapInfo for GenericDINode.
+template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
unsigned Tag;
StringRef Header;
MDNodeKeyImpl(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps)
: MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
- MDNodeKeyImpl(const GenericDebugNode *N)
+ MDNodeKeyImpl(const GenericDINode *N)
: MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {}
- bool isKeyOf(const GenericDebugNode *RHS) const {
+ bool isKeyOf(const GenericDINode *RHS) const {
return Tag == RHS->getTag() && Header == RHS->getHeader() &&
compareOps(RHS, 1);
}
unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
- static unsigned calculateHash(GenericDebugNode *N) {
+ static unsigned calculateHash(GenericDINode *N) {
return MDNodeOpsKey::calculateHash(N, 1);
}
};
-template <> struct MDNodeKeyImpl<MDSubrange> {
+template <> struct MDNodeKeyImpl<DISubrange> {
int64_t Count;
int64_t LowerBound;
MDNodeKeyImpl(int64_t Count, int64_t LowerBound)
: Count(Count), LowerBound(LowerBound) {}
- MDNodeKeyImpl(const MDSubrange *N)
+ MDNodeKeyImpl(const DISubrange *N)
: Count(N->getCount()), LowerBound(N->getLowerBound()) {}
- bool isKeyOf(const MDSubrange *RHS) const {
+ bool isKeyOf(const DISubrange *RHS) const {
return Count == RHS->getCount() && LowerBound == RHS->getLowerBound();
}
unsigned getHashValue() const { return hash_combine(Count, LowerBound); }
};
-template <> struct MDNodeKeyImpl<MDEnumerator> {
+template <> struct MDNodeKeyImpl<DIEnumerator> {
int64_t Value;
StringRef Name;
MDNodeKeyImpl(int64_t Value, StringRef Name) : Value(Value), Name(Name) {}
- MDNodeKeyImpl(const MDEnumerator *N)
+ MDNodeKeyImpl(const DIEnumerator *N)
: Value(N->getValue()), Name(N->getName()) {}
- bool isKeyOf(const MDEnumerator *RHS) const {
+ bool isKeyOf(const DIEnumerator *RHS) const {
return Value == RHS->getValue() && Name == RHS->getName();
}
unsigned getHashValue() const { return hash_combine(Value, Name); }
};
-template <> struct MDNodeKeyImpl<MDBasicType> {
+template <> struct MDNodeKeyImpl<DIBasicType> {
unsigned Tag;
StringRef Name;
uint64_t SizeInBits;
@@ -313,11 +313,11 @@ template <> struct MDNodeKeyImpl<MDBasicType> {
uint64_t AlignInBits, unsigned Encoding)
: Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
Encoding(Encoding) {}
- MDNodeKeyImpl(const MDBasicType *N)
+ MDNodeKeyImpl(const DIBasicType *N)
: Tag(N->getTag()), Name(N->getName()), SizeInBits(N->getSizeInBits()),
AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {}
- bool isKeyOf(const MDBasicType *RHS) const {
+ bool isKeyOf(const DIBasicType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
SizeInBits == RHS->getSizeInBits() &&
AlignInBits == RHS->getAlignInBits() &&
@@ -328,7 +328,7 @@ template <> struct MDNodeKeyImpl<MDBasicType> {
}
};
-template <> struct MDNodeKeyImpl<MDDerivedType> {
+template <> struct MDNodeKeyImpl<DIDerivedType> {
unsigned Tag;
StringRef Name;
Metadata *File;
@@ -348,14 +348,14 @@ template <> struct MDNodeKeyImpl<MDDerivedType> {
: Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
OffsetInBits(OffsetInBits), Flags(Flags), ExtraData(ExtraData) {}
- MDNodeKeyImpl(const MDDerivedType *N)
+ MDNodeKeyImpl(const DIDerivedType *N)
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
Line(N->getLine()), Scope(N->getRawScope()),
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {}
- bool isKeyOf(const MDDerivedType *RHS) const {
+ bool isKeyOf(const DIDerivedType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
@@ -370,7 +370,7 @@ template <> struct MDNodeKeyImpl<MDDerivedType> {
}
};
-template <> struct MDNodeKeyImpl<MDCompositeType> {
+template <> struct MDNodeKeyImpl<DICompositeType> {
unsigned Tag;
StringRef Name;
Metadata *File;
@@ -398,7 +398,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
OffsetInBits(OffsetInBits), Flags(Flags), Elements(Elements),
RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
TemplateParams(TemplateParams), Identifier(Identifier) {}
- MDNodeKeyImpl(const MDCompositeType *N)
+ MDNodeKeyImpl(const DICompositeType *N)
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
Line(N->getLine()), Scope(N->getRawScope()),
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
@@ -408,7 +408,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
TemplateParams(N->getRawTemplateParams()),
Identifier(N->getIdentifier()) {}
- bool isKeyOf(const MDCompositeType *RHS) const {
+ bool isKeyOf(const DICompositeType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
@@ -428,37 +428,37 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
}
};
-template <> struct MDNodeKeyImpl<MDSubroutineType> {
+template <> struct MDNodeKeyImpl<DISubroutineType> {
unsigned Flags;
Metadata *TypeArray;
MDNodeKeyImpl(int64_t Flags, Metadata *TypeArray)
: Flags(Flags), TypeArray(TypeArray) {}
- MDNodeKeyImpl(const MDSubroutineType *N)
+ MDNodeKeyImpl(const DISubroutineType *N)
: Flags(N->getFlags()), TypeArray(N->getRawTypeArray()) {}
- bool isKeyOf(const MDSubroutineType *RHS) const {
+ bool isKeyOf(const DISubroutineType *RHS) const {
return Flags == RHS->getFlags() && TypeArray == RHS->getRawTypeArray();
}
unsigned getHashValue() const { return hash_combine(Flags, TypeArray); }
};
-template <> struct MDNodeKeyImpl<MDFile> {
+template <> struct MDNodeKeyImpl<DIFile> {
StringRef Filename;
StringRef Directory;
MDNodeKeyImpl(StringRef Filename, StringRef Directory)
: Filename(Filename), Directory(Directory) {}
- MDNodeKeyImpl(const MDFile *N)
+ MDNodeKeyImpl(const DIFile *N)
: Filename(N->getFilename()), Directory(N->getDirectory()) {}
- bool isKeyOf(const MDFile *RHS) const {
+ bool isKeyOf(const DIFile *RHS) const {
return Filename == RHS->getFilename() && Directory == RHS->getDirectory();
}
unsigned getHashValue() const { return hash_combine(Filename, Directory); }
};
-template <> struct MDNodeKeyImpl<MDCompileUnit> {
+template <> struct MDNodeKeyImpl<DICompileUnit> {
unsigned SourceLanguage;
Metadata *File;
StringRef Producer;
@@ -485,7 +485,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
EnumTypes(EnumTypes), RetainedTypes(RetainedTypes),
Subprograms(Subprograms), GlobalVariables(GlobalVariables),
ImportedEntities(ImportedEntities) {}
- MDNodeKeyImpl(const MDCompileUnit *N)
+ MDNodeKeyImpl(const DICompileUnit *N)
: SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()),
Producer(N->getProducer()), IsOptimized(N->isOptimized()),
Flags(N->getFlags()), RuntimeVersion(N->getRuntimeVersion()),
@@ -496,7 +496,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
GlobalVariables(N->getRawGlobalVariables()),
ImportedEntities(N->getRawImportedEntities()) {}
- bool isKeyOf(const MDCompileUnit *RHS) const {
+ bool isKeyOf(const DICompileUnit *RHS) const {
return SourceLanguage == RHS->getSourceLanguage() &&
File == RHS->getRawFile() && Producer == RHS->getProducer() &&
IsOptimized == RHS->isOptimized() && Flags == RHS->getFlags() &&
@@ -517,7 +517,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
}
};
-template <> struct MDNodeKeyImpl<MDSubprogram> {
+template <> struct MDNodeKeyImpl<DISubprogram> {
Metadata *Scope;
StringRef Name;
StringRef LinkageName;
@@ -551,7 +551,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
VirtualIndex(VirtualIndex), Flags(Flags), IsOptimized(IsOptimized),
Function(Function), TemplateParams(TemplateParams),
Declaration(Declaration), Variables(Variables) {}
- MDNodeKeyImpl(const MDSubprogram *N)
+ MDNodeKeyImpl(const DISubprogram *N)
: Scope(N->getRawScope()), Name(N->getName()),
LinkageName(N->getLinkageName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()),
@@ -563,7 +563,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
TemplateParams(N->getRawTemplateParams()),
Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {}
- bool isKeyOf(const MDSubprogram *RHS) const {
+ bool isKeyOf(const DISubprogram *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
@@ -587,7 +587,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
}
};
-template <> struct MDNodeKeyImpl<MDLexicalBlock> {
+template <> struct MDNodeKeyImpl<DILexicalBlock> {
Metadata *Scope;
Metadata *File;
unsigned Line;
@@ -595,11 +595,11 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> {
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
: Scope(Scope), File(File), Line(Line), Column(Column) {}
- MDNodeKeyImpl(const MDLexicalBlock *N)
+ MDNodeKeyImpl(const DILexicalBlock *N)
: Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
Column(N->getColumn()) {}
- bool isKeyOf(const MDLexicalBlock *RHS) const {
+ bool isKeyOf(const DILexicalBlock *RHS) const {
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Column == RHS->getColumn();
}
@@ -608,18 +608,18 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> {
}
};
-template <> struct MDNodeKeyImpl<MDLexicalBlockFile> {
+template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
Metadata *Scope;
Metadata *File;
unsigned Discriminator;
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
: Scope(Scope), File(File), Discriminator(Discriminator) {}
- MDNodeKeyImpl(const MDLexicalBlockFile *N)
+ MDNodeKeyImpl(const DILexicalBlockFile *N)
: Scope(N->getRawScope()), File(N->getRawFile()),
Discriminator(N->getDiscriminator()) {}
- bool isKeyOf(const MDLexicalBlockFile *RHS) const {
+ bool isKeyOf(const DILexicalBlockFile *RHS) const {
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Discriminator == RHS->getDiscriminator();
}
@@ -628,7 +628,7 @@ template <> struct MDNodeKeyImpl<MDLexicalBlockFile> {
}
};
-template <> struct MDNodeKeyImpl<MDNamespace> {
+template <> struct MDNodeKeyImpl<DINamespace> {
Metadata *Scope;
Metadata *File;
StringRef Name;
@@ -636,11 +636,11 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line)
: Scope(Scope), File(File), Name(Name), Line(Line) {}
- MDNodeKeyImpl(const MDNamespace *N)
+ MDNodeKeyImpl(const DINamespace *N)
: Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()),
Line(N->getLine()) {}
- bool isKeyOf(const MDNamespace *RHS) const {
+ bool isKeyOf(const DINamespace *RHS) const {
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Name == RHS->getName() && Line == RHS->getLine();
}
@@ -649,21 +649,21 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
}
};
-template <> struct MDNodeKeyImpl<MDTemplateTypeParameter> {
+template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
StringRef Name;
Metadata *Type;
MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {}
- MDNodeKeyImpl(const MDTemplateTypeParameter *N)
+ MDNodeKeyImpl(const DITemplateTypeParameter *N)
: Name(N->getName()), Type(N->getRawType()) {}
- bool isKeyOf(const MDTemplateTypeParameter *RHS) const {
+ bool isKeyOf(const DITemplateTypeParameter *RHS) const {
return Name == RHS->getName() && Type == RHS->getRawType();
}
unsigned getHashValue() const { return hash_combine(Name, Type); }
};
-template <> struct MDNodeKeyImpl<MDTemplateValueParameter> {
+template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
unsigned Tag;
StringRef Name;
Metadata *Type;
@@ -671,18 +671,18 @@ template <> struct MDNodeKeyImpl<MDTemplateValueParameter> {
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value)
: Tag(Tag), Name(Name), Type(Type), Value(Value) {}
- MDNodeKeyImpl(const MDTemplateValueParameter *N)
+ MDNodeKeyImpl(const DITemplateValueParameter *N)
: Tag(N->getTag()), Name(N->getName()), Type(N->getRawType()),
Value(N->getValue()) {}
- bool isKeyOf(const MDTemplateValueParameter *RHS) const {
+ bool isKeyOf(const DITemplateValueParameter *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
Type == RHS->getRawType() && Value == RHS->getValue();
}
unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
};
-template <> struct MDNodeKeyImpl<MDGlobalVariable> {
+template <> struct MDNodeKeyImpl<DIGlobalVariable> {
Metadata *Scope;
StringRef Name;
StringRef LinkageName;
@@ -702,7 +702,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
IsDefinition(IsDefinition), Variable(Variable),
StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
- MDNodeKeyImpl(const MDGlobalVariable *N)
+ MDNodeKeyImpl(const DIGlobalVariable *N)
: Scope(N->getRawScope()), Name(N->getName()),
LinkageName(N->getLinkageName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()),
@@ -710,7 +710,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
Variable(N->getRawVariable()),
StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
- bool isKeyOf(const MDGlobalVariable *RHS) const {
+ bool isKeyOf(const DIGlobalVariable *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
@@ -727,7 +727,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
}
};
-template <> struct MDNodeKeyImpl<MDLocalVariable> {
+template <> struct MDNodeKeyImpl<DILocalVariable> {
unsigned Tag;
Metadata *Scope;
StringRef Name;
@@ -741,12 +741,12 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags)
: Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
Arg(Arg), Flags(Flags) {}
- MDNodeKeyImpl(const MDLocalVariable *N)
+ MDNodeKeyImpl(const DILocalVariable *N)
: Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
Arg(N->getArg()), Flags(N->getFlags()) {}
- bool isKeyOf(const MDLocalVariable *RHS) const {
+ bool isKeyOf(const DILocalVariable *RHS) const {
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
Name == RHS->getName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
@@ -757,13 +757,13 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
}
};
-template <> struct MDNodeKeyImpl<MDExpression> {
+template <> struct MDNodeKeyImpl<DIExpression> {
ArrayRef<uint64_t> Elements;
MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
- MDNodeKeyImpl(const MDExpression *N) : Elements(N->getElements()) {}
+ MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
- bool isKeyOf(const MDExpression *RHS) const {
+ bool isKeyOf(const DIExpression *RHS) const {
return Elements == RHS->getElements();
}
unsigned getHashValue() const {
@@ -771,7 +771,7 @@ template <> struct MDNodeKeyImpl<MDExpression> {
}
};
-template <> struct MDNodeKeyImpl<MDObjCProperty> {
+template <> struct MDNodeKeyImpl<DIObjCProperty> {
StringRef Name;
Metadata *File;
unsigned Line;
@@ -785,12 +785,12 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> {
Metadata *Type)
: Name(Name), File(File), Line(Line), GetterName(GetterName),
SetterName(SetterName), Attributes(Attributes), Type(Type) {}
- MDNodeKeyImpl(const MDObjCProperty *N)
+ MDNodeKeyImpl(const DIObjCProperty *N)
: Name(N->getName()), File(N->getRawFile()), Line(N->getLine()),
GetterName(N->getGetterName()), SetterName(N->getSetterName()),
Attributes(N->getAttributes()), Type(N->getRawType()) {}
- bool isKeyOf(const MDObjCProperty *RHS) const {
+ bool isKeyOf(const DIObjCProperty *RHS) const {
return Name == RHS->getName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && GetterName == RHS->getGetterName() &&
SetterName == RHS->getSetterName() &&
@@ -802,7 +802,7 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> {
}
};
-template <> struct MDNodeKeyImpl<MDImportedEntity> {
+template <> struct MDNodeKeyImpl<DIImportedEntity> {
unsigned Tag;
Metadata *Scope;
Metadata *Entity;
@@ -812,11 +812,11 @@ template <> struct MDNodeKeyImpl<MDImportedEntity> {
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line,
StringRef Name)
: Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
- MDNodeKeyImpl(const MDImportedEntity *N)
+ MDNodeKeyImpl(const DIImportedEntity *N)
: Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
Line(N->getLine()), Name(N->getName()) {}
- bool isKeyOf(const MDImportedEntity *RHS) const {
+ bool isKeyOf(const DIImportedEntity *RHS) const {
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
Name == RHS->getName();
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index afce3e2bf56..3ccc48e3ffd 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -305,11 +305,11 @@ private:
template <class Ty> bool isValidMetadataArray(const MDTuple &N);
#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void visit##CLASS(const CLASS &N);
#include "llvm/IR/Metadata.def"
- void visitMDScope(const MDScope &N);
- void visitMDDerivedTypeBase(const MDDerivedTypeBase &N);
- void visitMDVariable(const MDVariable &N);
- void visitMDLexicalBlockBase(const MDLexicalBlockBase &N);
- void visitMDTemplateParameter(const MDTemplateParameter &N);
+ void visitDIScope(const DIScope &N);
+ void visitDIDerivedTypeBase(const DIDerivedTypeBase &N);
+ void visitDIVariable(const DIVariable &N);
+ void visitDILexicalBlockBase(const DILexicalBlockBase &N);
+ void visitDITemplateParameter(const DITemplateParameter &N);
void visitTemplateParams(const MDNode &N, const Metadata &RawParams);
@@ -321,17 +321,17 @@ private:
/// \brief Check for a valid type reference.
///
- /// Checks for subclasses of \a MDType, or \a isValidUUID().
+ /// Checks for subclasses of \a DIType, or \a isValidUUID().
bool isTypeRef(const MDNode &N, const Metadata *MD);
/// \brief Check for a valid scope reference.
///
- /// Checks for subclasses of \a MDScope, or \a isValidUUID().
+ /// Checks for subclasses of \a DIScope, or \a isValidUUID().
bool isScopeRef(const MDNode &N, const Metadata *MD);
/// \brief Check for a valid debug info reference.
///
- /// Checks for subclasses of \a DebugNode, or \a isValidUUID().
+ /// Checks for subclasses of \a DINode, or \a isValidUUID().
bool isDIRef(const MDNode &N, const Metadata *MD);
// InstVisitor overrides...
@@ -605,7 +605,7 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
MDNode *MD = NMD.getOperand(i);
if (NMD.getName() == "llvm.dbg.cu") {
- Assert(MD && isa<MDCompileUnit>(MD), "invalid compile unit", &NMD, MD);
+ Assert(MD && isa<DICompileUnit>(MD), "invalid compile unit", &NMD, MD);
}
if (!MD)
@@ -711,17 +711,17 @@ bool Verifier::isValidUUID(const MDNode &N, const Metadata *MD) {
/// \brief Check if a value can be a reference to a type.
bool Verifier::isTypeRef(const MDNode &N, const Metadata *MD) {
- return !MD || isValidUUID(N, MD) || isa<MDType>(MD);
+ return !MD || isValidUUID(N, MD) || isa<DIType>(MD);
}
/// \brief Check if a value can be a ScopeRef.
bool Verifier::isScopeRef(const MDNode &N, const Metadata *MD) {
- return !MD || isValidUUID(N, MD) || isa<MDScope>(MD);
+ return !MD || isValidUUID(N, MD) || isa<DIScope>(MD);
}
/// \brief Check if a value can be a debug info ref.
bool Verifier::isDIRef(const MDNode &N, const Metadata *MD) {
- return !MD || isValidUUID(N, MD) || isa<DebugNode>(MD);
+ return !MD || isValidUUID(N, MD) || isa<DINode>(MD);
}
template <class Ty>
@@ -748,40 +748,40 @@ bool isValidMetadataNullArray(const MDTuple &N) {
return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ true);
}
-void Verifier::visitMDLocation(const MDLocation &N) {
- Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
+void Verifier::visitDILocation(const DILocation &N) {
+ Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
"location requires a valid scope", &N, N.getRawScope());
if (auto *IA = N.getRawInlinedAt())
- Assert(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA);
+ Assert(isa<DILocation>(IA), "inlined-at should be a location", &N, IA);
}
-void Verifier::visitGenericDebugNode(const GenericDebugNode &N) {
+void Verifier::visitGenericDINode(const GenericDINode &N) {
Assert(N.getTag(), "invalid tag", &N);
}
-void Verifier::visitMDScope(const MDScope &N) {
+void Verifier::visitDIScope(const DIScope &N) {
if (auto *F = N.getRawFile())
- Assert(isa<MDFile>(F), "invalid file", &N, F);
+ Assert(isa<DIFile>(F), "invalid file", &N, F);
}
-void Verifier::visitMDSubrange(const MDSubrange &N) {
+void Verifier::visitDISubrange(const DISubrange &N) {
Assert(N.getTag() == dwarf::DW_TAG_subrange_type, "invalid tag", &N);
Assert(N.getCount() >= -1, "invalid subrange count", &N);
}
-void Verifier::visitMDEnumerator(const MDEnumerator &N) {
+void Verifier::visitDIEnumerator(const DIEnumerator &N) {
Assert(N.getTag() == dwarf::DW_TAG_enumerator, "invalid tag", &N);
}
-void Verifier::visitMDBasicType(const MDBasicType &N) {
+void Verifier::visitDIBasicType(const DIBasicType &N) {
Assert(N.getTag() == dwarf::DW_TAG_base_type ||
N.getTag() == dwarf::DW_TAG_unspecified_type,
"invalid tag", &N);
}
-void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) {
+void Verifier::visitDIDerivedTypeBase(const DIDerivedTypeBase &N) {
// Common scope checks.
- visitMDScope(N);
+ visitDIScope(N);
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
@@ -808,9 +808,9 @@ void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) {
}
}
-void Verifier::visitMDDerivedType(const MDDerivedType &N) {
+void Verifier::visitDIDerivedType(const DIDerivedType &N) {
// Common derived type checks.
- visitMDDerivedTypeBase(N);
+ visitDIDerivedTypeBase(N);
Assert(N.getTag() == dwarf::DW_TAG_typedef ||
N.getTag() == dwarf::DW_TAG_pointer_type ||
@@ -831,22 +831,22 @@ void Verifier::visitMDDerivedType(const MDDerivedType &N) {
}
static bool hasConflictingReferenceFlags(unsigned Flags) {
- return (Flags & DebugNode::FlagLValueReference) &&
- (Flags & DebugNode::FlagRValueReference);
+ return (Flags & DINode::FlagLValueReference) &&
+ (Flags & DINode::FlagRValueReference);
}
void Verifier::visitTemplateParams(const MDNode &N, const Metadata &RawParams) {
auto *Params = dyn_cast<MDTuple>(&RawParams);
Assert(Params, "invalid template params", &N, &RawParams);
for (Metadata *Op : Params->operands()) {
- Assert(Op && isa<MDTemplateParameter>(Op), "invalid template parameter", &N,
+ Assert(Op && isa<DITemplateParameter>(Op), "invalid template parameter", &N,
Params, Op);
}
}
-void Verifier::visitMDCompositeType(const MDCompositeType &N) {
+void Verifier::visitDICompositeType(const DICompositeType &N) {
// Common derived type checks.
- visitMDDerivedTypeBase(N);
+ visitDIDerivedTypeBase(N);
Assert(N.getTag() == dwarf::DW_TAG_array_type ||
N.getTag() == dwarf::DW_TAG_structure_type ||
@@ -868,7 +868,7 @@ void Verifier::visitMDCompositeType(const MDCompositeType &N) {
visitTemplateParams(N, *Params);
}
-void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
+void Verifier::visitDISubroutineType(const DISubroutineType &N) {
Assert(N.getTag() == dwarf::DW_TAG_subroutine_type, "invalid tag", &N);
if (auto *Types = N.getRawTypeArray()) {
Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types);
@@ -880,24 +880,24 @@ void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
&N);
}
-void Verifier::visitMDFile(const MDFile &N) {
+void Verifier::visitDIFile(const DIFile &N) {
Assert(N.getTag() == dwarf::DW_TAG_file_type, "invalid tag", &N);
}
-void Verifier::visitMDCompileUnit(const MDCompileUnit &N) {
+void Verifier::visitDICompileUnit(const DICompileUnit &N) {
Assert(N.getTag() == dwarf::DW_TAG_compile_unit, "invalid tag", &N);
// Don't bother verifying the compilation directory or producer string
// as those could be empty.
- Assert(N.getRawFile() && isa<MDFile>(N.getRawFile()),
- "invalid file", &N, N.getRawFile());
+ Assert(N.getRawFile() && isa<DIFile>(N.getRawFile()), "invalid file", &N,
+ N.getRawFile());
Assert(!N.getFile()->getFilename().empty(), "invalid filename", &N,
N.getFile());
if (auto *Array = N.getRawEnumTypes()) {
Assert(isa<MDTuple>(Array), "invalid enum list", &N, Array);
for (Metadata *Op : N.getEnumTypes()->operands()) {
- auto *Enum = dyn_cast_or_null<MDCompositeType>(Op);
+ auto *Enum = dyn_cast_or_null<DICompositeType>(Op);
Assert(Enum && Enum->getTag() == dwarf::DW_TAG_enumeration_type,
"invalid enum type", &N, N.getEnumTypes(), Op);
}
@@ -905,36 +905,36 @@ void Verifier::visitMDCompileUnit(const MDCompileUnit &N) {
if (auto *Array = N.getRawRetainedTypes()) {
Assert(isa<MDTuple>(Array), "invalid retained type list", &N, Array);
for (Metadata *Op : N.getRetainedTypes()->operands()) {
- Assert(Op && isa<MDType>(Op), "invalid retained type", &N, Op);
+ Assert(Op && isa<DIType>(Op), "invalid retained type", &N, Op);
}
}
if (auto *Array = N.getRawSubprograms()) {
Assert(isa<MDTuple>(Array), "invalid subprogram list", &N, Array);
for (Metadata *Op : N.getSubprograms()->operands()) {
- Assert(Op && isa<MDSubprogram>(Op), "invalid subprogram ref", &N, Op);
+ Assert(Op && isa<DISubprogram>(Op), "invalid subprogram ref", &N, Op);
}
}
if (auto *Array = N.getRawGlobalVariables()) {
Assert(isa<MDTuple>(Array), "invalid global variable list", &N, Array);
for (Metadata *Op : N.getGlobalVariables()->operands()) {
- Assert(Op && isa<MDGlobalVariable>(Op), "invalid global variable ref", &N,
+ Assert(Op && isa<DIGlobalVariable>(Op), "invalid global variable ref", &N,
Op);
}
}
if (auto *Array = N.getRawImportedEntities()) {
Assert(isa<MDTuple>(Array), "invalid imported entity list", &N, Array);
for (Metadata *Op : N.getImportedEntities()->operands()) {
- Assert(Op && isa<MDImportedEntity>(Op), "invalid imported entity ref", &N,
+ Assert(Op && isa<DIImportedEntity>(Op), "invalid imported entity ref", &N,
Op);
}
}
}
-void Verifier::visitMDSubprogram(const MDSubprogram &N) {
+void Verifier::visitDISubprogram(const DISubprogram &N) {
Assert(N.getTag() == dwarf::DW_TAG_subprogram, "invalid tag", &N);
Assert(isScopeRef(N, N.getRawScope()), "invalid scope", &N, N.getRawScope());
if (auto *T = N.getRawType())
- Assert(isa<MDSubroutineType>(T), "invalid subroutine type", &N, T);
+ Assert(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
Assert(isTypeRef(N, N.getRawContainingType()), "invalid containing type", &N,
N.getRawContainingType());
if (auto *RawF = N.getRawFunction()) {
@@ -947,14 +947,14 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
if (auto *Params = N.getRawTemplateParams())
visitTemplateParams(N, *Params);
if (auto *S = N.getRawDeclaration()) {
- Assert(isa<MDSubprogram>(S) && !cast<MDSubprogram>(S)->isDefinition(),
+ Assert(isa<DISubprogram>(S) && !cast<DISubprogram>(S)->isDefinition(),
"invalid subprogram declaration", &N, S);
}
if (auto *RawVars = N.getRawVariables()) {
auto *Vars = dyn_cast<MDTuple>(RawVars);
Assert(Vars, "invalid variable list", &N, RawVars);
for (Metadata *Op : Vars->operands()) {
- Assert(Op && isa<MDLocalVariable>(Op), "invalid local variable", &N, Vars,
+ Assert(Op && isa<DILocalVariable>(Op), "invalid local variable", &N, Vars,
Op);
}
}
@@ -973,20 +973,20 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
SmallPtrSet<const MDNode *, 32> Seen;
for (auto &BB : *F)
for (auto &I : BB) {
- // Be careful about using MDLocation here since we might be dealing with
+ // Be careful about using DILocation here since we might be dealing with
// broken code (this is the Verifier after all).
- MDLocation *DL =
- dyn_cast_or_null<MDLocation>(I.getDebugLoc().getAsMDNode());
+ DILocation *DL =
+ dyn_cast_or_null<DILocation>(I.getDebugLoc().getAsMDNode());
if (!DL)
continue;
if (!Seen.insert(DL).second)
continue;
- MDLocalScope *Scope = DL->getInlinedAtScope();
+ DILocalScope *Scope = DL->getInlinedAtScope();
if (Scope && !Seen.insert(Scope).second)
continue;
- MDSubprogram *SP = Scope ? Scope->getSubprogram() : nullptr;
+ DISubprogram *SP = Scope ? Scope->getSubprogram() : nullptr;
if (SP && !Seen.insert(SP).second)
continue;
@@ -997,43 +997,43 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
}
}
-void Verifier::visitMDLexicalBlockBase(const MDLexicalBlockBase &N) {
+void Verifier::visitDILexicalBlockBase(const DILexicalBlockBase &N) {
Assert(N.getTag() == dwarf::DW_TAG_lexical_block, "invalid tag", &N);
- Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
+ Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
"invalid local scope", &N, N.getRawScope());
}
-void Verifier::visitMDLexicalBlock(const MDLexicalBlock &N) {
- visitMDLexicalBlockBase(N);
+void Verifier::visitDILexicalBlock(const DILexicalBlock &N) {
+ visitDILexicalBlockBase(N);
Assert(N.getLine() || !N.getColumn(),
"cannot have column info without line info", &N);
}
-void Verifier::visitMDLexicalBlockFile(const MDLexicalBlockFile &N) {
- visitMDLexicalBlockBase(N);
+void Verifier::visitDILexicalBlockFile(const DILexicalBlockFile &N) {
+ visitDILexicalBlockBase(N);
}
-void Verifier::visitMDNamespace(const MDNamespace &N) {
+void Verifier::visitDINamespace(const DINamespace &N) {
Assert(N.getTag() == dwarf::DW_TAG_namespace, "invalid tag", &N);
if (auto *S = N.getRawScope())
- Assert(isa<MDScope>(S), "invalid scope ref", &N, S);
+ Assert(isa<DIScope>(S), "invalid scope ref", &N, S);
}
-void Verifier::visitMDTemplateParameter(const MDTemplateParameter &N) {
+void Verifier::visitDITemplateParameter(const DITemplateParameter &N) {
Assert(isTypeRef(N, N.getType()), "invalid type ref", &N, N.getType());
}
-void Verifier::visitMDTemplateTypeParameter(const MDTemplateTypeParameter &N) {
- visitMDTemplateParameter(N);
+void Verifier::visitDITemplateTypeParameter(const DITemplateTypeParameter &N) {
+ visitDITemplateParameter(N);
Assert(N.getTag() == dwarf::DW_TAG_template_type_parameter, "invalid tag",
&N);
}
-void Verifier::visitMDTemplateValueParameter(
- const MDTemplateValueParameter &N) {
- visitMDTemplateParameter(N);
+void Verifier::visitDITemplateValueParameter(
+ const DITemplateValueParameter &N) {
+ visitDITemplateParameter(N);
Assert(N.getTag() == dwarf::DW_TAG_template_value_parameter ||
N.getTag() == dwarf::DW_TAG_GNU_template_template_param ||
@@ -1041,17 +1041,17 @@ void Verifier::visitMDTemplateValueParameter(
"invalid tag", &N);
}
-void Verifier::visitMDVariable(const MDVariable &N) {
+void Verifier::visitDIVariable(const DIVariable &N) {
if (auto *S = N.getRawScope())
- Assert(isa<MDScope>(S), "invalid scope", &N, S);
+ Assert(isa<DIScope>(S), "invalid scope", &N, S);
Assert(isTypeRef(N, N.getRawType()), "invalid type ref", &N, N.getRawType());
if (auto *F = N.getRawFile())
- Assert(isa<MDFile>(F), "invalid file", &N, F);
+ Assert(isa<DIFile>(F), "invalid file", &N, F);
}
-void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) {
+void Verifier::visitDIGlobalVariable(const DIGlobalVariable &N) {
// Checks common to all variables.
- visitMDVariable(N);
+ visitDIVariable(N);
Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
Assert(!N.getName().empty(), "missing global variable name", &N);
@@ -1061,40 +1061,40 @@ void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) {
"invalid global varaible ref", &N, V);
}
if (auto *Member = N.getRawStaticDataMemberDeclaration()) {
- Assert(isa<MDDerivedType>(Member), "invalid static data member declaration",
+ Assert(isa<DIDerivedType>(Member), "invalid static data member declaration",
&N, Member);
}
}
-void Verifier::visitMDLocalVariable(const MDLocalVariable &N) {
+void Verifier::visitDILocalVariable(const DILocalVariable &N) {
// Checks common to all variables.
- visitMDVariable(N);
+ visitDIVariable(N);
Assert(N.getTag() == dwarf::DW_TAG_auto_variable ||
N.getTag() == dwarf::DW_TAG_arg_variable,
"invalid tag", &N);
- Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
+ Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
"local variable requires a valid scope", &N, N.getRawScope());
}
-void Verifier::visitMDExpression(const MDExpression &N) {
+void Verifier::visitDIExpression(const DIExpression &N) {
Assert(N.isValid(), "invalid expression", &N);
}
-void Verifier::visitMDObjCProperty(const MDObjCProperty &N) {
+void Verifier::visitDIObjCProperty(const DIObjCProperty &N) {
Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
if (auto *T = N.getRawType())
- Assert(isa<MDType>(T), "invalid type ref", &N, T);
+ Assert(isa<DIType>(T), "invalid type ref", &N, T);
if (auto *F = N.getRawFile())
- Assert(isa<MDFile>(F), "invalid file", &N, F);
+ Assert(isa<DIFile>(F), "invalid file", &N, F);
}
-void Verifier::visitMDImportedEntity(const MDImportedEntity &N) {
+void Verifier::visitDIImportedEntity(const DIImportedEntity &N) {
Assert(N.getTag() == dwarf::DW_TAG_imported_module ||
N.getTag() == dwarf::DW_TAG_imported_declaration,
"invalid tag", &N);
if (auto *S = N.getRawScope())
- Assert(isa<MDScope>(S), "invalid scope for imported entity", &N, S);
+ Assert(isa<DIScope>(S), "invalid scope for imported entity", &N, S);
Assert(isDIRef(N, N.getEntity()), "invalid imported entity", &N,
N.getEntity());
}
@@ -2904,7 +2904,7 @@ void Verifier::visitInstruction(Instruction &I) {
}
if (MDNode *N = I.getDebugLoc().getAsMDNode()) {
- Assert(isa<MDLocation>(N), "invalid !dbg metadata attachment", &I, N);
+ Assert(isa<DILocation>(N), "invalid !dbg metadata attachment", &I, N);
visitMDNode(*N);
}
@@ -3373,18 +3373,18 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
///
/// This carefully grabs the subprogram from a local scope, avoiding the
/// built-in assertions that would typically fire.
-static MDSubprogram *getSubprogram(Metadata *LocalScope) {
+static DISubprogram *getSubprogram(Metadata *LocalScope) {
if (!LocalScope)
return nullptr;
- if (auto *SP = dyn_cast<MDSubprogram>(LocalScope))
+ if (auto *SP = dyn_cast<DISubprogram>(LocalScope))
return SP;
- if (auto *LB = dyn_cast<MDLexicalBlockBase>(LocalScope))
+ if (auto *LB = dyn_cast<DILexicalBlockBase>(LocalScope))
return getSubprogram(LB->getRawScope());
// Just return null; broken scope chains are checked elsewhere.
- assert(!isa<MDLocalScope>(LocalScope) && "Unknown type of local scope");
+ assert(!isa<DILocalScope>(LocalScope) && "Unknown type of local scope");
return nullptr;
}
@@ -3394,29 +3394,29 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
Assert(isa<ValueAsMetadata>(MD) ||
(isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands()),
"invalid llvm.dbg." + Kind + " intrinsic address/value", &DII, MD);
- Assert(isa<MDLocalVariable>(DII.getRawVariable()),
+ Assert(isa<DILocalVariable>(DII.getRawVariable()),
"invalid llvm.dbg." + Kind + " intrinsic variable", &DII,
DII.getRawVariable());
- Assert(isa<MDExpression>(DII.getRawExpression()),
+ Assert(isa<DIExpression>(DII.getRawExpression()),
"invalid llvm.dbg." + Kind + " intrinsic expression", &DII,
DII.getRawExpression());
// Ignore broken !dbg attachments; they're checked elsewhere.
if (MDNode *N = DII.getDebugLoc().getAsMDNode())
- if (!isa<MDLocation>(N))
+ if (!isa<DILocation>(N))
return;
BasicBlock *BB = DII.getParent();
Function *F = BB ? BB->getParent() : nullptr;
// The scopes for variables and !dbg attachments must agree.
- MDLocalVariable *Var = DII.getVariable();
- MDLocation *Loc = DII.getDebugLoc();
+ DILocalVariable *Var = DII.getVariable();
+ DILocation *Loc = DII.getDebugLoc();
Assert(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment",
&DII, BB, F);
- MDSubprogram *VarSP = getSubprogram(Var->getRawScope());
- MDSubprogram *LocSP = getSubprogram(Loc->getRawScope());
+ DISubprogram *VarSP = getSubprogram(Var->getRawScope());
+ DISubprogram *LocSP = getSubprogram(Loc->getRawScope());
if (!VarSP || !LocSP)
return; // Broken scope chains are checked elsewhere.
@@ -3427,16 +3427,16 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
}
template <class MapTy>
-static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) {
+static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) {
// Be careful of broken types (checked elsewhere).
const Metadata *RawType = V.getRawType();
while (RawType) {
// Try to get the size directly.
- if (auto *T = dyn_cast<MDType>(RawType))
+ if (auto *T = dyn_cast<DIType>(RawType))
if (uint64_t Size = T->getSizeInBits())
return Size;
- if (auto *DT = dyn_cast<MDDerivedType>(RawType)) {
+ if (auto *DT = dyn_cast<DIDerivedType>(RawType)) {
// Look at the base type.
RawType = DT->getRawBaseType();
continue;
@@ -3459,15 +3459,15 @@ static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) {
template <class MapTy>
void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
const MapTy &TypeRefs) {
- MDLocalVariable *V;
- MDExpression *E;
+ DILocalVariable *V;
+ DIExpression *E;
if (auto *DVI = dyn_cast<DbgValueInst>(&I)) {
- V = dyn_cast_or_null<MDLocalVariable>(DVI->getRawVariable());
- E = dyn_cast_or_null<MDExpression>(DVI->getRawExpression());
+ V = dyn_cast_or_null<DILocalVariable>(DVI->getRawVariable());
+ E = dyn_cast_or_null<DIExpression>(DVI->getRawExpression());
} else {
auto *DDI = cast<DbgDeclareInst>(&I);
- V = dyn_cast_or_null<MDLocalVariable>(DDI->getRawVariable());
- E = dyn_cast_or_null<MDExpression>(DDI->getRawExpression());
+ V = dyn_cast_or_null<DILocalVariable>(DDI->getRawVariable());
+ E = dyn_cast_or_null<DIExpression>(DDI->getRawExpression());
}
// We don't know whether this intrinsic verified correctly.
@@ -3503,11 +3503,11 @@ void Verifier::verifyTypeRefs() {
return;
// Visit all the compile units again to map the type references.
- SmallDenseMap<const MDString *, const MDType *, 32> TypeRefs;
+ SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
for (auto *CU : CUs->operands())
- if (auto Ts = cast<MDCompileUnit>(CU)->getRetainedTypes())
- for (MDType *Op : Ts)
- if (auto *T = dyn_cast<MDCompositeType>(Op))
+ if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
+ for (DIType *Op : Ts)
+ if (auto *T = dyn_cast<DICompositeType>(Op))
if (auto *S = T->getRawIdentifier()) {
UnresolvedTypeRefs.erase(S);
TypeRefs.insert(std::make_pair(S, T));
OpenPOWER on IntegriCloud