Emit new property tag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149737 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 99b6bfc..f95ba3c 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -824,7 +824,34 @@
         addSourceLine(ElemDie, DV);
       } else if (Element.isDerivedType())
         ElemDie = createMemberDIE(DIDerivedType(Element));
-      else
+      else if (Element.isObjCProperty()) {
+	DIObjCProperty Property(Element);
+	ElemDie = new DIE(Property.getTag());
+	StringRef PropertyName = Property.getObjCPropertyName();
+	addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
+	StringRef GetterName = Property.getObjCPropertyGetterName();
+	if (!GetterName.empty())
+	  addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
+	StringRef SetterName = Property.getObjCPropertySetterName();
+	if (!SetterName.empty())
+	  addString(ElemDie, dwarf::DW_AT_APPLE_property_setter, SetterName);
+	unsigned PropertyAttributes = 0;
+        if (Property.isReadOnlyObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_readonly;
+        if (Property.isReadWriteObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_readwrite;
+        if (Property.isAssignObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_assign;
+        if (Property.isRetainObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_retain;
+        if (Property.isCopyObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_copy;
+        if (Property.isNonAtomicObjCProperty())
+          PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_nonatomic;
+        if (PropertyAttributes)
+          addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, 0, 
+                 PropertyAttributes);
+      } else
         continue;
       Buffer.addChild(ElemDie);
     }
@@ -1428,6 +1455,7 @@
             dwarf::DW_VIRTUALITY_virtual);
 
   // Objective-C properties.
+  // This is only for backward compatibility.
   StringRef PropertyName = DT.getObjCPropertyName();
   if (!PropertyName.empty()) {
     addString(MemberDie, dwarf::DW_AT_APPLE_property_name, PropertyName);