[cfe-commits] r149995 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenObjC/debug-info-property5.m
Devang Patel
dpatel at apple.com
Tue Feb 7 10:40:30 PST 2012
Author: dpatel
Date: Tue Feb 7 12:40:30 2012
New Revision: 149995
URL: http://llvm.org/viewvc/llvm-project?rev=149995&view=rev
Log:
Emit debug info for properites that are not backed by an ivar.
Added:
cfe/trunk/test/CodeGenObjC/debug-info-property5.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=149995&r1=149994&r2=149995&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 7 12:40:30 2012
@@ -1307,8 +1307,18 @@
EltTys.push_back(InhTag);
}
+ for (ObjCContainerDecl::prop_iterator I = ID->prop_begin(),
+ E = ID->prop_end(); I != E; ++I) {
+ const ObjCPropertyDecl *PD = *I;
+ llvm::MDNode *PropertyNode =
+ DBuilder.createObjCProperty(PD->getName(),
+ getSelectorName(PD->getGetterName()),
+ getSelectorName(PD->getSetterName()),
+ PD->getPropertyAttributes());
+ EltTys.push_back(PropertyNode);
+ }
+
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) {
@@ -1351,26 +1361,18 @@
else if (Field->getAccessControl() == ObjCIvarDecl::Private)
Flags = llvm::DIDescriptor::FlagPrivate;
- StringRef PropertyName;
- StringRef PropertyGetter;
- StringRef PropertySetter;
- unsigned PropertyAttributes = 0;
- ObjCPropertyDecl *PD = NULL;
llvm::MDNode *PropertyNode = NULL;
- if (ImpD)
+ if (ObjCImplementationDecl *ImpD = ID->getImplementation()) {
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();
- PropertyNode =
- DBuilder.createObjCProperty(PropertyName, PropertyGetter,
- PropertySetter,
- PropertyAttributes);
- EltTys.push_back(PropertyNode);
+ ImpD->FindPropertyImplIvarDecl(Field->getIdentifier())) {
+ if (ObjCPropertyDecl *PD = PImpD->getPropertyDecl()) {
+ PropertyNode =
+ DBuilder.createObjCProperty(PD->getName(),
+ getSelectorName(PD->getGetterName()),
+ getSelectorName(PD->getSetterName()),
+ PD->getPropertyAttributes());
+ }
+ }
}
FieldTy = DBuilder.createObjCIVar(FieldName, FieldDefUnit,
FieldLine, FieldSize, FieldAlign,
Added: cfe/trunk/test/CodeGenObjC/debug-info-property5.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-property5.m?rev=149995&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-property5.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-property5.m Tue Feb 7 12:40:30 2012
@@ -0,0 +1,32 @@
+// 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
+
+ at interface BaseClass2
+{
+ int _baseInt;
+}
+- (int) myGetBaseInt;
+- (void) mySetBaseInt: (int) in_int;
+ at property(getter=myGetBaseInt,setter=mySetBaseInt:) int baseInt;
+ at end
+
+ at implementation BaseClass2
+
+- (int) myGetBaseInt
+{
+ return _baseInt;
+}
+
+- (void) mySetBaseInt: (int) in_int
+{
+ _baseInt = 2 * in_int;
+}
+ at end
+
+
+void foo(BaseClass2 *ptr) {}
More information about the cfe-commits
mailing list