diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-09-06 18:27:00 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-09-06 18:27:00 +0000 |
commit | 5930eabe0fdc48c02c5af500aa5b1c5b732848b1 (patch) | |
tree | 5e40e3fa4a6139447f8372b585de3379cc4a0e3a /lib/IR/DebugInfo.cpp | |
parent | 28da141d44cd67b96085d7bb0ae7dfac554a0c10 (diff) | |
download | external_llvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.zip external_llvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.tar.gz external_llvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.tar.bz2 |
Debug Info: Move a helper function getTypeIdentifier from DIBuilder to be part
of DIType.
Implement DIType::generateRef to return a type reference. This function will be
used in setContaintingType and in DIBuilder to generete the type reference.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DebugInfo.cpp')
-rw-r--r-- | lib/IR/DebugInfo.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index d3207ca..70b4257 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -707,6 +707,17 @@ void DICompositeType::addMember(DIDescriptor D) { setTypeArray(DIArray(MDNode::get(DbgNode->getContext(), M))); } +/// Generate a reference to this DIType. Uses the type identifier instead +/// of the actual MDNode if possible, to help type uniquing. +DITypeRef DIType::generateRef() { + if (!isCompositeType()) + return DITypeRef(*this); + DICompositeType DTy(DbgNode); + if (!DTy.getIdentifier()) + return DITypeRef(*this); + return DITypeRef(DTy.getIdentifier()); +} + /// \brief Set the containing type. void DICompositeType::setContainingType(DICompositeType ContainingType) { TrackingVH<MDNode> N(*this); |