mirror of https://github.com/microsoft/clang.git
[Sema] Avoid crash for category implementation without interface
When we have a category implementation without a corresponding interface (which is an error by itself), semantic checks for property accesses will attempt to access a null interface declaration and then segfault. Error out in such cases instead. Differential Revision: https://reviews.llvm.org/D44916 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0c6d426296
commit
8b218000ce
|
@ -1568,6 +1568,9 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
|
|||
// Also must look for a getter name which uses property syntax.
|
||||
Selector Sel = S.PP.getSelectorTable().getNullarySelector(Member);
|
||||
ObjCInterfaceDecl *IFace = MD->getClassInterface();
|
||||
if (!IFace)
|
||||
goto fail;
|
||||
|
||||
ObjCMethodDecl *Getter;
|
||||
if ((Getter = IFace->lookupClassMethod(Sel))) {
|
||||
// Check the use of this method.
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
@implementation I (C) // expected-error {{cannot find interface declaration for 'I'}}
|
||||
|
||||
+ (void)f {
|
||||
self.m; // expected-error {{member reference base type 'Class' is not a structure or union}}
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue