summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-09-06 18:27:00 +0000
committerManman Ren <manman.ren@gmail.com>2013-09-06 18:27:00 +0000
commit277206fa282715dcd3b62800b46be574b96f7dbb (patch)
treebe21d2634cd1b731228f1a6c8f4a63739e91b488 /llvm/lib/IR/DebugInfo.cpp
parent4c12bf5ac724f46bdf1dde7db6c44ca1767869d4 (diff)
downloadbcm5719-llvm-277206fa282715dcd3b62800b46be574b96f7dbb.tar.gz
bcm5719-llvm-277206fa282715dcd3b62800b46be574b96f7dbb.zip
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. llvm-svn: 190188
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index d3207cae350..70b4257caeb 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud