зеркало из https://github.com/microsoft/clang-1.git
objective-c lldb support: don't perform ivar access control check
when debugging. // rdar://10997647 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152187 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fddfbdbf14
Коммит
458a7fbe73
|
@ -1748,7 +1748,8 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
|
|||
|
||||
// Diagnose the use of an ivar outside of the declaring class.
|
||||
if (IV->getAccessControl() == ObjCIvarDecl::Private &&
|
||||
!declaresSameEntity(ClassDeclared, IFace))
|
||||
!declaresSameEntity(ClassDeclared, IFace) &&
|
||||
!getLangOptions().DebuggerSupport)
|
||||
Diag(Loc, diag::error_private_ivar_access) << IV->getDeclName();
|
||||
|
||||
// FIXME: This should use a new expr for a direct reference, don't
|
||||
|
|
|
@ -1189,16 +1189,17 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
|
|||
dyn_cast<ObjCCategoryImplDecl>(ObjCImpDecl))
|
||||
ClassOfMethodDecl = CatImplClass->getClassInterface();
|
||||
}
|
||||
|
||||
if (IV->getAccessControl() == ObjCIvarDecl::Private) {
|
||||
if (!declaresSameEntity(ClassDeclared, IDecl) ||
|
||||
!declaresSameEntity(ClassOfMethodDecl, ClassDeclared))
|
||||
Diag(MemberLoc, diag::error_private_ivar_access)
|
||||
if (!getLangOptions().DebuggerSupport) {
|
||||
if (IV->getAccessControl() == ObjCIvarDecl::Private) {
|
||||
if (!declaresSameEntity(ClassDeclared, IDecl) ||
|
||||
!declaresSameEntity(ClassOfMethodDecl, ClassDeclared))
|
||||
Diag(MemberLoc, diag::error_private_ivar_access)
|
||||
<< IV->getDeclName();
|
||||
} else if (!IDecl->isSuperClassOf(ClassOfMethodDecl))
|
||||
// @protected
|
||||
Diag(MemberLoc, diag::error_protected_ivar_access)
|
||||
<< IV->getDeclName();
|
||||
} else if (!IDecl->isSuperClassOf(ClassOfMethodDecl))
|
||||
// @protected
|
||||
Diag(MemberLoc, diag::error_protected_ivar_access)
|
||||
<< IV->getDeclName();
|
||||
}
|
||||
}
|
||||
if (getLangOptions().ObjCAutoRefCount) {
|
||||
Expr *BaseExp = BaseExpr.get()->IgnoreParenImpCasts();
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fdebugger-support -verify %s
|
||||
// RUN: %clang_cc1 -x objective-c++ -fdebugger-support -fsyntax-only -verify %s
|
||||
// rdar://10997647
|
||||
|
||||
@interface I
|
||||
{
|
||||
@private
|
||||
int ivar;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation I
|
||||
- (int) meth {
|
||||
return self->ivar;
|
||||
}
|
||||
int foo1(I* p) {
|
||||
return p->ivar;
|
||||
}
|
||||
@end
|
||||
|
||||
int foo(I* p) {
|
||||
return p->ivar;
|
||||
}
|
||||
|
||||
@interface B
|
||||
@end
|
||||
|
||||
@implementation B
|
||||
- (int) meth : (I*) arg {
|
||||
return arg->ivar;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@interface I1 {
|
||||
int protected_ivar;
|
||||
}
|
||||
@property int PROP_INMAIN;
|
||||
@end
|
||||
|
||||
@interface I1() {
|
||||
int private_ivar;
|
||||
}
|
||||
@property int PROP_INCLASSEXT;
|
||||
@end
|
||||
|
||||
@implementation I1
|
||||
@synthesize PROP_INMAIN, PROP_INCLASSEXT;
|
||||
|
||||
- (int) Meth {
|
||||
PROP_INMAIN = 1;
|
||||
PROP_INCLASSEXT = 2;
|
||||
protected_ivar = 1; // OK
|
||||
return private_ivar; // OK
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@interface DER : I1
|
||||
@end
|
||||
|
||||
@implementation DER
|
||||
- (int) Meth {
|
||||
protected_ivar = 1; // OK
|
||||
PROP_INMAIN = 1;
|
||||
PROP_INCLASSEXT = 2;
|
||||
return private_ivar;
|
||||
}
|
||||
@end
|
||||
|
Загрузка…
Ссылка в новой задаче