Emit new property tag.
authorDevang Patel <dpatel@apple.com>
Sat, 4 Feb 2012 01:30:32 +0000 (01:30 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 4 Feb 2012 01:30:32 +0000 (01:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

index 99b6bfc5f35a7e852631c1c33cd82eaffcd0bd74..f95ba3c93fc02caf95700d3b7a00143dd4a72c4b 100644 (file)
@@ -824,7 +824,34 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
         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 @@ DIE *CompileUnit::createMemberDIE(DIDerivedType DT) {
             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);