Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.

Radar 10139522 - Part 1.

llvm-svn: 140038
This commit is contained in:
Devang Patel 2011-09-19 18:54:16 +00:00
parent 870f4f4213
commit 5a54065c4f
2 changed files with 22 additions and 4 deletions

View File

@ -1194,7 +1194,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
}
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 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
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,

View File

@ -0,0 +1,14 @@
// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s
// CHECK: AT_APPLE_property_name
@interface C {
int _base;
}
@property int base;
@end
@implementation C
@synthesize base = _base;
@end
void foo(C *cptr) {}