From: Eric Christopher Date: Thu, 5 Apr 2012 22:03:32 +0000 (+0000) Subject: Only emit the getter and setter names if they're not the default X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78af8fd568f05aa872194756c96d8ba73d8c4956;p=clang Only emit the getter and setter names if they're not the default synthesized ones. Reasonable debug info size reduction for objc. rdar://11179756 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154129 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 9a33ade99b..587ab8a357 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1327,10 +1327,14 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, SourceLocation Loc = PD->getLocation(); llvm::DIFile PUnit = getOrCreateFile(Loc); unsigned PLine = getLineNumber(Loc); + ObjCMethodDecl *Getter = PD->getGetterMethodDecl(); + ObjCMethodDecl *Setter = PD->getSetterMethodDecl(); llvm::MDNode *PropertyNode = DBuilder.createObjCProperty(PD->getName(), PUnit, PLine, + (Getter && Getter->isImplicit()) ? "" : getSelectorName(PD->getGetterName()), + (Setter && Setter->isImplicit()) ? "" : getSelectorName(PD->getSetterName()), PD->getPropertyAttributes(), getOrCreateType(PD->getType(), PUnit)); @@ -1388,13 +1392,17 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, SourceLocation Loc = PD->getLocation(); llvm::DIFile PUnit = getOrCreateFile(Loc); unsigned PLine = getLineNumber(Loc); - PropertyNode = - DBuilder.createObjCProperty(PD->getName(), - PUnit, PLine, + ObjCMethodDecl *Getter = PD->getGetterMethodDecl(); + ObjCMethodDecl *Setter = PD->getSetterMethodDecl(); + PropertyNode = + DBuilder.createObjCProperty(PD->getName(), + PUnit, PLine, + (Getter && Getter->isImplicit()) ? "" : getSelectorName(PD->getGetterName()), + (Setter && Setter->isImplicit()) ? "" : getSelectorName(PD->getSetterName()), - PD->getPropertyAttributes(), - getOrCreateType(PD->getType(),PUnit)); + PD->getPropertyAttributes(), + getOrCreateType(PD->getType(), PUnit)); } } } diff --git a/test/CodeGenObjC/debug-info-property.m b/test/CodeGenObjC/debug-info-property.m index 6ed467a5bc..dd105a58bd 100644 --- a/test/CodeGenObjC/debug-info-property.m +++ b/test/CodeGenObjC/debug-info-property.m @@ -1,8 +1,6 @@ // RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name -// CHECK: AT_APPLE_property_getter -// CHECK: AT_APPLE_property_setter // CHECK: AT_APPLE_property_attribute // CHECK: AT_APPLE_property @interface I1 { diff --git a/test/CodeGenObjC/debug-info-property3.m b/test/CodeGenObjC/debug-info-property3.m index c3bf1ae262..f96ec44c6b 100644 --- a/test/CodeGenObjC/debug-info-property3.m +++ b/test/CodeGenObjC/debug-info-property3.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -S -emit-llvm -g %s -o - | FileCheck %s -// CHECK: metadata !"p1", metadata !6, i32 5, metadata !"p1", metadata !"setP1:", i32 2316, metadata !9} ; [ DW_TAG_APPLE_property ] +// CHECK: metadata !"p1", metadata !6, i32 5, metadata !"", metadata !"", i32 2316, metadata !9} ; [ DW_TAG_APPLE_property ] @interface I1 @property int p1; @end diff --git a/test/CodeGenObjC/debug-info-property4.m b/test/CodeGenObjC/debug-info-property4.m index 619813f687..386a80854c 100644 --- a/test/CodeGenObjC/debug-info-property4.m +++ b/test/CodeGenObjC/debug-info-property4.m @@ -1,8 +1,6 @@ // RUN: %clang_cc1 -fobjc-default-synthesize-properties -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name -// CHECK: AT_APPLE_property_getter -// CHECK: AT_APPLE_property_setter // CHECK: AT_APPLE_property_attribute // CHECK: AT_APPLE_property