diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-16 01:01:28 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-16 01:01:28 +0000 |
commit | b105564015292c933c6e0dab6bb027ed9c1580a5 (patch) | |
tree | 9e6debd9480cf75e2b8f818ed35f501e272c942d /llvm/lib/IR/DIBuilder.cpp | |
parent | 4caa7f2a9c9a54ad37960218c49fc853df01434c (diff) | |
download | llvm-b105564015292c933c6e0dab6bb027ed9c1580a5.zip llvm-b105564015292c933c6e0dab6bb027ed9c1580a5.tar.gz llvm-b105564015292c933c6e0dab6bb027ed9c1580a5.tar.bz2 |
DebugInfo: Gut DIType and subclasses
Continuing PR23080, gut `DIType` and its various subclasses, leaving
behind thin wrappers around the pointer types in the new debug info
hierarchy.
llvm-svn: 235064
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 49358d6..067a7ee 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -487,7 +487,7 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, auto *R = MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0, - DIType::FlagVector, Subscripts, 0, nullptr); + DebugNode::FlagVector, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; } @@ -501,27 +501,25 @@ static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty, DIType DIBuilder::createArtificialType(DIType Ty) { // FIXME: Restrict this to the nodes where it's valid. - if (Ty.isArtificial()) + if (Ty->isArtificial()) return Ty; - return createTypeWithFlags(VMContext, Ty, DIType::FlagArtificial); + return createTypeWithFlags(VMContext, Ty, DebugNode::FlagArtificial); } DIType DIBuilder::createObjectPointerType(DIType Ty) { // FIXME: Restrict this to the nodes where it's valid. - if (Ty.isObjectPointer()) + if (Ty->isObjectPointer()) return Ty; - unsigned Flags = DIType::FlagObjectPointer | DIType::FlagArtificial; + unsigned Flags = DebugNode::FlagObjectPointer | DebugNode::FlagArtificial; return createTypeWithFlags(VMContext, Ty, Flags); } void DIBuilder::retainType(DIType T) { - assert(T.get() && "Expected non-null type"); + assert(T && "Expected non-null type"); AllRetainTypes.emplace_back(T); } -DIBasicType DIBuilder::createUnspecifiedParameter() { - return DIBasicType(); -} +DIBasicType DIBuilder::createUnspecifiedParameter() { return nullptr; } DICompositeType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope, @@ -579,9 +577,9 @@ DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) { static void checkGlobalVariableScope(DIDescriptor Context) { #ifndef NDEBUG - if (DICompositeType CT = + if (auto *CT = dyn_cast_or_null<MDCompositeType>(getNonCompileUnitScope(Context))) - assert(!CT.getIdentifier() && + assert(CT->getIdentifier().empty() && "Context of a global variable should not be a type with identifier"); #endif } @@ -675,11 +673,11 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name, unsigned ScopeLine, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParams, MDNode *Decl) { - assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type && + assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && "function types should be subroutines"); auto *Node = MDSubprogram::get( VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), - Name, LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty.get()), + Name, LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty), isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl), MDTuple::getTemporary(VMContext, None).release()); @@ -701,11 +699,10 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name, return MDSubprogram::getTemporary( VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), Name, - LinkageName, File, LineNo, - cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, - isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn, - cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl), - nullptr) + LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty), + isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, + isOptimized, Fn, cast_or_null<MDTuple>(TParams), + cast_or_null<MDSubprogram>(Decl), nullptr) .release(); } @@ -717,7 +714,7 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name, DIType VTableHolder, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParam) { - assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type && + assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && "function types should be subroutines"); assert(getNonCompileUnitScope(Context) && "Methods should have both a Context and a context that isn't " @@ -725,9 +722,9 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name, // FIXME: Do we want to use different scope/lines? auto *SP = MDSubprogram::get( VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F, - LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, - isDefinition, LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags, - isOptimized, Fn, cast_or_null<MDTuple>(TParam), nullptr, nullptr); + LineNo, cast_or_null<MDSubroutineType>(Ty), isLocalToUnit, isDefinition, + LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn, + cast_or_null<MDTuple>(TParam), nullptr, nullptr); if (isDefinition) AllSubprograms.push_back(SP); |