summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-16 01:53:33 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-16 01:53:33 +0000
commitf15c6f803268e880d3673e8b1a6dfee87982454e (patch)
tree9ddfd12a9bbb5468d22152e9b0aa356fabe18be1 /llvm/lib
parent526ab07e3c07a6e130e797033a616953576c8830 (diff)
downloadbcm5719-llvm-f15c6f803268e880d3673e8b1a6dfee87982454e.tar.gz
bcm5719-llvm-f15c6f803268e880d3673e8b1a6dfee87982454e.zip
DebugInfo: Gut DIDescriptor
PR23080 is almost finished. With this commit, there's no consequential API in `DIDescriptor` and its subclasses. What's left? - Default-constructed to `nullptr`. - Handy `const_cast<>` (constructed from `const`, but accessors are non-`const`). I think the safe way to catch those is to delete the classes and fix compile errors. That'll be my next step, after I delete the `DITypeRef` (etc.) wrapper around `MDTypeRef`. llvm-svn: 235069
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp7
-rw-r--r--llvm/lib/IR/DIBuilder.cpp8
-rw-r--r--llvm/lib/IR/DebugInfo.cpp15
3 files changed, 8 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 46f3eb3201d..91546529877 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1405,9 +1405,10 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) {
// Add subranges to array type.
DIArray Elements = CTy->getElements();
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
- DIDescriptor Element = Elements[i];
- if (Element.getTag() == dwarf::DW_TAG_subrange_type)
- constructSubrangeDIE(Buffer, cast<MDSubrange>(Element), IdxTy);
+ // FIXME: Should this really be such a loose cast?
+ if (auto *Element = dyn_cast_or_null<DebugNode>(Elements[i]))
+ if (Element->getTag() == dwarf::DW_TAG_subrange_type)
+ constructSubrangeDIE(Buffer, cast<MDSubrange>(Element), IdxTy);
}
}
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 893f9f29548..67aa09a14a1 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -203,7 +203,7 @@ DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
// types that have one.
return ::createImportedModule(
VMContext, dwarf::DW_TAG_imported_declaration, Context,
- DebugNodeRef::get(cast_or_null<DebugNode>(Decl.get())), Line, Name,
+ DebugNodeRef::get(cast_or_null<DebugNode>(Decl)), Line, Name,
AllImportedModules);
}
@@ -318,7 +318,7 @@ DIDerivedType DIBuilder::createStaticMemberType(DIDescriptor Scope,
unsigned Flags,
llvm::Constant *Val) {
// TAG_member is encoded in DIDerivedType format.
- Flags |= DIDescriptor::FlagStaticMember;
+ Flags |= DebugNode::FlagStaticMember;
return MDDerivedType::get(
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
MDScopeRef::get(DIScope(getNonCompileUnitScope(Scope))),
@@ -529,8 +529,8 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
DICompositeType RetTy = MDCompositeType::get(
VMContext, Tag, Name, F, Line,
MDScopeRef::get(DIScope(getNonCompileUnitScope(Scope))), nullptr,
- SizeInBits, AlignInBits, 0, DIDescriptor::FlagFwdDecl, nullptr,
- RuntimeLang, nullptr, nullptr, UniqueIdentifier);
+ SizeInBits, AlignInBits, 0, DebugNode::FlagFwdDecl, nullptr, RuntimeLang,
+ nullptr, nullptr, UniqueIdentifier);
if (!UniqueIdentifier.empty())
retainType(RetTy);
trackIfUnresolved(RetTy);
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index d3388cbabef..d877325b1f1 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -307,21 +307,6 @@ bool DebugInfoFinder::addScope(DIScope Scope) {
return true;
}
-//===----------------------------------------------------------------------===//
-// DIDescriptor: dump routines for all descriptors.
-//===----------------------------------------------------------------------===//
-
-void DIDescriptor::dump() const {
- print(dbgs());
- dbgs() << '\n';
-}
-
-void DIDescriptor::print(raw_ostream &OS) const {
- if (!get())
- return;
- get()->print(OS);
-}
-
template <>
DIDescriptor
DIRef<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const {
OpenPOWER on IntegriCloud