diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-06 22:27:37 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-06 22:27:37 +0000 |
commit | 5bf3cdc566dfd2a653aa1342a850a7bd3d451677 (patch) | |
tree | f470382d6205f993c615d207516afb7407c13522 /llvm/lib/IR/DebugInfo.cpp | |
parent | 4e25cfa167ea1768e6866ae8040b4afc4ac87719 (diff) | |
download | bcm5719-llvm-5bf3cdc566dfd2a653aa1342a850a7bd3d451677.tar.gz bcm5719-llvm-5bf3cdc566dfd2a653aa1342a850a7bd3d451677.zip |
DebugInfo: Reimplement DIRef<>::resolve() using TypedDebugNodeRef<>
Gut `DIRef<>::resolve()`, reimplementing it using
`TypedDebugNodeRef<>::resolve()`. Use three separate functions rather
than some sort of type traits, since the latter (i.e., mapping `DIScope`
=> `MDScope`) seems heavy-handed. I don't expect `DIRef<>` to last much
longer in tree anyway.
As a drive-by fix, make `TypedDebugNodeRef<>::resolve()` do the right
thing with `nullptr`.
llvm-svn: 234248
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 8ae2bcb8485..721fbc8c3a0 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -685,6 +685,20 @@ template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const { return DITypeRef(cast_or_null<Metadata>(getField(DbgNode, Elt))); } +template <> +DIDescriptor +DIRef<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const { + return DIDescriptor(DebugNodeRef(Val).resolve(Map)); +} +template <> +DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const { + return MDScopeRef(Val).resolve(Map); +} +template <> +DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const { + return MDTypeRef(Val).resolve(Map); +} + bool llvm::stripDebugInfo(Function &F) { bool Changed = false; for (BasicBlock &BB : F) { |