DebugInfo: Provide a new hook to encode relationship between a property and an ivar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149874 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index f95ba3c..f55dd1f 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -851,6 +851,12 @@
         if (PropertyAttributes)
           addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, 0, 
                  PropertyAttributes);
+
+	DIEEntry *Entry = getDIEEntry(Element);
+	if (!Entry) {
+	  Entry = createDIEEntry(ElemDie);
+	  insertDIEEntry(Element, Entry);
+	}
       } else
         continue;
       Buffer.addChild(ElemDie);
@@ -1455,6 +1461,11 @@
             dwarf::DW_VIRTUALITY_virtual);
 
   // Objective-C properties.
+  if (MDNode *PNode = DT.getObjCProperty())
+    if (DIEEntry *PropertyDie = getDIEEntry(PNode))
+      MemberDie->addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4, 
+                          PropertyDie);
+
   // This is only for backward compatibility.
   StringRef PropertyName = DT.getObjCPropertyName();
   if (!PropertyName.empty()) {