[cfe-commits] r140038 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenObjC/debug-info-property2.m

Devang Patel dpatel at apple.com
Mon Sep 19 11:54:16 PDT 2011


Author: dpatel
Date: Mon Sep 19 13:54:16 2011
New Revision: 140038

URL: http://llvm.org/viewvc/llvm-project?rev=140038&view=rev
Log:
Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

Added:
    cfe/trunk/test/CodeGenObjC/debug-info-property2.m
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=140038&r1=140037&r2=140038&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 19 13:54:16 2011
@@ -1194,7 +1194,7 @@
   }
 
   const ASTRecordLayout &RL = CGM.getContext().getASTObjCInterfaceLayout(ID);
-
+  ObjCImplementationDecl *ImpD = ID->getImplementation();
   unsigned FieldNo = 0;
   for (ObjCIvarDecl *Field = ID->all_declared_ivar_begin(); Field;
        Field = Field->getNextIvar(), ++FieldNo) {
@@ -1238,13 +1238,17 @@
     StringRef PropertyGetter;
     StringRef PropertySetter;
     unsigned PropertyAttributes = 0;
-    if (ObjCPropertyDecl *PD =
-        ID->FindPropertyVisibleInPrimaryClass(Field->getIdentifier())) {
+    ObjCPropertyDecl *PD = NULL;
+    if (ImpD)
+      if (ObjCPropertyImplDecl *PImpD = 
+	  ImpD->FindPropertyImplIvarDecl(Field->getIdentifier()))
+	PD = PImpD->getPropertyDecl();
+    if (PD) {
       PropertyName = PD->getName();
       PropertyGetter = getSelectorName(PD->getGetterName());
       PropertySetter = getSelectorName(PD->getSetterName());
       PropertyAttributes = PD->getPropertyAttributes();
-    }
+    } 
     FieldTy = DBuilder.createObjCIVar(FieldName, FieldDefUnit,
                                       FieldLine, FieldSize, FieldAlign,
                                       FieldOffset, Flags, FieldTy,

Added: cfe/trunk/test/CodeGenObjC/debug-info-property2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-property2.m?rev=140038&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-property2.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-property2.m Mon Sep 19 13:54:16 2011
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s
+
+// CHECK: AT_APPLE_property_name
+ at interface C {
+  int _base;
+}
+ at property int base;
+ at end
+
+ at implementation C
+ at synthesize base = _base;
+ at end
+
+void foo(C *cptr) {}





More information about the cfe-commits mailing list