summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-29 16:40:08 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-29 16:40:08 +0000
commit9dd4e4e63a53813ba519281ec5c35e678b837d5d (patch)
tree9abf46c1f266ce303f8037a93dadb1bee9685258 /clang/lib/CodeGen
parenta9308c49ef421d5fa6c990bc8cbdf500acbffd33 (diff)
downloadbcm5719-llvm-9dd4e4e63a53813ba519281ec5c35e678b837d5d.tar.gz
bcm5719-llvm-9dd4e4e63a53813ba519281ec5c35e678b837d5d.zip
DebugInfo: Metadata constructs now start with DI*
LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now that the `DIDescriptor` hierarchy has been gone for about a week. This commit was generated using the rename-md-di-nodes.sh upgrade script attached to PR23080, followed by running clang-format-diff.py on the `lib/` portion of the patch. llvm-svn: 236121
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp579
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.h220
2 files changed, 399 insertions, 400 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index fd45f620dcd..cbb4f85c843 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -120,18 +120,18 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
return;
SourceManager &SM = CGM.getContext().getSourceManager();
- auto *Scope = cast<llvm::MDScope>(LexicalBlockStack.back());
+ auto *Scope = cast<llvm::DIScope>(LexicalBlockStack.back());
PresumedLoc PCLoc = SM.getPresumedLoc(CurLoc);
if (PCLoc.isInvalid() || Scope->getFilename() == PCLoc.getFilename())
return;
- if (auto *LBF = dyn_cast<llvm::MDLexicalBlockFile>(Scope)) {
+ if (auto *LBF = dyn_cast<llvm::DILexicalBlockFile>(Scope)) {
LexicalBlockStack.pop_back();
LexicalBlockStack.emplace_back(DBuilder.createLexicalBlockFile(
LBF->getScope(), getOrCreateFile(CurLoc)));
- } else if (isa<llvm::MDLexicalBlock>(Scope) ||
- isa<llvm::MDSubprogram>(Scope)) {
+ } else if (isa<llvm::DILexicalBlock>(Scope) ||
+ isa<llvm::DISubprogram>(Scope)) {
LexicalBlockStack.pop_back();
LexicalBlockStack.emplace_back(
DBuilder.createLexicalBlockFile(Scope, getOrCreateFile(CurLoc)));
@@ -139,14 +139,14 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
}
/// getContextDescriptor - Get context info for the decl.
-llvm::MDScope *CGDebugInfo::getContextDescriptor(const Decl *Context) {
+llvm::DIScope *CGDebugInfo::getContextDescriptor(const Decl *Context) {
if (!Context)
return TheCU;
auto I = RegionMap.find(Context);
if (I != RegionMap.end()) {
llvm::Metadata *V = I->second;
- return dyn_cast_or_null<llvm::MDScope>(V);
+ return dyn_cast_or_null<llvm::DIScope>(V);
}
// Check namespace.
@@ -243,7 +243,7 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) {
}
/// getOrCreateFile - Get the file debug info descriptor for the input location.
-llvm::MDFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
+llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
if (!Loc.isValid())
// If Location is not valid then use main input file.
return DBuilder.createFile(TheCU->getFilename(), TheCU->getDirectory());
@@ -262,10 +262,10 @@ llvm::MDFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
if (it != DIFileCache.end()) {
// Verify that the information still exists.
if (llvm::Metadata *V = it->second)
- return cast<llvm::MDFile>(V);
+ return cast<llvm::DIFile>(V);
}
- llvm::MDFile *F =
+ llvm::DIFile *F =
DBuilder.createFile(PLoc.getFilename(), getCurrentDirname());
DIFileCache[fname].reset(F);
@@ -273,7 +273,7 @@ llvm::MDFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
}
/// getOrCreateMainFile - Get the file info for main compile unit.
-llvm::MDFile *CGDebugInfo::getOrCreateMainFile() {
+llvm::DIFile *CGDebugInfo::getOrCreateMainFile() {
return DBuilder.createFile(TheCU->getFilename(), TheCU->getDirectory());
}
@@ -384,7 +384,7 @@ void CGDebugInfo::CreateCompileUnit() {
/// CreateType - Get the Basic type from the cache or create a new
/// one if necessary.
-llvm::MDType *CGDebugInfo::CreateType(const BuiltinType *BT) {
+llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
llvm::dwarf::TypeKind Encoding;
StringRef BTName;
switch (BT->getKind()) {
@@ -423,7 +423,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BuiltinType *BT) {
ObjTy =
DBuilder.createStructType(TheCU, "objc_object", getOrCreateMainFile(),
- 0, 0, 0, 0, nullptr, llvm::DebugNodeArray());
+ 0, 0, 0, 0, nullptr, llvm::DINodeArray());
DBuilder.replaceArrays(
ObjTy,
@@ -523,7 +523,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BuiltinType *BT) {
return DBuilder.createBasicType(BTName, Size, Align, Encoding);
}
-llvm::MDType *CGDebugInfo::CreateType(const ComplexType *Ty) {
+llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) {
// Bit size, align and offset of the type.
llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float;
if (Ty->isComplexIntegerType())
@@ -536,8 +536,8 @@ llvm::MDType *CGDebugInfo::CreateType(const ComplexType *Ty) {
/// CreateCVRType - Get the qualified type from the cache or create
/// a new one if necessary.
-llvm::MDType *CGDebugInfo::CreateQualifiedType(QualType Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateQualifiedType(QualType Ty,
+ llvm::DIFile *Unit) {
QualifierCollector Qc;
const Type *T = Qc.strip(Ty);
@@ -570,8 +570,8 @@ llvm::MDType *CGDebugInfo::CreateQualifiedType(QualType Ty,
return DBuilder.createQualifiedType(Tag, FromTy);
}
-llvm::MDType *CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty,
+ llvm::DIFile *Unit) {
// The frontend treats 'id' as a typedef to an ObjCObjectType,
// whereas 'id<protocol>' is treated as an ObjCPointerType. For the
@@ -583,8 +583,8 @@ llvm::MDType *CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty,
Ty->getPointeeType(), Unit);
}
-llvm::MDType *CGDebugInfo::CreateType(const PointerType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const PointerType *Ty,
+ llvm::DIFile *Unit) {
return CreatePointerLikeType(llvm::dwarf::DW_TAG_pointer_type, Ty,
Ty->getPointeeType(), Unit);
}
@@ -593,7 +593,7 @@ llvm::MDType *CGDebugInfo::CreateType(const PointerType *Ty,
/// on their mangled names, if they're external.
static SmallString<256> getUniqueTagTypeName(const TagType *Ty,
CodeGenModule &CGM,
- llvm::MDCompileUnit *TheCU) {
+ llvm::DICompileUnit *TheCU) {
SmallString<256> FullName;
// FIXME: ODR should apply to ObjC++ exactly the same wasy it does to C++.
// For now, only apply ODR with C++.
@@ -629,13 +629,13 @@ static llvm::dwarf::Tag getTagForRecord(const RecordDecl *RD) {
}
// Creates a forward declaration for a RecordDecl in the given context.
-llvm::MDCompositeType *
+llvm::DICompositeType *
CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty,
- llvm::MDScope *Ctx) {
+ llvm::DIScope *Ctx) {
const RecordDecl *RD = Ty->getDecl();
- if (llvm::MDType *T = getTypeOrNull(CGM.getContext().getRecordType(RD)))
- return cast<llvm::MDCompositeType>(T);
- llvm::MDFile *DefUnit = getOrCreateFile(RD->getLocation());
+ if (llvm::DIType *T = getTypeOrNull(CGM.getContext().getRecordType(RD)))
+ return cast<llvm::DICompositeType>(T);
+ llvm::DIFile *DefUnit = getOrCreateFile(RD->getLocation());
unsigned Line = getLineNumber(RD->getLocation());
StringRef RDName = getClassName(RD);
@@ -650,19 +650,19 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty,
// Create the type.
SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU);
- llvm::MDCompositeType *RetTy = DBuilder.createReplaceableCompositeType(
+ llvm::DICompositeType *RetTy = DBuilder.createReplaceableCompositeType(
getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,
- llvm::DebugNode::FlagFwdDecl, FullName);
+ llvm::DINode::FlagFwdDecl, FullName);
ReplaceMap.emplace_back(
std::piecewise_construct, std::make_tuple(Ty),
std::make_tuple(static_cast<llvm::Metadata *>(RetTy)));
return RetTy;
}
-llvm::MDType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
+llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
const Type *Ty,
QualType PointeeTy,
- llvm::MDFile *Unit) {
+ llvm::DIFile *Unit) {
if (Tag == llvm::dwarf::DW_TAG_reference_type ||
Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit));
@@ -678,8 +678,8 @@ llvm::MDType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
Align);
}
-llvm::MDType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,
- llvm::MDType *&Cache) {
+llvm::DIType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,
+ llvm::DIType *&Cache) {
if (Cache)
return Cache;
Cache = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, Name,
@@ -689,8 +689,8 @@ llvm::MDType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,
return Cache;
}
-llvm::MDType *CGDebugInfo::CreateType(const BlockPointerType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const BlockPointerType *Ty,
+ llvm::DIFile *Unit) {
if (BlockLiteralGeneric)
return BlockLiteralGeneric;
@@ -698,7 +698,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BlockPointerType *Ty,
QualType FType;
uint64_t FieldSize, FieldOffset;
unsigned FieldAlign;
- llvm::DebugNodeArray Elements;
+ llvm::DINodeArray Elements;
FieldOffset = 0;
FType = CGM.getContext().UnsignedLongTy;
@@ -708,7 +708,7 @@ llvm::MDType *CGDebugInfo::CreateType(const BlockPointerType *Ty,
Elements = DBuilder.getOrCreateArray(EltTys);
EltTys.clear();
- unsigned Flags = llvm::DebugNode::FlagAppleBlock;
+ unsigned Flags = llvm::DINode::FlagAppleBlock;
unsigned LineNo = getLineNumber(CurLoc);
auto *EltTy =
@@ -747,10 +747,10 @@ llvm::MDType *CGDebugInfo::CreateType(const BlockPointerType *Ty,
return BlockLiteralGeneric;
}
-llvm::MDType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty,
+ llvm::DIFile *Unit) {
assert(Ty->isTypeAlias());
- llvm::MDType *Src = getOrCreateType(Ty->getAliasedType(), Unit);
+ llvm::DIType *Src = getOrCreateType(Ty->getAliasedType(), Unit);
SmallString<128> NS;
llvm::raw_svector_ostream OS(NS);
@@ -770,8 +770,8 @@ llvm::MDType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty,
getContextDescriptor(cast<Decl>(AliasDecl->getDeclContext())));
}
-llvm::MDType *CGDebugInfo::CreateType(const TypedefType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
+ llvm::DIFile *Unit) {
// We don't set size information, but do specify where the typedef was
// declared.
SourceLocation Loc = Ty->getDecl()->getLocation();
@@ -783,8 +783,8 @@ llvm::MDType *CGDebugInfo::CreateType(const TypedefType *Ty,
getContextDescriptor(cast<Decl>(Ty->getDecl()->getDeclContext())));
}
-llvm::MDType *CGDebugInfo::CreateType(const FunctionType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
+ llvm::DIFile *Unit) {
SmallVector<llvm::Metadata *, 16> EltTys;
// Add the result type at least.
@@ -801,11 +801,11 @@ llvm::MDType *CGDebugInfo::CreateType(const FunctionType *Ty,
EltTys.push_back(DBuilder.createUnspecifiedParameter());
}
- llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
+ llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
return DBuilder.createSubroutineType(Unit, EltTypeArray);
}
-/// Convert an AccessSpecifier into the corresponding DebugNode flag.
+/// Convert an AccessSpecifier into the corresponding DINode flag.
/// As an optimization, return 0 if the access specifier equals the
/// default for the containing type.
static unsigned getAccessFlag(AccessSpecifier Access, const RecordDecl *RD) {
@@ -820,25 +820,25 @@ static unsigned getAccessFlag(AccessSpecifier Access, const RecordDecl *RD) {
switch (Access) {
case clang::AS_private:
- return llvm::DebugNode::FlagPrivate;
+ return llvm::DINode::FlagPrivate;
case clang::AS_protected:
- return llvm::DebugNode::FlagProtected;
+ return llvm::DINode::FlagProtected;
case clang::AS_public:
- return llvm::DebugNode::FlagPublic;
+ return llvm::DINode::FlagPublic;
case clang::AS_none:
return 0;
}
llvm_unreachable("unexpected access enumerator");
}
-llvm::MDType *CGDebugInfo::createFieldType(
+llvm::DIType *CGDebugInfo::createFieldType(
StringRef name, QualType type, uint64_t sizeInBitsOverride,
SourceLocation loc, AccessSpecifier AS, uint64_t offsetInBits,
- llvm::MDFile *tunit, llvm::MDScope *scope, const RecordDecl *RD) {
- llvm::MDType *debugType = getOrCreateType(type, tunit);
+ llvm::DIFile *tunit, llvm::DIScope *scope, const RecordDecl *RD) {
+ llvm::DIType *debugType = getOrCreateType(type, tunit);
// Get the location for the field.
- llvm::MDFile *file = getOrCreateFile(loc);
+ llvm::DIFile *file = getOrCreateFile(loc);
unsigned line = getLineNumber(loc);
uint64_t SizeInBits = 0;
@@ -860,7 +860,7 @@ llvm::MDType *CGDebugInfo::createFieldType(
/// CollectRecordLambdaFields - Helper for CollectRecordFields.
void CGDebugInfo::CollectRecordLambdaFields(
const CXXRecordDecl *CXXDecl, SmallVectorImpl<llvm::Metadata *> &elements,
- llvm::MDType *RecordTy) {
+ llvm::DIType *RecordTy) {
// For C++11 Lambdas a Field will be the same as a Capture, but the Capture
// has the name and the location of the variable so we should iterate over
// both concurrently.
@@ -873,14 +873,14 @@ void CGDebugInfo::CollectRecordLambdaFields(
const LambdaCapture &C = *I;
if (C.capturesVariable()) {
VarDecl *V = C.getCapturedVar();
- llvm::MDFile *VUnit = getOrCreateFile(C.getLocation());
+ llvm::DIFile *VUnit = getOrCreateFile(C.getLocation());
StringRef VName = V->getName();
uint64_t SizeInBitsOverride = 0;
if (Field->isBitField()) {
SizeInBitsOverride = Field->getBitWidthValue(CGM.getContext());
assert(SizeInBitsOverride && "found named 0-width bitfield");
}
- llvm::MDType *fieldType = createFieldType(
+ llvm::DIType *fieldType = createFieldType(
VName, Field->getType(), SizeInBitsOverride, C.getLocation(),
Field->getAccess(), layout.getFieldOffset(fieldno), VUnit, RecordTy,
CXXDecl);
@@ -891,9 +891,9 @@ void CGDebugInfo::CollectRecordLambdaFields(
// by using AT_object_pointer for the function and having that be
// used as 'this' for semantic references.
FieldDecl *f = *Field;
- llvm::MDFile *VUnit = getOrCreateFile(f->getLocation());
+ llvm::DIFile *VUnit = getOrCreateFile(f->getLocation());
QualType type = f->getType();
- llvm::MDType *fieldType = createFieldType(
+ llvm::DIType *fieldType = createFieldType(
"this", type, 0, f->getLocation(), f->getAccess(),
layout.getFieldOffset(fieldno), VUnit, RecordTy, CXXDecl);
@@ -903,14 +903,14 @@ void CGDebugInfo::CollectRecordLambdaFields(
}
/// Helper for CollectRecordFields.
-llvm::MDDerivedType *
-CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::MDType *RecordTy,
+llvm::DIDerivedType *
+CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy,
const RecordDecl *RD) {
// Create the descriptor for the static variable, with or without
// constant initializers.
Var = Var->getCanonicalDecl();
- llvm::MDFile *VUnit = getOrCreateFile(Var->getLocation());
- llvm::MDType *VTy = getOrCreateType(Var->getType(), VUnit);
+ llvm::DIFile *VUnit = getOrCreateFile(Var->getLocation());
+ llvm::DIType *VTy = getOrCreateType(Var->getType(), VUnit);
unsigned LineNumber = getLineNumber(Var->getLocation());
StringRef VName = Var->getName();
@@ -926,7 +926,7 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::MDType *RecordTy,
}
unsigned Flags = getAccessFlag(Var->getAccess(), RD);
- llvm::MDDerivedType *GV = DBuilder.createStaticMemberType(
+ llvm::DIDerivedType *GV = DBuilder.createStaticMemberType(
RecordTy, VName, VUnit, LineNumber, VTy, Flags, C);
StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV);
return GV;
@@ -934,8 +934,8 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::MDType *RecordTy,
/// CollectRecordNormalField - Helper for CollectRecordFields.
void CGDebugInfo::CollectRecordNormalField(
- const FieldDecl *field, uint64_t OffsetInBits, llvm::MDFile *tunit,
- SmallVectorImpl<llvm::Metadata *> &elements, llvm::MDType *RecordTy,
+ const FieldDecl *field, uint64_t OffsetInBits, llvm::DIFile *tunit,
+ SmallVectorImpl<llvm::Metadata *> &elements, llvm::DIType *RecordTy,
const RecordDecl *RD) {
StringRef name = field->getName();
QualType type = field->getType();
@@ -950,7 +950,7 @@ void CGDebugInfo::CollectRecordNormalField(
assert(SizeInBitsOverride && "found named 0-width bitfield");
}
- llvm::MDType *fieldType =
+ llvm::DIType *fieldType =
createFieldType(name, type, SizeInBitsOverride, field->getLocation(),
field->getAccess(), OffsetInBits, tunit, RecordTy, RD);
@@ -960,9 +960,9 @@ void CGDebugInfo::CollectRecordNormalField(
/// CollectRecordFields - A helper function to collect debug info for
/// record fields. This is used while creating debug info entry for a Record.
void CGDebugInfo::CollectRecordFields(
- const RecordDecl *record, llvm::MDFile *tunit,
+ const RecordDecl *record, llvm::DIFile *tunit,
SmallVectorImpl<llvm::Metadata *> &elements,
- llvm::MDCompositeType *RecordTy) {
+ llvm::DICompositeType *RecordTy) {
const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(record);
if (CXXDecl && CXXDecl->isLambda())
@@ -982,7 +982,7 @@ void CGDebugInfo::CollectRecordFields(
if (MI != StaticDataMemberCache.end()) {
assert(MI->second &&
"Static data member declaration should still exist");
- elements.push_back(cast<llvm::MDDerivedTypeBase>(MI->second));
+ elements.push_back(cast<llvm::DIDerivedTypeBase>(MI->second));
} else {
auto Field = CreateRecordStaticField(V, RecordTy, record);
elements.push_back(Field);
@@ -1000,22 +1000,22 @@ void CGDebugInfo::CollectRecordFields(
/// getOrCreateMethodType - CXXMethodDecl's type is a FunctionType. This
/// function type is not updated to include implicit "this" pointer. Use this
/// routine to get a method type which includes "this" pointer.
-llvm::MDSubroutineType *
+llvm::DISubroutineType *
CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
- llvm::MDFile *Unit) {
+ llvm::DIFile *Unit) {
const FunctionProtoType *Func = Method->getType()->getAs<FunctionProtoType>();
if (Method->isStatic())
- return cast_or_null<llvm::MDSubroutineType>(
+ return cast_or_null<llvm::DISubroutineType>(
getOrCreateType(QualType(Func, 0), Unit));
return getOrCreateInstanceMethodType(Method->getThisType(CGM.getContext()),
Func, Unit);
}
-llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
- QualType ThisPtr, const FunctionProtoType *Func, llvm::MDFile *Unit) {
+llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
+ QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile *Unit) {
// Add "this" pointer.
- llvm::MDTypeRefArray Args(
- cast<llvm::MDSubroutineType>(getOrCreateType(QualType(Func, 0), Unit))
+ llvm::DITypeRefArray Args(
+ cast<llvm::DISubroutineType>(getOrCreateType(QualType(Func, 0), Unit))
->getTypeArray());
assert(Args.size() && "Invalid number of arguments!");
@@ -1033,8 +1033,8 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy);
- llvm::MDType *PointeeType = getOrCreateType(PointeeTy, Unit);
- llvm::MDType *ThisPtrType =
+ llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit);
+ llvm::DIType *ThisPtrType =
DBuilder.createPointerType(PointeeType, Size, Align);
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
// TODO: This and the artificial type below are misleading, the
@@ -1043,7 +1043,7 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
Elts.push_back(ThisPtrType);
} else {
- llvm::MDType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
+ llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
Elts.push_back(ThisPtrType);
@@ -1053,13 +1053,13 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
for (unsigned i = 1, e = Args.size(); i != e; ++i)
Elts.push_back(Args[i]);
- llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
+ llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
unsigned Flags = 0;
if (Func->getExtProtoInfo().RefQualifier == RQ_LValue)
- Flags |= llvm::DebugNode::FlagLValueReference;
+ Flags |= llvm::DINode::FlagLValueReference;
if (Func->getExtProtoInfo().RefQualifier == RQ_RValue)
- Flags |= llvm::DebugNode::FlagRValueReference;
+ Flags |= llvm::DINode::FlagRValueReference;
return DBuilder.createSubroutineType(Unit, EltTypeArray, Flags);
}
@@ -1076,13 +1076,13 @@ static bool isFunctionLocalClass(const CXXRecordDecl *RD) {
/// CreateCXXMemberFunction - A helper function to create a subprogram for
/// a single member function GlobalDecl.
-llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction(
- const CXXMethodDecl *Method, llvm::MDFile *Unit, llvm::MDType *RecordTy) {
+llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
+ const CXXMethodDecl *Method, llvm::DIFile *Unit, llvm::DIType *RecordTy) {
bool IsCtorOrDtor =
isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method);
StringRef MethodName = getFunctionName(Method);
- llvm::MDSubroutineType *MethodTy = getOrCreateMethodType(Method, Unit);
+ llvm::DISubroutineType *MethodTy = getOrCreateMethodType(Method, Unit);
// Since a single ctor/dtor corresponds to multiple functions, it doesn't
// make sense to give a single ctor/dtor a linkage name.
@@ -1091,7 +1091,7 @@ llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction(
MethodLinkageName = CGM.getMangledName(Method);
// Get the location for the method.
- llvm::MDFile *MethodDefUnit = nullptr;
+ llvm::DIFile *MethodDefUnit = nullptr;
unsigned MethodLine = 0;
if (!Method->isImplicit()) {
MethodDefUnit = getOrCreateFile(Method->getLocation());
@@ -1099,7 +1099,7 @@ llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction(
}
// Collect virtual method info.
- llvm::MDType *ContainingType = nullptr;
+ llvm::DIType *ContainingType = nullptr;
unsigned Virtuality = 0;
unsigned VIndex = 0;
@@ -1122,26 +1122,25 @@ llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction(
unsigned Flags = 0;
if (Method->isImplicit())
- Flags |= llvm::DebugNode::FlagArtificial;
+ Flags |= llvm::DINode::FlagArtificial;
Flags |= getAccessFlag(Method->getAccess(), Method->getParent());
if (const CXXConstructorDecl *CXXC = dyn_cast<CXXConstructorDecl>(Method)) {
if (CXXC->isExplicit())
- Flags |= llvm::DebugNode::FlagExplicit;
+ Flags |= llvm::DINode::FlagExplicit;
} else if (const CXXConversionDecl *CXXC =
dyn_cast<CXXConversionDecl>(Method)) {
if (CXXC->isExplicit())
- Flags |= llvm::DebugNode::FlagExplicit;
+ Flags |= llvm::DINode::FlagExplicit;
}
if (Method->hasPrototype())
- Flags |= llvm::DebugNode::FlagPrototyped;
+ Flags |= llvm::DINode::FlagPrototyped;
if (Method->getRefQualifier() == RQ_LValue)
- Flags |= llvm::DebugNode::FlagLValueReference;
+ Flags |= llvm::DINode::FlagLValueReference;
if (Method->getRefQualifier() == RQ_RValue)
- Flags |= llvm::DebugNode::FlagRValueReference;
+ Flags |= llvm::DINode::FlagRValueReference;
- llvm::DebugNodeArray TParamsArray =
- CollectFunctionTemplateParams(Method, Unit);
- llvm::MDSubprogram *SP = DBuilder.createMethod(
+ llvm::DINodeArray TParamsArray = CollectFunctionTemplateParams(Method, Unit);
+ llvm::DISubprogram *SP = DBuilder.createMethod(
RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine,
MethodTy, /*isLocalToUnit=*/false,
/* isDefinition=*/false, Virtuality, VIndex, ContainingType, Flags,
@@ -1156,8 +1155,8 @@ llvm::MDSubprogram *CGDebugInfo::CreateCXXMemberFunction(
/// C++ member functions. This is used while creating debug info entry for
/// a Record.
void CGDebugInfo::CollectCXXMemberFunctions(
- const CXXRecordDecl *RD, llvm::MDFile *Unit,
- SmallVectorImpl<llvm::Metadata *> &EltTys, llvm::MDType *RecordTy) {
+ const CXXRecordDecl *RD, llvm::DIFile *Unit,
+ SmallVectorImpl<llvm::Metadata *> &EltTys, llvm::DIType *RecordTy) {
// Since we want more than just the individual member decls if we
// have templated functions iterate over every declaration to gather
@@ -1195,9 +1194,9 @@ void CGDebugInfo::CollectCXXMemberFunctions(
/// CollectCXXBases - A helper function to collect debug info for
/// C++ base classes. This is used while creating debug info entry for
/// a Record.
-void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::MDFile *Unit,
+void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile *Unit,
SmallVectorImpl<llvm::Metadata *> &EltTys,
- llvm::MDType *RecordTy) {
+ llvm::DIType *RecordTy) {
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
for (const auto &BI : RD->bases()) {
unsigned BFlags = 0;
@@ -1219,24 +1218,24 @@ void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::MDFile *Unit,
BaseOffset =
4 * CGM.getMicrosoftVTableContext().getVBTableIndex(RD, Base);
}
- BFlags = llvm::DebugNode::FlagVirtual;
+ BFlags = llvm::DINode::FlagVirtual;
} else
BaseOffset = CGM.getContext().toBits(RL.getBaseClassOffset(Base));
// FIXME: Inconsistent units for BaseOffset. It is in bytes when
// BI->isVirtual() and bits when not.
BFlags |= getAccessFlag(BI.getAccessSpecifier(), RD);
- llvm::MDType *DTy = DBuilder.createInheritance(
+ llvm::DIType *DTy = DBuilder.createInheritance(
RecordTy, getOrCreateType(BI.getType(), Unit), BaseOffset, BFlags);
EltTys.push_back(DTy);
}
}
/// CollectTemplateParams - A helper function to collect template parameters.
-llvm::DebugNodeArray
+llvm::DINodeArray
CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
ArrayRef<TemplateArgument> TAList,
- llvm::MDFile *Unit) {
+ llvm::DIFile *Unit) {
SmallVector<llvm::Metadata *, 16> TemplateParams;
for (unsigned i = 0, e = TAList.size(); i != e; ++i) {
const TemplateArgument &TA = TAList[i];
@@ -1245,12 +1244,12 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
Name = TPList->getParam(i)->getName();
switch (TA.getKind()) {
case TemplateArgument::Type: {
- llvm::MDType *TTy = getOrCreateType(TA.getAsType(), Unit);
+ llvm::DIType *TTy = getOrCreateType(TA.getAsType(), Unit);
TemplateParams.push_back(
DBuilder.createTemplateTypeParameter(TheCU, Name, TTy));
} break;
case TemplateArgument::Integral: {
- llvm::MDType *TTy = getOrCreateType(TA.getIntegralType(), Unit);
+ llvm::DIType *TTy = getOrCreateType(TA.getIntegralType(), Unit);
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
TheCU, Name, TTy,
llvm::ConstantInt::get(CGM.getLLVMContext(), TA.getAsIntegral())));
@@ -1258,7 +1257,7 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
case TemplateArgument::Declaration: {
const ValueDecl *D = TA.getAsDecl();
QualType T = TA.getParamTypeForDecl().getDesugaredType(CGM.getContext());
- llvm::MDType *TTy = getOrCreateType(T, Unit);
+ llvm::DIType *TTy = getOrCreateType(T, Unit);
llvm::Constant *V = nullptr;
const CXXMethodDecl *MD;
// Variable pointer template parameters have a value that is the address
@@ -1288,7 +1287,7 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
} break;
case TemplateArgument::NullPtr: {
QualType T = TA.getNullPtrType();
- llvm::MDType *TTy = getOrCreateType(T, Unit);
+ llvm::DIType *TTy = getOrCreateType(T, Unit);
llvm::Constant *V = nullptr;
// Special case member data pointer null values since they're actually -1
// instead of zero.
@@ -1323,7 +1322,7 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
T = CGM.getContext().getLValueReferenceType(T);
llvm::Constant *V = CGM.EmitConstantExpr(E, T);
assert(V && "Expression in template argument isn't constant");
- llvm::MDType *TTy = getOrCreateType(T, Unit);
+ llvm::DIType *TTy = getOrCreateType(T, Unit);
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
TheCU, Name, TTy, cast<llvm::Constant>(V->stripPointerCasts())));
} break;
@@ -1339,9 +1338,9 @@ CGDebugInfo::CollectTemplateParams(const TemplateParameterList *TPList,
/// CollectFunctionTemplateParams - A helper function to collect debug
/// info for function template parameters.
-llvm::DebugNodeArray
+llvm::DINodeArray
CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD,
- llvm::MDFile *Unit) {
+ llvm::DIFile *Unit) {
if (FD->getTemplatedKind() ==
FunctionDecl::TK_FunctionTemplateSpecialization) {
const TemplateParameterList *TList = FD->getTemplateSpecializationInfo()
@@ -1350,13 +1349,13 @@ CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD,
return CollectTemplateParams(
TList, FD->getTemplateSpecializationArgs()->asArray(), Unit);
}
- return llvm::DebugNodeArray();
+ return llvm::DINodeArray();
}
/// CollectCXXTemplateParams - A helper function to collect debug info for
/// template parameters.
-llvm::DebugNodeArray CGDebugInfo::CollectCXXTemplateParams(
- const ClassTemplateSpecializationDecl *TSpecial, llvm::MDFile *Unit) {
+llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(
+ const ClassTemplateSpecializationDecl *TSpecial, llvm::DIFile *Unit) {
// Always get the full list of parameters, not just the ones from
// the specialization.
TemplateParameterList *TPList =
@@ -1366,7 +1365,7 @@ llvm::DebugNodeArray CGDebugInfo::CollectCXXTemplateParams(
}
/// getOrCreateVTablePtrType - Return debug info descriptor for vtable.
-llvm::MDType *CGDebugInfo::getOrCreateVTablePtrType(llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::getOrCreateVTablePtrType(llvm::DIFile *Unit) {
if (VTablePtrType)
return VTablePtrType;
@@ -1374,10 +1373,10 @@ llvm::MDType *CGDebugInfo::getOrCreateVTablePtrType(llvm::MDFile *Unit) {
/* Function type */
llvm::Metadata *STy = getOrCreateType(Context.IntTy, Unit);
- llvm::MDTypeRefArray SElements = DBuilder.getOrCreateTypeArray(STy);
- llvm::MDType *SubTy = DBuilder.createSubroutineType(Unit, SElements);
+ llvm::DITypeRefArray SElements = DBuilder.getOrCreateTypeArray(STy);
+ llvm::DIType *SubTy = DBuilder.createSubroutineType(Unit, SElements);
unsigned Size = Context.getTypeSize(Context.VoidPtrTy);
- llvm::MDType *vtbl_ptr_type =
+ llvm::DIType *vtbl_ptr_type =
DBuilder.createPointerType(SubTy, Size, 0, "__vtbl_ptr_type");
VTablePtrType = DBuilder.createPointerType(vtbl_ptr_type, Size);
return VTablePtrType;
@@ -1391,7 +1390,7 @@ StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) {
/// CollectVTableInfo - If the C++ class has vtable info then insert appropriate
/// debug info entry in EltTys vector.
-void CGDebugInfo::CollectVTableInfo(const CXXRecordDecl *RD, llvm::MDFile *Unit,
+void CGDebugInfo::CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile *Unit,
SmallVectorImpl<llvm::Metadata *> &EltTys) {
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
@@ -1404,26 +1403,26 @@ void CGDebugInfo::CollectVTableInfo(const CXXRecordDecl *RD, llvm::MDFile *Unit,
return;
unsigned Size = CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy);
- llvm::MDType *VPTR = DBuilder.createMemberType(
+ llvm::DIType *VPTR = DBuilder.createMemberType(
Unit, getVTableName(RD), Unit, 0, Size, 0, 0,
- llvm::DebugNode::FlagArtificial, getOrCreateVTablePtrType(Unit));
+ llvm::DINode::FlagArtificial, getOrCreateVTablePtrType(Unit));
EltTys.push_back(VPTR);
}
/// getOrCreateRecordType - Emit record type's standalone debug info.
-llvm::MDType *CGDebugInfo::getOrCreateRecordType(QualType RTy,
+llvm::DIType *CGDebugInfo::getOrCreateRecordType(QualType RTy,
SourceLocation Loc) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
- llvm::MDType *T = getOrCreateType(RTy, getOrCreateFile(Loc));
+ llvm::DIType *T = getOrCreateType(RTy, getOrCreateFile(Loc));
return T;
}
/// getOrCreateInterfaceType - Emit an objective c interface type standalone
/// debug info.
-llvm::MDType *CGDebugInfo::getOrCreateInterfaceType(QualType D,
+llvm::DIType *CGDebugInfo::getOrCreateInterfaceType(QualType D,
SourceLocation Loc) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
- llvm::MDType *T = getOrCreateType(D, getOrCreateFile(Loc));
+ llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc));
RetainedTypes.push_back(D.getAsOpaquePtr());
return T;
}
@@ -1434,9 +1433,9 @@ void CGDebugInfo::completeType(const EnumDecl *ED) {
QualType Ty = CGM.getContext().getEnumType(ED);
void *TyPtr = Ty.getAsOpaquePtr();
auto I = TypeCache.find(TyPtr);
- if (I == TypeCache.end() || !cast<llvm::MDType>(I->second)->isForwardDecl())
+ if (I == TypeCache.end() || !cast<llvm::DIType>(I->second)->isForwardDecl())
return;
- llvm::MDType *Res = CreateTypeDefinition(Ty->castAs<EnumType>());
+ llvm::DIType *Res = CreateTypeDefinition(Ty->castAs<EnumType>());
assert(!Res->isForwardDecl());
TypeCache[TyPtr].reset(Res);
}
@@ -1456,7 +1455,7 @@ void CGDebugInfo::completeRequiredType(const RecordDecl *RD) {
return;
QualType Ty = CGM.getContext().getRecordType(RD);
- llvm::MDType *T = getTypeOrNull(Ty);
+ llvm::DIType *T = getTypeOrNull(Ty);
if (T && T->isForwardDecl())
completeClassData(RD);
}
@@ -1467,9 +1466,9 @@ void CGDebugInfo::completeClassData(const RecordDecl *RD) {
QualType Ty = CGM.getContext().getRecordType(RD);
void *TyPtr = Ty.getAsOpaquePtr();
auto I = TypeCache.find(TyPtr);
- if (I != TypeCache.end() && !cast<llvm::MDType>(I->second)->isForwardDecl())
+ if (I != TypeCache.end() && !cast<llvm::DIType>(I->second)->isForwardDecl())
return;
- llvm::MDType *Res = CreateTypeDefinition(Ty->castAs<RecordType>());
+ llvm::DIType *Res = CreateTypeDefinition(Ty->castAs<RecordType>());
assert(!Res->isForwardDecl());
TypeCache[TyPtr].reset(Res);
}
@@ -1518,9 +1517,9 @@ static bool shouldOmitDefinition(CodeGenOptions::DebugInfoKind DebugKind,
}
/// CreateType - get structure or union type.
-llvm::MDType *CGDebugInfo::CreateType(const RecordType *Ty) {
+llvm::DIType *CGDebugInfo::CreateType(const RecordType *Ty) {
RecordDecl *RD = Ty->getDecl();
- llvm::MDType *T = cast_or_null<llvm::MDType>(getTypeOrNull(QualType(Ty, 0)));
+ llvm::DIType *T = cast_or_null<llvm::DIType>(getTypeOrNull(QualType(Ty, 0)));
if (T || shouldOmitDefinition(DebugKind, RD, CGM.getLangOpts())) {
if (!T)
T = getOrCreateRecordFwdDecl(
@@ -1531,11 +1530,11 @@ llvm::MDType *CGDebugInfo::CreateType(const RecordType *Ty) {
return CreateTypeDefinition(Ty);
}
-llvm::MDType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
+llvm::DIType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
RecordDecl *RD = Ty->getDecl();
// Get overall information about the record type for the debug info.
- llvm::MDFile *DefUnit = getOrCreateFile(RD->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(RD->getLocation());
// Records and classes and unions can all be recursive. To handle them, we
// first generate a debug descriptor for the struct as a forward declaration.
@@ -1545,7 +1544,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
// uses of the forward declaration with the final definition.
auto *FwdDecl =
- cast<llvm::MDCompositeType>(getOrCreateLimitedType(Ty, DefUnit));
+ cast<llvm::DICompositeType>(getOrCreateLimitedType(Ty, DefUnit));
const RecordDecl *D = RD->getDefinition();
if (!D || !D->isCompleteDefinition())
@@ -1580,20 +1579,20 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
LexicalBlockStack.pop_back();
RegionMap.erase(Ty->getDecl());
- llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys);
+ llvm::DINodeArray Elements = DBuilder.getOrCreateArray(EltTys);
DBuilder.replaceArrays(FwdDecl, Elements);
if (FwdDecl->isTemporary())
FwdDecl =
- llvm::MDNode::replaceWithPermanent(llvm::TempMDCompositeType(FwdDecl));
+ llvm::MDNode::replaceWithPermanent(llvm::TempDICompositeType(FwdDecl));
RegionMap[Ty->getDecl()].reset(FwdDecl);
return FwdDecl;
}
/// CreateType - get objective-c object type.
-llvm::MDType *CGDebugInfo::CreateType(const ObjCObjectType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const ObjCObjectType *Ty,
+ llvm::DIFile *Unit) {
// Ignore protocols.
return getOrCreateType(Ty->getBaseType(), Unit);
}
@@ -1623,14 +1622,14 @@ static bool hasDefaultSetterName(const ObjCPropertyDecl *PD,
}
/// CreateType - get objective-c interface type.
-llvm::MDType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
+ llvm::DIFile *Unit) {
ObjCInterfaceDecl *ID = Ty->getDecl();
if (!ID)
return nullptr;
// Get overall information about the record type for the debug info.
- llvm::MDFile *DefUnit = getOrCreateFile(ID->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
unsigned Line = getLineNumber(ID->getLocation());
auto RuntimeLang =
static_cast<llvm::dwarf::SourceLanguage>(TheCU->getSourceLanguage());
@@ -1639,7 +1638,7 @@ llvm::MDType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
// debug type since we won't be able to lay out the entire type.
ObjCInterfaceDecl *Def = ID->getDefinition();
if (!Def || !Def->getImplementation()) {
- llvm::MDType *FwdDecl = DBuilder.createReplaceableCompositeType(
+ llvm::DIType *FwdDecl = DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, ID->getName(), TheCU, DefUnit, Line,
RuntimeLang);
ObjCInterfaceCache.push_back(ObjCInterfaceCacheEntry(Ty, FwdDecl, Unit));
@@ -1649,10 +1648,10 @@ llvm::MDType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
return CreateTypeDefinition(Ty, Unit);
}
-llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
+ llvm::DIFile *Unit) {
ObjCInterfaceDecl *ID = Ty->getDecl();
- llvm::MDFile *DefUnit = getOrCreateFile(ID->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
unsigned Line = getLineNumber(ID->getLocation());
unsigned RuntimeLang = TheCU->getSourceLanguage();
@@ -1662,11 +1661,11 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
unsigned Flags = 0;
if (ID->getImplementation())
- Flags |= llvm::DebugNode::FlagObjcClassComplete;
+ Flags |= llvm::DINode::FlagObjcClassComplete;
- llvm::MDCompositeType *RealDecl = DBuilder.createStructType(
+ llvm::DICompositeType *RealDecl = DBuilder.createStructType(
Unit, ID->getName(), DefUnit, Line, Size, Align, Flags, nullptr,
- llvm::DebugNodeArray(), RuntimeLang);
+ llvm::DINodeArray(), RuntimeLang);
QualType QTy(Ty, 0);
TypeCache[QTy.getAsOpaquePtr()].reset(RealDecl);
@@ -1680,19 +1679,19 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
ObjCInterfaceDecl *SClass = ID->getSuperClass();
if (SClass) {
- llvm::MDType *SClassTy =
+ llvm::DIType *SClassTy =
getOrCreateType(CGM.getContext().getObjCInterfaceType(SClass), Unit);
if (!SClassTy)
return nullptr;
- llvm::MDType *InhTag = DBuilder.createInheritance(RealDecl, SClassTy, 0, 0);
+ llvm::DIType *InhTag = DBuilder.createInheritance(RealDecl, SClassTy, 0, 0);
EltTys.push_back(InhTag);
}
// Create entries for all of the properties.
for (const auto *PD : ID->properties()) {
SourceLocation Loc = PD->getLocation();
- llvm::MDFile *PUnit = getOrCreateFile(Loc);
+ llvm::DIFile *PUnit = getOrCreateFile(Loc);
unsigned PLine = getLineNumber(Loc);
ObjCMethodDecl *Getter = PD->getGetterMethodDecl();
ObjCMethodDecl *Setter = PD->getSetterMethodDecl();
@@ -1710,7 +1709,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
unsigned FieldNo = 0;
for (ObjCIvarDecl *Field = ID->all_declared_ivar_begin(); Field;
Field = Field->getNextIvar(), ++FieldNo) {
- llvm::MDType *FieldTy = getOrCreateType(Field->getType(), Unit);
+ llvm::DIType *FieldTy = getOrCreateType(Field->getType(), Unit);
if (!FieldTy)
return nullptr;
@@ -1721,7 +1720,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
continue;
// Get the location for the field.
- llvm::MDFile *FieldDefUnit = getOrCreateFile(Field->getLocation());
+ llvm::DIFile *FieldDefUnit = getOrCreateFile(Field->getLocation());
unsigned FieldLine = getLineNumber(Field->getLocation());
QualType FType = Field->getType();
uint64_t FieldSize = 0;
@@ -1754,11 +1753,11 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
unsigned Flags = 0;
if (Field->getAccessControl() == ObjCIvarDecl::Protected)
- Flags = llvm::DebugNode::FlagProtected;
+ Flags = llvm::DINode::FlagProtected;
else if (Field->getAccessControl() == ObjCIvarDecl::Private)
- Flags = llvm::DebugNode::FlagPrivate;
+ Flags = llvm::DINode::FlagPrivate;
else if (Field->getAccessControl() == ObjCIvarDecl::Public)
- Flags = llvm::DebugNode::FlagPublic;
+ Flags = llvm::DINode::FlagPublic;
llvm::MDNode *PropertyNode = nullptr;
if (ObjCImplementationDecl *ImpD = ID->getImplementation()) {
@@ -1766,7 +1765,7 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
ImpD->FindPropertyImplIvarDecl(Field->getIdentifier())) {
if (ObjCPropertyDecl *PD = PImpD->getPropertyDecl()) {
SourceLocation Loc = PD->getLocation();
- llvm::MDFile *PUnit = getOrCreateFile(Loc);
+ llvm::DIFile *PUnit = getOrCreateFile(Loc);
unsigned PLine = getLineNumber(Loc);
ObjCMethodDecl *Getter = PD->getGetterMethodDecl();
ObjCMethodDecl *Setter = PD->getSetterMethodDecl();
@@ -1787,16 +1786,16 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty,
EltTys.push_back(FieldTy);
}
- llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys);
+ llvm::DINodeArray Elements = DBuilder.getOrCreateArray(EltTys);
DBuilder.replaceArrays(RealDecl, Elements);
LexicalBlockStack.pop_back();
return RealDecl;
}
-llvm::MDType *CGDebugInfo::CreateType(const VectorType *Ty,
- llvm::MDFile *Unit) {
- llvm::MDType *ElementTy = getOrCreateType(Ty->getElementType(), Unit);
+llvm::DIType *CGDebugInfo::CreateType(const VectorType *Ty,
+ llvm::DIFile *Unit) {
+ llvm::DIType *ElementTy = getOrCreateType(Ty->getElementType(), Unit);
int64_t Count = Ty->getNumElements();
if (Count == 0)
// If number of elements are not known then this is an unbounded array.
@@ -1804,7 +1803,7 @@ llvm::MDType *CGDebugInfo::CreateType(const VectorType *Ty,
Count = -1;
llvm::Metadata *Subscript = DBuilder.getOrCreateSubrange(0, Count);
- llvm::DebugNodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript);
+ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript);
uint64_t Size = CGM.getContext().getTypeSize(Ty);
uint64_t Align = CGM.getContext().getTypeAlign(Ty);
@@ -1812,7 +1811,7 @@ llvm::MDType *CGDebugInfo::CreateType(const VectorType *Ty,
return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray);
}
-llvm::MDType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) {
uint64_t Size;
uint64_t Align;
@@ -1858,27 +1857,27 @@ llvm::MDType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::MDFile *Unit) {
EltTy = Ty->getElementType();
}
- llvm::DebugNodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);
+ llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);
return DBuilder.createArrayType(Size, Align, getOrCreateType(EltTy, Unit),
SubscriptArray);
}
-llvm::MDType *CGDebugInfo::CreateType(const LValueReferenceType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const LValueReferenceType *Ty,
+ llvm::DIFile *Unit) {
return CreatePointerLikeType(llvm::dwarf::DW_TAG_reference_type, Ty,
Ty->getPointeeType(), Unit);
}
-llvm::MDType *CGDebugInfo::CreateType(const RValueReferenceType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateType(const RValueReferenceType *Ty,
+ llvm::DIFile *Unit) {
return CreatePointerLikeType(llvm::dwarf::DW_TAG_rvalue_reference_type, Ty,
Ty->getPointeeType(), Unit);
}
-llvm::MDType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
- llvm::MDFile *U) {
- llvm::MDType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
+llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
+ llvm::DIFile *U) {
+ llvm::DIType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
if (Ty->isMemberDataPointerType())
return DBuilder.createMemberPointerType(
getOrCreateType(Ty->getPointeeType(), U), ClassType,
@@ -1893,14 +1892,14 @@ llvm::MDType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
ClassType, CGM.getContext().getTypeSize(Ty));
}
-llvm::MDType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::MDFile *U) {
+llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
// Ignore the atomic wrapping
// FIXME: What is the correct representation?
return getOrCreateType(Ty->getValueType(), U);
}
/// CreateEnumType - get enumeration type.
-llvm::MDType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
+llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
const EnumDecl *ED = Ty->getDecl();
uint64_t Size = 0;
uint64_t Align = 0;
@@ -1914,14 +1913,14 @@ llvm::MDType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
// If this is just a forward declaration, construct an appropriately
// marked node and just return it.
if (!ED->getDefinition()) {
- llvm::MDScope *EDContext =
+ llvm::DIScope *EDContext =
getContextDescriptor(cast<Decl>(ED->getDeclContext()));
- llvm::MDFile *DefUnit = getOrCreateFile(ED->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
unsigned Line = getLineNumber(ED->getLocation());
StringRef EDName = ED->getName();
- llvm::MDType *RetTy = DBuilder.createReplaceableCompositeType(
+ llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line,
- 0, Size, Align, llvm::DebugNode::FlagFwdDecl, FullName);
+ 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
ReplaceMap.emplace_back(
std::piecewise_construct, std::make_tuple(Ty),
std::make_tuple(static_cast<llvm::Metadata *>(RetTy)));
@@ -1931,7 +1930,7 @@ llvm::MDType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
return CreateTypeDefinition(Ty);
}
-llvm::MDType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
+llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
const EnumDecl *ED = Ty->getDecl();
uint64_t Size = 0;
uint64_t Align = 0;
@@ -1951,13 +1950,13 @@ llvm::MDType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
}
// Return a CompositeType for the enum itself.
- llvm::DebugNodeArray EltArray = DBuilder.getOrCreateArray(Enumerators);
+ llvm::DINodeArray EltArray = DBuilder.getOrCreateArray(Enumerators);
- llvm::MDFile *DefUnit = getOrCreateFile(ED->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
unsigned Line = getLineNumber(ED->getLocation());
- llvm::MDScope *EnumContext =
+ llvm::DIScope *EnumContext =
getContextDescriptor(cast<Decl>(ED->getDeclContext()));
- llvm::MDType *ClassTy =
+ llvm::DIType *ClassTy =
ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr;
return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit,
Line, Size, Align, EltArray, ClassTy,
@@ -2021,7 +2020,7 @@ static QualType UnwrapTypeForDebugInfo(QualType T, const ASTContext &C) {
/// getType - Get the type from the cache or return null type if it doesn't
/// exist.
-llvm::MDType *CGDebugInfo::getTypeOrNull(QualType Ty) {
+llvm::DIType *CGDebugInfo::getTypeOrNull(QualType Ty) {
// Unwrap the type as needed for debug information.
Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext());
@@ -2030,7 +2029,7 @@ llvm::MDType *CGDebugInfo::getTypeOrNull(QualType Ty) {
if (it != TypeCache.end()) {
// Verify that the debug info still exists.
if (llvm::Metadata *V = it->second)
- return cast<llvm::MDType>(V);
+ return cast<llvm::DIType>(V);
}
return nullptr;
@@ -2049,7 +2048,7 @@ void CGDebugInfo::completeTemplateDefinition(
/// getOrCreateType - Get the type from the cache or create a new
/// one if necessary.
-llvm::MDType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile *Unit) {
if (Ty.isNull())
return nullptr;
@@ -2060,7 +2059,7 @@ llvm::MDType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::MDFile *Unit) {
return T;
// Otherwise create the type.
- llvm::MDType *Res = CreateTypeNode(Ty, Unit);
+ llvm::DIType *Res = CreateTypeNode(Ty, Unit);
void *TyPtr = Ty.getAsOpaquePtr();
// And update the type cache.
@@ -2096,7 +2095,7 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCInterfaceDecl(QualType Ty) {
}
/// CreateTypeNode - Create a new debug type node.
-llvm::MDType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile *Unit) {
// Handle qualifiers, which recursively handles what they refer to.
if (Ty.hasLocalQualifiers())
return CreateQualifiedType(Ty, Unit);
@@ -2178,11 +2177,11 @@ llvm::MDType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::MDFile *Unit) {
/// getOrCreateLimitedType - Get the type from the cache or create a new
/// limited type if necessary.
-llvm::MDType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
- llvm::MDFile *Unit) {
+llvm::DIType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
+ llvm::DIFile *Unit) {
QualType QTy(Ty, 0);
- auto *T = cast_or_null<llvm::MDCompositeTypeBase>(getTypeOrNull(QTy));
+ auto *T = cast_or_null<llvm::DICompositeTypeBase>(getTypeOrNull(QTy));
// We may have cached a forward decl when we could have created
// a non-forward decl. Go ahead and create a non-forward decl
@@ -2191,12 +2190,12 @@ llvm::MDType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
return T;
// Otherwise create the type.
- llvm::MDCompositeType *Res = CreateLimitedType(Ty);
+ llvm::DICompositeType *Res = CreateLimitedType(Ty);
// Propagate members from the declaration to the definition
// CreateType(const RecordType*) will overwrite this with the members in the
// correct order if the full type is needed.
- DBuilder.replaceArrays(Res, T ? T->getElements() : llvm::DebugNodeArray());
+ DBuilder.replaceArrays(Res, T ? T->getElements() : llvm::DINodeArray());
// And update the type cache.
TypeCache[QTy.getAsOpaquePtr()].reset(Res);
@@ -2204,20 +2203,20 @@ llvm::MDType *CGDebugInfo::getOrCreateLimitedType(const RecordType *Ty,
}
// TODO: Currently used for context chains when limiting debug info.
-llvm::MDCompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
+llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
RecordDecl *RD = Ty->getDecl();
// Get overall information about the record type for the debug info.
- llvm::MDFile *DefUnit = getOrCreateFile(RD->getLocation());
+ llvm::DIFile *DefUnit = getOrCreateFile(RD->getLocation());
unsigned Line = getLineNumber(RD->getLocation());
StringRef RDName = getClassName(RD);
- llvm::MDScope *RDContext =
+ llvm::DIScope *RDContext =
getContextDescriptor(cast<Decl>(RD->getDeclContext()));
// If we ended up creating the type during the context chain construction,
// just return that.
- auto *T = cast_or_null<llvm::MDCompositeType>(
+ auto *T = cast_or_null<llvm::DICompositeType>(
getTypeOrNull(CGM.getContext().getRecordType(RD)));
if (T && (!T->isForwardDecl() || !RD->getDefinition()))
return T;
@@ -2233,7 +2232,7 @@ llvm::MDCompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU);
- llvm::MDCompositeType *RealDecl = DBuilder.createReplaceableCompositeType(
+ llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType(
getTagForRecord(RD), RDName, RDContext, DefUnit, Line, 0, Size, Align, 0,
FullName);
@@ -2242,15 +2241,15 @@ llvm::MDCompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
if (const ClassTemplateSpecializationDecl *TSpecial =
dyn_cast<ClassTemplateSpecializationDecl>(RD))
- DBuilder.replaceArrays(RealDecl, llvm::DebugNodeArray(),
+ DBuilder.replaceArrays(RealDecl, llvm::DINodeArray(),
CollectCXXTemplateParams(TSpecial, DefUnit));
return RealDecl;
}
void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
- llvm::MDCompositeType *RealDecl) {
+ llvm::DICompositeType *RealDecl) {
// A class's primary base or the class itself contains the vtable.
- llvm::MDCompositeType *ContainingType = nullptr;
+ llvm::DICompositeType *ContainingType = nullptr;
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) {
// Seek non-virtual primary base root.
@@ -2262,7 +2261,7 @@ void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
else
break;
}
- ContainingType = cast<llvm::MDCompositeType>(
+ ContainingType = cast<llvm::DICompositeType>(
getOrCreateType(QualType(PBase->getTypeForDecl(), 0),
getOrCreateFile(RD->getLocation())));
} else if (RD->isDynamicClass())
@@ -2272,29 +2271,29 @@ void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
}
/// CreateMemberType - Create new member and increase Offset by FType's size.
-llvm::MDType *CGDebugInfo::CreateMemberType(llvm::MDFile *Unit, QualType FType,
+llvm::DIType *CGDebugInfo::CreateMemberType(llvm::DIFile *Unit, QualType FType,
StringRef Name, uint64_t *Offset) {
- llvm::MDType *FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
+ llvm::DIType *FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
uint64_t FieldSize = CGM.getContext().getTypeSize(FType);
unsigned FieldAlign = CGM.getContext().getTypeAlign(FType);
- llvm::MDType *Ty = DBuilder.createMemberType(Unit, Name, Unit, 0, FieldSize,
+ llvm::DIType *Ty = DBuilder.createMemberType(Unit, Name, Unit, 0, FieldSize,
FieldAlign, *Offset, 0, FieldTy);
*Offset += FieldSize;
return Ty;
}
-void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::MDFile *Unit,
+void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
StringRef &Name,
StringRef &LinkageName,
- llvm::MDScope *&FDContext,
- llvm::DebugNodeArray &TParamsArray,
+ llvm::DIScope *&FDContext,
+ llvm::DINodeArray &TParamsArray,
unsigned &Flags) {
const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
Name = getFunctionName(FD);
// Use mangled name as linkage name for C/C++ functions.
if (FD->hasPrototype()) {
LinkageName = CGM.getMangledName(GD);
- Flags |= llvm::DebugNode::FlagPrototyped;
+ Flags |= llvm::DINode::FlagPrototyped;
}
// No need to replicate the linkage name if it isn't different from the
// subprogram name, no need to have it at all unless coverage is enabled or
@@ -2317,10 +2316,10 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::MDFile *Unit,
}
}
-void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::MDFile *&Unit,
+void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
unsigned &LineNo, QualType &T,
StringRef &Name, StringRef &LinkageName,
- llvm::MDScope *&VDContext) {
+ llvm::DIScope *&VDContext) {
Unit = getOrCreateFile(VD->getLocation());
LineNo = getLineNumber(VD->getLocation());
@@ -2362,14 +2361,14 @@ void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::MDFile *&Unit,
VDContext = getContextDescriptor(dyn_cast<Decl>(DC));
}
-llvm::MDSubprogram *
+llvm::DISubprogram *
CGDebugInfo::getFunctionForwardDeclaration(const FunctionDecl *FD) {
- llvm::DebugNodeArray TParamsArray;
+ llvm::DINodeArray TParamsArray;
StringRef Name, LinkageName;
unsigned Flags = 0;
SourceLocation Loc = FD->getLocation();
- llvm::MDFile *Unit = getOrCreateFile(Loc);
- llvm::MDScope *DContext = Unit;
+ llvm::DIFile *Unit = getOrCreateFile(Loc);
+ llvm::DIScope *DContext = Unit;
unsigned Line = getLineNumber(Loc);
collectFunctionDeclProps(FD, Unit, Name, LinkageName, DContext,
@@ -2381,7 +2380,7 @@ CGDebugInfo::getFunctionForwardDeclaration(const FunctionDecl *FD) {
QualType FnType =
CGM.getContext().getFunctionType(FD->getReturnType(), ArgTypes,
FunctionProtoType::ExtProtoInfo());
- llvm::MDSubprogram *SP = DBuilder.createTempFunctionFwdDecl(
+ llvm::DISubprogram *SP = DBuilder.createTempFunctionFwdDecl(
DContext, Name, LinkageName, Unit, Line,
getOrCreateFunctionType(FD, FnType, Unit), !FD->isExternallyVisible(),
false /*declaration*/, 0, Flags, CGM.getLangOpts().Optimize, nullptr,
@@ -2393,13 +2392,13 @@ CGDebugInfo::getFunctionForwardDeclaration(const FunctionDecl *FD) {
return SP;
}
-llvm::MDGlobalVariable *
+llvm::DIGlobalVariable *
CGDebugInfo::getGlobalVariableForwardDeclaration(const VarDecl *VD) {
QualType T;
StringRef Name, LinkageName;
SourceLocation Loc = VD->getLocation();
- llvm::MDFile *Unit = getOrCreateFile(Loc);
- llvm::MDScope *DContext = Unit;
+ llvm::DIFile *Unit = getOrCreateFile(Loc);
+ llvm::DIScope *DContext = Unit;
unsigned Line = getLineNumber(Loc);
collectVarDeclProps(VD, Unit, Line, T, Name, LinkageName, DContext);
@@ -2413,7 +2412,7 @@ CGDebugInfo::getGlobalVariableForwardDeclaration(const VarDecl *VD) {
return GV;
}
-llvm::DebugNode *CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
+llvm::DINode *CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
// We only need a declaration (not a definition) of the type - so use whatever
// we would otherwise do to get a type for a pointee. (forward declarations in
// limited debug info, full definitions (if the type definition is available)
@@ -2424,7 +2423,7 @@ llvm::DebugNode *CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
auto I = DeclCache.find(D->getCanonicalDecl());
if (I != DeclCache.end())
- return dyn_cast_or_null<llvm::DebugNode>(I->second);
+ return dyn_cast_or_null<llvm::DINode>(I->second);
// No definition for now. Emit a forward definition that might be
// merged with a potential upcoming definition.
@@ -2438,7 +2437,7 @@ llvm::DebugNode *CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
/// getFunctionDeclaration - Return debug info descriptor to describe method
/// declaration for the given method definition.
-llvm::MDSubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) {
+llvm::DISubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) {
if (!D || DebugKind <= CodeGenOptions::DebugLineTablesOnly)
return nullptr;
@@ -2454,11 +2453,11 @@ llvm::MDSubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) {
if (const CXXMethodDecl *MD =
dyn_cast<CXXMethodDecl>(FD->getCanonicalDecl())) {
return CreateCXXMemberFunction(MD, getOrCreateFile(MD->getLocation()),
- cast<llvm::MDCompositeType>(S));
+ cast<llvm::DICompositeType>(S));
}
}
if (MI != SPCache.end()) {
- auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(MI->second);
+ auto *SP = dyn_cast_or_null<llvm::DISubprogram>(MI->second);
if (SP && !SP->isDefinition())
return SP;
}
@@ -2466,7 +2465,7 @@ llvm::MDSubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) {
for (auto NextFD : FD->redecls()) {
auto MI = SPCache.find(NextFD->getCanonicalDecl());
if (MI != SPCache.end()) {
- auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(MI->second);
+ auto *SP = dyn_cast_or_null<llvm::DISubprogram>(MI->second);
if (SP && !SP->isDefinition())
return SP;
}
@@ -2476,9 +2475,9 @@ llvm::MDSubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) {
// getOrCreateFunctionType - Construct type. If it is a c++ method, include
// implicit parameter "this".
-llvm::MDSubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
+llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
QualType FnType,
- llvm::MDFile *F) {
+ llvm::DIFile *F) {
if (!D || DebugKind <= CodeGenOptions::DebugLineTablesOnly)
// Create fake but valid subroutine type. Otherwise -verify would fail, and
// subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields.
@@ -2513,7 +2512,7 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
if (OMethod->isVariadic())
Elts.push_back(DBuilder.createUnspecifiedParameter());
- llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
+ llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
return DBuilder.createSubroutineType(F, EltTypeArray);
}
@@ -2527,11 +2526,11 @@ llvm::MDSubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i)
EltTys.push_back(getOrCreateType(FPT->getParamType(i), F));
EltTys.push_back(DBuilder.createUnspecifiedParameter());
- llvm::MDTypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
+ llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
return DBuilder.createSubroutineType(F, EltTypeArray);
}
- return cast<llvm::MDSubroutineType>(getOrCreateType(FnType, F));
+ return cast<llvm::DISubroutineType>(getOrCreateType(FnType, F));
}
/// EmitFunctionStart - Constructs the debug code for entering a function.
@@ -2548,9 +2547,9 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc,
bool HasDecl = (D != nullptr);
unsigned Flags = 0;
- llvm::MDFile *Unit = getOrCreateFile(Loc);
- llvm::MDScope *FDContext = Unit;
- llvm::DebugNodeArray TParamsArray;
+ llvm::DIFile *Unit = getOrCreateFile(Loc);
+ llvm::DIScope *FDContext = Unit;
+ llvm::DINodeArray TParamsArray;
if (!HasDecl) {
// Use llvm function name.
LinkageName = Fn->getName();
@@ -2558,7 +2557,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc,
// If there is a subprogram for this function available then use it.
auto FI = SPCache.find(FD->getCanonicalDecl());
if (FI != SPCache.end()) {
- auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(FI->second);
+ auto *SP = dyn_cast_or_null<llvm::DISubprogram>(FI->second);
if (SP && SP->isDefinition()) {
LexicalBlockStack.emplace_back(SP);
RegionMap[D].reset(SP);
@@ -2569,17 +2568,17 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc,
TParamsArray, Flags);
} else if (const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(D)) {
Name = getObjCMethodName(OMD);
- Flags |= llvm::DebugNode::FlagPrototyped;
+ Flags |= llvm::DINode::FlagPrototyped;
} else {
// Use llvm function name.
Name = Fn->getName();
- Flags |= llvm::DebugNode::FlagPrototyped;
+ Flags |= llvm::DINode::FlagPrototyped;
}
if (!Name.empty() && Name[0] == '\01')
Name = Name.substr(1);
if (!HasDecl || D->isImplicit()) {
- Flags |= llvm::DebugNode::FlagArtificial;
+ Flags |= llvm::DINode::FlagArtificial;
// Artificial functions without a location should not silently reuse CurLoc.
if (Loc.isInvalid())
CurLoc = SourceLocation();
@@ -2592,7 +2591,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc,
// FunctionDecls. When/if we fix this we can have FDContext be TheCU/null for
// all subprograms instead of the actual context since subprogram definitions
// are emitted as CU level entities by the backend.
- llvm::MDSubprogram *SP = DBuilder.createFunction(
+ llvm::DISubprogram *SP = DBuilder.createFunction(
FDContext, Name, LinkageName, Unit, LineNo,
getOrCreateFunctionType(D, FnType, Unit), Fn->hasInternalLinkage(),
true /*definition*/, ScopeLine, Flags, CGM.getLangOpts().Optimize, Fn,
@@ -2632,7 +2631,7 @@ void CGDebugInfo::CreateLexicalBlock(SourceLocation Loc) {
if (!LexicalBlockStack.empty())
Back = LexicalBlockStack.back().get();
LexicalBlockStack.emplace_back(DBuilder.createLexicalBlock(
- cast<llvm::MDScope>(Back), getOrCreateFile(CurLoc), getLineNumber(CurLoc),
+ cast<llvm::DIScope>(Back), getOrCreateFile(CurLoc), getLineNumber(CurLoc),
getColumnNumber(CurLoc)));
}
@@ -2686,7 +2685,7 @@ void CGDebugInfo::EmitFunctionEnd(CGBuilderTy &Builder) {
// EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
// See BuildByRefType.
-llvm::MDType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
+llvm::DIType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
uint64_t *XOffset) {
SmallVector<llvm::Metadata *, 5> EltTys;
@@ -2694,7 +2693,7 @@ llvm::MDType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
uint64_t FieldSize, FieldOffset;
unsigned FieldAlign;
- llvm::MDFile *Unit = getOrCreateFile(VD->getLocation());
+ llvm::DIFile *Unit = getOrCreateFile(VD->getLocation());
QualType Type = VD->getType();
FieldOffset = 0;
@@ -2741,7 +2740,7 @@ llvm::MDType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
}
FType = Type;
- llvm::MDType *FieldTy = getOrCreateType(FType, Unit);
+ llvm::DIType *FieldTy = getOrCreateType(FType, Unit);
FieldSize = CGM.getContext().getTypeSize(FType);
FieldAlign = CGM.getContext().toBits(Align);
@@ -2751,9 +2750,9 @@ llvm::MDType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
EltTys.push_back(FieldTy);
FieldOffset += FieldSize;
- llvm::DebugNodeArray Elements = DBuilder.getOrCreateArray(EltTys);
+ llvm::DINodeArray Elements = DBuilder.getOrCreateArray(EltTys);
- unsigned Flags = llvm::DebugNode::FlagBlockByrefStruct;
+ unsigned Flags = llvm::DINode::FlagBlockByrefStruct;
return DBuilder.createStructType(Unit, "", Unit, 0, FieldOffset, 0, Flags,
nullptr, Elements);
@@ -2769,10 +2768,10 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
bool Unwritten =
VD->isImplicit() || (isa<Decl>(VD->getDeclContext()) &&
cast<Decl>(VD->getDeclContext())->isImplicit());
- llvm::MDFile *Unit = nullptr;
+ llvm::DIFile *Unit = nullptr;
if (!Unwritten)
Unit = getOrCreateFile(VD->getLocation());
- llvm::MDType *Ty;
+ llvm::DIType *Ty;
uint64_t XOffset = 0;
if (VD->hasAttr<BlocksAttr>())
Ty = EmitTypeForVarWithBlocksAttr(VD, &XOffset);
@@ -2794,20 +2793,20 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
SmallVector<int64_t, 9> Expr;
unsigned Flags = 0;
if (VD->isImplicit())
- Flags |= llvm::DebugNode::FlagArtificial;
+ Flags |= llvm::DINode::FlagArtificial;
// If this is the first argument and it is implicit then
// give it an object pointer flag.
// FIXME: There has to be a better way to do this, but for static
// functions there won't be an implicit param at arg1 and
// otherwise it is 'self' or 'this'.
if (isa<ImplicitParamDecl>(VD) && ArgNo == 1)
- Flags |= llvm::DebugNode::FlagObjectPointer;
+ Flags |= llvm::DINode::FlagObjectPointer;
if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage))
if (Arg->getType()->isPointerTy() && !Arg->hasByValAttr() &&
!VD->getType()->isPointerType())
Expr.push_back(llvm::dwarf::DW_OP_deref);
- auto *Scope = cast<llvm::MDScope>(LexicalBlockStack.back());
+ auto *Scope = cast<llvm::DIScope>(LexicalBlockStack.back());
StringRef Name = VD->getName();
if (!Name.empty()) {
@@ -2841,7 +2840,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
if (RD->isUnion() && RD->isAnonymousStructOrUnion()) {
for (const auto *Field : RD->fields()) {
- llvm::MDType *FieldTy = getOrCreateType(Field->getType(), Unit);
+ llvm::DIType *FieldTy = getOrCreateType(Field->getType(), Unit);
StringRef FieldName = Field->getName();
// Ignore unnamed fields. Do not ignore unnamed records.
@@ -2886,9 +2885,9 @@ void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,
/// never happen though, since creating a type for the implicit self
/// argument implies that we already parsed the interface definition
/// and the ivar declarations in the implementation.
-llvm::MDType *CGDebugInfo::CreateSelfType(const QualType &QualTy,
- llvm::MDType *Ty) {
- llvm::MDType *CachedTy = getTypeOrNull(QualTy);
+llvm::DIType *CGDebugInfo::CreateSelfType(const QualType &QualTy,
+ llvm::DIType *Ty) {
+ llvm::DIType *CachedTy = getTypeOrNull(QualTy);
if (CachedTy)
Ty = CachedTy;
return DBuilder.createObjectPointerType(Ty);
@@ -2906,8 +2905,8 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
bool isByRef = VD->hasAttr<BlocksAttr>();
uint64_t XOffset = 0;
- llvm::MDFile *Unit = getOrCreateFile(VD->getLocation());
- llvm::MDType *Ty;
+ llvm::DIFile *Unit = getOrCreateFile(VD->getLocation());
+ llvm::DIType *Ty;
if (isByRef)
Ty = EmitTypeForVarWithBlocksAttr(VD, &XOffset);
else
@@ -2950,7 +2949,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
// Create the descriptor for the variable.
auto *D = DBuilder.createLocalVariable(
llvm::dwarf::DW_TAG_auto_variable,
- cast<llvm::MDLocalScope>(LexicalBlockStack.back()), VD->getName(), Unit,
+ cast<llvm::DILocalScope>(LexicalBlockStack.back()), VD->getName(), Unit,
Line, Ty);
// Insert an llvm.dbg.declare into the current block.
@@ -2993,7 +2992,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
// Collect some general information about the block's location.
SourceLocation loc = blockDecl->getCaretLocation();
- llvm::MDFile *tunit = getOrCreateFile(loc);
+ llvm::DIFile *tunit = getOrCreateFile(loc);
unsigned line = getLineNumber(loc);
unsigned column = getColumnNumber(loc);
@@ -3076,7 +3075,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
const VarDecl *variable = capture->getVariable();
StringRef name = variable->getName();
- llvm::MDType *fieldType;
+ llvm::DIType *fieldType;
if (capture->isByRef()) {
TypeInfo PtrInfo = C.getTypeInfo(C.VoidPtrTy);
@@ -3098,17 +3097,17 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
llvm::raw_svector_ostream(typeName) << "__block_literal_"
<< CGM.getUniqueBlockCount();
- llvm::DebugNodeArray fieldsArray = DBuilder.getOrCreateArray(fields);
+ llvm::DINodeArray fieldsArray = DBuilder.getOrCreateArray(fields);
- llvm::MDType *type = DBuilder.createStructType(
+ llvm::DIType *type = DBuilder.createStructType(
tunit, typeName.str(), tunit, line,
CGM.getContext().toBits(block.BlockSize),
CGM.getContext().toBits(block.BlockAlign), 0, nullptr, fieldsArray);
type = DBuilder.createPointerType(type, CGM.PointerWidthInBits);
// Get overall information about the block.
- unsigned flags = llvm::DebugNode::FlagArtificial;
- auto *scope = cast<llvm::MDLocalScope>(LexicalBlockStack.back());
+ unsigned flags = llvm::DINode::FlagArtificial;
+ auto *scope = cast<llvm::DILocalScope>(LexicalBlockStack.back());
// Create the descriptor for the parameter.
auto *debugVar = DBuilder.createLocalVariable(
@@ -3130,7 +3129,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
/// If D is an out-of-class definition of a static data member of a class, find
/// its corresponding in-class declaration.
-llvm::MDDerivedType *
+llvm::DIDerivedType *
CGDebugInfo::getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D) {
if (!D->isStaticDataMember())
return nullptr;
@@ -3138,27 +3137,27 @@ CGDebugInfo::getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D) {
auto MI = StaticDataMemberCache.find(D->getCanonicalDecl());
if (MI != StaticDataMemberCache.end()) {
assert(MI->second && "Static data member declaration should still exist");
- return cast<llvm::MDDerivedType>(MI->second);
+ return cast<llvm::DIDerivedType>(MI->second);
}
// If the member wasn't found in the cache, lazily construct and add it to the
// type (used when a limited form of the type is emitted).
auto DC = D->getDeclContext();
auto *Ctxt =
- cast<llvm::MDCompositeType>(getContextDescriptor(cast<Decl>(DC)));
+ cast<llvm::DICompositeType>(getContextDescriptor(cast<Decl>(DC)));
return CreateRecordStaticField(D, Ctxt, cast<RecordDecl>(DC));
}
/// Recursively collect all of the member fields of a global anonymous decl and
/// create static variables for them. The first time this is called it needs
/// to be on a union and then from there we can have additional unnamed fields.
-llvm::MDGlobalVariable *CGDebugInfo::CollectAnonRecordDecls(
- const RecordDecl *RD, llvm::MDFile *Unit, unsigned LineNo,
- StringRef LinkageName, llvm::GlobalVariable *Var, llvm::MDScope *DContext) {
- llvm::MDGlobalVariable *GV = nullptr;
+llvm::DIGlobalVariable *CGDebugInfo::CollectAnonRecordDecls(
+ const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
+ StringRef LinkageName, llvm::GlobalVariable *Var, llvm::DIScope *DContext) {
+ llvm::DIGlobalVariable *GV = nullptr;
for (const auto *Field : RD->fields()) {
- llvm::MDType *FieldTy = getOrCreateType(Field->getType(), Unit);
+ llvm::DIType *FieldTy = getOrCreateType(Field->getType(), Unit);
StringRef FieldName = Field->getName();
// Ignore unnamed fields, but recurse into anonymous records.
@@ -3182,8 +3181,8 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
const VarDecl *D) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
// Create global variable debug descriptor.
- llvm::MDFile *Unit = nullptr;
- llvm::MDScope *DContext = nullptr;
+ llvm::DIFile *Unit = nullptr;
+ llvm::DIScope *DContext = nullptr;
unsigned LineNo;
StringRef DeclName, LinkageName;
QualType T;
@@ -3191,7 +3190,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
// Attempt to store one global variable for the declaration - even if we
// emit a lot of fields.
- llvm::MDGlobalVariable *GV = nullptr;
+ llvm::DIGlobalVariable *GV = nullptr;
// If this is an anonymous union then we'll want to emit a global
// variable for each member of the anonymous union so that it's possible
@@ -3215,9 +3214,9 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
llvm::Constant *Init) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
// Create the descriptor for the variable.
- llvm::MDFile *Unit = getOrCreateFile(VD->getLocation());
+ llvm::DIFile *Unit = getOrCreateFile(VD->getLocation());
StringRef Name = VD->getName();
- llvm::MDType *Ty = getOrCreateType(VD->getType(), Unit);
+ llvm::DIType *Ty = getOrCreateType(VD->getType(), Unit);
if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) {
const EnumDecl *ED = cast<EnumDecl>(ECD->getDeclContext());
assert(isa<EnumType>(ED->getTypeForDecl()) && "Enum without EnumType?");
@@ -3242,7 +3241,7 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
return;
}
- llvm::MDScope *DContext =
+ llvm::DIScope *DContext =
getContextDescriptor(dyn_cast<Decl>(VD->getDeclContext()));
auto &GV = DeclCache[VD];
@@ -3253,7 +3252,7 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
true, Init, getOrCreateStaticDataMemberDeclarationOrNull(VarD)));
}
-llvm::MDScope *CGDebugInfo::getCurrentContextDescriptor(const Decl *D) {
+llvm::DIScope *CGDebugInfo::getCurrentContextDescriptor(const Decl *D) {
if (!LexicalBlockStack.empty())
return LexicalBlockStack.back();
return getContextDescriptor(D);
@@ -3276,21 +3275,21 @@ void CGDebugInfo::EmitUsingDecl(const UsingDecl &UD) {
// Emitting one decl is sufficient - debuggers can detect that this is an
// overloaded name & provide lookup for all the overloads.
const UsingShadowDecl &USD = **UD.shadow_begin();
- if (llvm::DebugNode *Target =
+ if (llvm::DINode *Target =
getDeclarationOrDefinition(USD.getUnderlyingDecl()))
DBuilder.createImportedDeclaration(
getCurrentContextDescriptor(cast<Decl>(USD.getDeclContext())), Target,
getLineNumber(USD.getLocation()));
}
-llvm::MDImportedEntity *
+llvm::DIImportedEntity *
CGDebugInfo::EmitNamespaceAlias(const NamespaceAliasDecl &NA) {
if (CGM.getCodeGenOpts().getDebugInfo() < CodeGenOptions::LimitedDebugInfo)
return nullptr;
auto &VH = NamespaceAliasCache[&NA];
if (VH)
- return cast<llvm::MDImportedEntity>(VH);
- llvm::MDImportedEntity *R;
+ return cast<llvm::DIImportedEntity>(VH);
+ llvm::DIImportedEntity *R;
if (const NamespaceAliasDecl *Underlying =
dyn_cast<NamespaceAliasDecl>(NA.getAliasedNamespace()))
// This could cache & dedup here rather than relying on metadata deduping.
@@ -3309,18 +3308,18 @@ CGDebugInfo::EmitNamespaceAlias(const NamespaceAliasDecl &NA) {
/// getOrCreateNamesSpace - Return namespace descriptor for the given
/// namespace decl.
-llvm::MDNamespace *
+llvm::DINamespace *
CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) {
NSDecl = NSDecl->getCanonicalDecl();
auto I = NameSpaceCache.find(NSDecl);
if (I != NameSpaceCache.end())
- return cast<llvm::MDNamespace>(I->second);
+ return cast<llvm::DINamespace>(I->second);
unsigned LineNo = getLineNumber(NSDecl->getLocation());
- llvm::MDFile *FileD = getOrCreateFile(NSDecl->getLocation());
- llvm::MDScope *Context =
+ llvm::DIFile *FileD = getOrCreateFile(NSDecl->getLocation());
+ llvm::DIScope *Context =
getContextDescriptor(dyn_cast<Decl>(NSDecl->getDeclContext()));
- llvm::MDNamespace *NS =
+ llvm::DINamespace *NS =
DBuilder.createNameSpace(Context, NSDecl->getName(), FileD, LineNo);
NameSpaceCache[NSDecl].reset(NS);
return NS;
@@ -3331,23 +3330,23 @@ void CGDebugInfo::finalize() {
// element and the size(), so don't cache/reference them.
for (size_t i = 0; i != ObjCInterfaceCache.size(); ++i) {
ObjCInterfaceCacheEntry E = ObjCInterfaceCache[i];
- llvm::MDType *Ty = E.Type->getDecl()->getDefinition()
+ llvm::DIType *Ty = E.Type->getDecl()->getDefinition()
? CreateTypeDefinition(E.Type, E.Unit)
: E.Decl;
- DBuilder.replaceTemporary(llvm::TempMDType(E.Decl), Ty);
+ DBuilder.replaceTemporary(llvm::TempDIType(E.Decl), Ty);
}
for (auto p : ReplaceMap) {
assert(p.second);
- auto *Ty = cast<llvm::MDType>(p.second);
+ auto *Ty = cast<llvm::DIType>(p.second);
assert(Ty->isForwardDecl());
auto it = TypeCache.find(p.first);
assert(it != TypeCache.end());
assert(it->second);
- DBuilder.replaceTemporary(llvm::TempMDType(Ty),
- cast<llvm::MDType>(it->second));
+ DBuilder.replaceTemporary(llvm::TempDIType(Ty),
+ cast<llvm::DIType>(it->second));
}
for (const auto &p : FwdDeclReplaceMap) {
@@ -3371,7 +3370,7 @@ void CGDebugInfo::finalize() {
// up the final type in the type cache.
for (std::vector<void *>::const_iterator RI = RetainedTypes.begin(),
RE = RetainedTypes.end(); RI != RE; ++RI)
- DBuilder.retainType(cast<llvm::MDType>(TypeCache[*RI]));
+ DBuilder.retainType(cast<llvm::DIType>(TypeCache[*RI]));
DBuilder.finalize();
}
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 19d8c7bdbbd..8509e0770db 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -52,30 +52,30 @@ class CGDebugInfo {
CodeGenModule &CGM;
const CodeGenOptions::DebugInfoKind DebugKind;
llvm::DIBuilder DBuilder;
- llvm::MDCompileUnit *TheCU = nullptr;
+ llvm::DICompileUnit *TheCU = nullptr;
SourceLocation CurLoc;
- llvm::MDType *VTablePtrType = nullptr;
- llvm::MDType *ClassTy = nullptr;
- llvm::MDCompositeType *ObjTy = nullptr;
- llvm::MDType *SelTy = nullptr;
- llvm::MDType *OCLImage1dDITy = nullptr;
- llvm::MDType *OCLImage1dArrayDITy = nullptr;
- llvm::MDType *OCLImage1dBufferDITy = nullptr;
- llvm::MDType *OCLImage2dDITy = nullptr;
- llvm::MDType *OCLImage2dArrayDITy = nullptr;
- llvm::MDType *OCLImage3dDITy = nullptr;
- llvm::MDType *OCLEventDITy = nullptr;
- llvm::MDType *BlockLiteralGeneric = nullptr;
+ llvm::DIType *VTablePtrType = nullptr;
+ llvm::DIType *ClassTy = nullptr;
+ llvm::DICompositeType *ObjTy = nullptr;
+ llvm::DIType *SelTy = nullptr;
+ llvm::DIType *OCLImage1dDITy = nullptr;
+ llvm::DIType *OCLImage1dArrayDITy = nullptr;
+ llvm::DIType *OCLImage1dBufferDITy = nullptr;
+ llvm::DIType *OCLImage2dDITy = nullptr;
+ llvm::DIType *OCLImage2dArrayDITy = nullptr;
+ llvm::DIType *OCLImage3dDITy = nullptr;
+ llvm::DIType *OCLEventDITy = nullptr;
+ llvm::DIType *BlockLiteralGeneric = nullptr;
/// \brief Cache of previously constructed Types.
llvm::DenseMap<const void *, llvm::TrackingMDRef> TypeCache;
struct ObjCInterfaceCacheEntry {
const ObjCInterfaceType *Type;
- llvm::MDType *Decl;
- llvm::MDFile *Unit;
- ObjCInterfaceCacheEntry(const ObjCInterfaceType *Type, llvm::MDType *Decl,
- llvm::MDFile *Unit)
+ llvm::DIType *Decl;
+ llvm::DIFile *Unit;
+ ObjCInterfaceCacheEntry(const ObjCInterfaceType *Type, llvm::DIType *Decl,
+ llvm::DIFile *Unit)
: Type(Type), Decl(Decl), Unit(Unit) {}
};
@@ -96,7 +96,7 @@ class CGDebugInfo {
FwdDeclReplaceMap;
// LexicalBlockStack - Keep track of our current nested lexical block.
- std::vector<llvm::TypedTrackingMDRef<llvm::MDScope>> LexicalBlockStack;
+ std::vector<llvm::TypedTrackingMDRef<llvm::DIScope>> LexicalBlockStack;
llvm::DenseMap<const Decl *, llvm::TrackingMDRef> RegionMap;
// FnBeginRegionCount - Keep track of LexicalBlockStack counter at the
// beginning of a function. This is used to pop unbalanced regions at
@@ -120,94 +120,94 @@ class CGDebugInfo {
/// Helper functions for getOrCreateType.
unsigned Checksum(const ObjCInterfaceDecl *InterfaceDecl);
- llvm::MDType *CreateType(const BuiltinType *Ty);
- llvm::MDType *CreateType(const ComplexType *Ty);
- llvm::MDType *CreateQualifiedType(QualType Ty, llvm::MDFile *Fg);
- llvm::MDType *CreateType(const TypedefType *Ty, llvm::MDFile *Fg);
- llvm::MDType *CreateType(const TemplateSpecializationType *Ty,
- llvm::MDFile *Fg);
- llvm::MDType *CreateType(const ObjCObjectPointerType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const PointerType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const BlockPointerType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const FunctionType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const RecordType *Tyg);
- llvm::MDType *CreateTypeDefinition(const RecordType *Ty);
- llvm::MDCompositeType *CreateLimitedType(const RecordType *Ty);
+ llvm::DIType *CreateType(const BuiltinType *Ty);
+ llvm::DIType *CreateType(const ComplexType *Ty);
+ llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg);
+ llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg);
+ llvm::DIType *CreateType(const TemplateSpecializationType *Ty,
+ llvm::DIFile *Fg);
+ llvm::DIType *CreateType(const ObjCObjectPointerType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const PointerType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const BlockPointerType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const FunctionType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const RecordType *Tyg);
+ llvm::DIType *CreateTypeDefinition(const RecordType *Ty);
+ llvm::DICompositeType *CreateLimitedType(const RecordType *Ty);
void CollectContainingType(const CXXRecordDecl *RD,
- llvm::MDCompositeType *CT);
- llvm::MDType *CreateType(const ObjCInterfaceType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateTypeDefinition(const ObjCInterfaceType *Ty,
- llvm::MDFile *F);
- llvm::MDType *CreateType(const ObjCObjectType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const VectorType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const ArrayType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const LValueReferenceType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const RValueReferenceType *Ty, llvm::MDFile *Unit);
- llvm::MDType *CreateType(const MemberPointerType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateType(const AtomicType *Ty, llvm::MDFile *F);
- llvm::MDType *CreateEnumType(const EnumType *Ty);
- llvm::MDType *CreateTypeDefinition(const EnumType *Ty);
- llvm::MDType *CreateSelfType(const QualType &QualTy, llvm::MDType *Ty);
- llvm::MDType *getTypeOrNull(const QualType);
- llvm::MDSubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method,
- llvm::MDFile *F);
- llvm::MDSubroutineType *
+ llvm::DICompositeType *CT);
+ llvm::DIType *CreateType(const ObjCInterfaceType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateTypeDefinition(const ObjCInterfaceType *Ty,
+ llvm::DIFile *F);
+ llvm::DIType *CreateType(const ObjCObjectType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const VectorType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const ArrayType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const LValueReferenceType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const RValueReferenceType *Ty, llvm::DIFile *Unit);
+ llvm::DIType *CreateType(const MemberPointerType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateType(const AtomicType *Ty, llvm::DIFile *F);
+ llvm::DIType *CreateEnumType(const EnumType *Ty);
+ llvm::DIType *CreateTypeDefinition(const EnumType *Ty);
+ llvm::DIType *CreateSelfType(const QualType &QualTy, llvm::DIType *Ty);
+ llvm::DIType *getTypeOrNull(const QualType);
+ llvm::DISubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method,
+ llvm::DIFile *F);
+ llvm::DISubroutineType *
getOrCreateInstanceMethodType(QualType ThisPtr, const FunctionProtoType *Func,
- llvm::MDFile *Unit);
- llvm::MDSubroutineType *
- getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::MDFile *F);
- llvm::MDType *getOrCreateVTablePtrType(llvm::MDFile *F);
- llvm::MDNamespace *getOrCreateNameSpace(const NamespaceDecl *N);
- llvm::MDType *getOrCreateTypeDeclaration(QualType PointeeTy, llvm::MDFile *F);
- llvm::MDType *CreatePointerLikeType(llvm::dwarf::Tag Tag, const Type *Ty,
- QualType PointeeTy, llvm::MDFile *F);
+ llvm::DIFile *Unit);
+ llvm::DISubroutineType *
+ getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F);
+ llvm::DIType *getOrCreateVTablePtrType(llvm::DIFile *F);
+ llvm::DINamespace *getOrCreateNameSpace(const NamespaceDecl *N);
+ llvm::DIType *getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile *F);
+ llvm::DIType *CreatePointerLikeType(llvm::dwarf::Tag Tag, const Type *Ty,
+ QualType PointeeTy, llvm::DIFile *F);
llvm::Value *getCachedInterfaceTypeOrNull(const QualType Ty);
- llvm::MDType *getOrCreateStructPtrType(StringRef Name, llvm::MDType *&Cache);
+ llvm::DIType *getOrCreateStructPtrType(StringRef Name, llvm::DIType *&Cache);
- llvm::MDSubprogram *CreateCXXMemberFunction(const CXXMethodDecl *Method,
- llvm::MDFile *F,
- llvm::MDType *RecordTy);
+ llvm::DISubprogram *CreateCXXMemberFunction(const CXXMethodDecl *Method,
+ llvm::DIFile *F,
+ llvm::DIType *RecordTy);
- void CollectCXXMemberFunctions(const CXXRecordDecl *Decl, llvm::MDFile *F,
+ void CollectCXXMemberFunctions(const CXXRecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl<llvm::Metadata *> &E,
- llvm::MDType *T);
+ llvm::DIType *T);
- void CollectCXXBases(const CXXRecordDecl *Decl, llvm::MDFile *F,
+ void CollectCXXBases(const CXXRecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl<llvm::Metadata *> &EltTys,
- llvm::MDType *RecordTy);
-
- llvm::DebugNodeArray
- CollectTemplateParams(const TemplateParameterList *TPList,
- ArrayRef<TemplateArgument> TAList, llvm::MDFile *Unit);
- llvm::DebugNodeArray CollectFunctionTemplateParams(const FunctionDecl *FD,
- llvm::MDFile *Unit);
- llvm::DebugNodeArray
+ llvm::DIType *RecordTy);
+
+ llvm::DINodeArray CollectTemplateParams(const TemplateParameterList *TPList,
+ ArrayRef<TemplateArgument> TAList,
+ llvm::DIFile *Unit);
+ llvm::DINodeArray CollectFunctionTemplateParams(const FunctionDecl *FD,
+ llvm::DIFile *Unit);
+ llvm::DINodeArray
CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS,
- llvm::MDFile *F);
+ llvm::DIFile *F);
- llvm::MDType *createFieldType(StringRef name, QualType type,
+ llvm::DIType *createFieldType(StringRef name, QualType type,
uint64_t sizeInBitsOverride, SourceLocation loc,
AccessSpecifier AS, uint64_t offsetInBits,
- llvm::MDFile *tunit, llvm::MDScope *scope,
+ llvm::DIFile *tunit, llvm::DIScope *scope,
const RecordDecl *RD = nullptr);
// Helpers for collecting fields of a record.
void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
SmallVectorImpl<llvm::Metadata *> &E,
- llvm::MDType *RecordTy);
- llvm::MDDerivedType *CreateRecordStaticField(const VarDecl *Var,
- llvm::MDType *RecordTy,
+ llvm::DIType *RecordTy);
+ llvm::DIDerivedType *CreateRecordStaticField(const VarDecl *Var,
+ llvm::DIType *RecordTy,
const RecordDecl *RD);
void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits,
- llvm::MDFile *F,
+ llvm::DIFile *F,
SmallVectorImpl<llvm::Metadata *> &E,
- llvm::MDType *RecordTy, const RecordDecl *RD);
- void CollectRecordFields(const RecordDecl *Decl, llvm::MDFile *F,
+ llvm::DIType *RecordTy, const RecordDecl *RD);
+ void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl<llvm::Metadata *> &E,
- llvm::MDCompositeType *RecordTy);
+ llvm::DICompositeType *RecordTy);
- void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::MDFile *F,
+ void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl<llvm::Metadata *> &EltTys);
// CreateLexicalBlock - Create a new lexical block node and push it on
@@ -290,14 +290,14 @@ public:
void EmitUsingDecl(const UsingDecl &UD);
/// \brief Emit C++ namespace alias.
- llvm::MDImportedEntity *EmitNamespaceAlias(const NamespaceAliasDecl &NA);
+ llvm::DIImportedEntity *EmitNamespaceAlias(const NamespaceAliasDecl &NA);
/// \brief Emit record type's standalone debug info.
- llvm::MDType *getOrCreateRecordType(QualType Ty, SourceLocation L);
+ llvm::DIType *getOrCreateRecordType(QualType Ty, SourceLocation L);
/// \brief Emit an objective c interface type standalone
/// debug info.
- llvm::MDType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc);
+ llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc);
void completeType(const EnumDecl *ED);
void completeType(const RecordDecl *RD);
@@ -315,17 +315,17 @@ private:
// EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
// See BuildByRefType.
- llvm::MDType *EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
+ llvm::DIType *EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
uint64_t *OffSet);
/// \brief Get context info for the decl.
- llvm::MDScope *getContextDescriptor(const Decl *Decl);
+ llvm::DIScope *getContextDescriptor(const Decl *Decl);
- llvm::MDScope *getCurrentContextDescriptor(const Decl *Decl);
+ llvm::DIScope *getCurrentContextDescriptor(const Decl *Decl);
/// \brief Create a forward decl for a RecordType in a given context.
- llvm::MDCompositeType *getOrCreateRecordFwdDecl(const RecordType *,
- llvm::MDScope *);
+ llvm::DICompositeType *getOrCreateRecordFwdDecl(const RecordType *,
+ llvm::DIScope *);
/// \brief Return current directory name.
StringRef getCurrentDirname();
@@ -335,58 +335,58 @@ private:
/// \brief Get the file debug info descriptor for the input
/// location.
- llvm::MDFile *getOrCreateFile(SourceLocation Loc);
+ llvm::DIFile *getOrCreateFile(SourceLocation Loc);
/// \brief Get the file info for main compile unit.
- llvm::MDFile *getOrCreateMainFile();
+ llvm::DIFile *getOrCreateMainFile();
/// \brief Get the type from the cache or create a new type if
/// necessary.
- llvm::MDType *getOrCreateType(QualType Ty, llvm::MDFile *Fg);
+ llvm::DIType *getOrCreateType(QualType Ty, llvm::DIFile *Fg);
/// \brief Get the type from the cache or create a new
/// partial type if necessary.
- llvm::MDType *getOrCreateLimitedType(const RecordType *Ty, llvm::MDFile *F);
+ llvm::DIType *getOrCreateLimitedType(const RecordType *Ty, llvm::DIFile *F);
/// \brief Create type metadata for a source language type.
- llvm::MDType *CreateTypeNode(QualType Ty, llvm::MDFile *Fg);
+ llvm::DIType *CreateTypeNode(QualType Ty, llvm::DIFile *Fg);
/// \brief return the underlying ObjCInterfaceDecl
/// if Ty is an ObjCInterface or a pointer to one.
ObjCInterfaceDecl* getObjCInterfaceDecl(QualType Ty);
/// \brief Create new member and increase Offset by FType's size.
- llvm::MDType *CreateMemberType(llvm::MDFile *Unit, QualType FType,
+ llvm::DIType *CreateMemberType(llvm::DIFile *Unit, QualType FType,
StringRef Name, uint64_t *Offset);
/// \brief Retrieve the DIDescriptor, if any, for the canonical form of this
/// declaration.
- llvm::DebugNode *getDeclarationOrDefinition(const Decl *D);
+ llvm::DINode *getDeclarationOrDefinition(const Decl *D);
/// \brief Return debug info descriptor to describe method
/// declaration for the given method definition.
- llvm::MDSubprogram *getFunctionDeclaration(const Decl *D);
+ llvm::DISubprogram *getFunctionDeclaration(const Decl *D);
/// Return debug info descriptor to describe in-class static data member
/// declaration for the given out-of-class definition.
- llvm::MDDerivedType *
+ llvm::DIDerivedType *
getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D);
/// \brief Create a subprogram describing the forward
/// decalration represented in the given FunctionDecl.
- llvm::MDSubprogram *getFunctionForwardDeclaration(const FunctionDecl *FD);
+ llvm::DISubprogram *getFunctionForwardDeclaration(const FunctionDecl *FD);
/// \brief Create a global variable describing the forward decalration
/// represented in the given VarDecl.
- llvm::MDGlobalVariable *
+ llvm::DIGlobalVariable *
getGlobalVariableForwardDeclaration(const VarDecl *VD);
/// Return a global variable that represents one of the collection of
/// global variables created for an anonmyous union.
- llvm::MDGlobalVariable *
- CollectAnonRecordDecls(const RecordDecl *RD, llvm::MDFile *Unit,
+ llvm::DIGlobalVariable *
+ CollectAnonRecordDecls(const RecordDecl *RD, llvm::DIFile *Unit,
unsigned LineNo, StringRef LinkageName,
- llvm::GlobalVariable *Var, llvm::MDScope *DContext);
+ llvm::GlobalVariable *Var, llvm::DIScope *DContext);
/// \brief Get function name for the given FunctionDecl. If the
/// name is constructed on demand (e.g. C++ destructor) then the name
@@ -418,16 +418,16 @@ private:
/// \brief Collect various properties of a FunctionDecl.
/// \param GD A GlobalDecl whose getDecl() must return a FunctionDecl.
- void collectFunctionDeclProps(GlobalDecl GD, llvm::MDFile *Unit,
+ void collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
StringRef &Name, StringRef &LinkageName,
- llvm::MDScope *&FDContext,
- llvm::DebugNodeArray &TParamsArray,
+ llvm::DIScope *&FDContext,
+ llvm::DINodeArray &TParamsArray,
unsigned &Flags);
/// \brief Collect various properties of a VarDecl.
- void collectVarDeclProps(const VarDecl *VD, llvm::MDFile *&Unit,
+ void collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
unsigned &LineNo, QualType &T, StringRef &Name,
- StringRef &LinkageName, llvm::MDScope *&VDContext);
+ StringRef &LinkageName, llvm::DIScope *&VDContext);
/// \brief Allocate a copy of \p A using the DebugInfoNames allocator
/// and return a reference to it. If multiple arguments are given the strings
OpenPOWER on IntegriCloud