зеркало из https://github.com/microsoft/clang-1.git
Fix crash on invalid code. I've tried to produce a reduced test case, but when I do the specific crash is hidden. Fixes <rdar://problem/11063594>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152968 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fbd58743fa
Коммит
2c085ede8d
|
@ -1127,7 +1127,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
|
|||
<< BaseExpr.get()->getSourceRange()))
|
||||
return ExprError();
|
||||
|
||||
ObjCInterfaceDecl *ClassDeclared;
|
||||
ObjCInterfaceDecl *ClassDeclared = 0;
|
||||
ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
|
||||
|
||||
if (!IV) {
|
||||
|
@ -1145,6 +1145,13 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
|
|||
IV->getNameAsString());
|
||||
Diag(IV->getLocation(), diag::note_previous_decl)
|
||||
<< IV->getDeclName();
|
||||
|
||||
// Figure out the class that declares the ivar.
|
||||
assert(!ClassDeclared);
|
||||
Decl *D = cast<Decl>(IV->getDeclContext());
|
||||
if (ObjCCategoryDecl *CAT = dyn_cast<ObjCCategoryDecl>(D))
|
||||
D = CAT->getClassInterface();
|
||||
ClassDeclared = cast<ObjCInterfaceDecl>(D);
|
||||
} else {
|
||||
if (IsArrow && IDecl->FindPropertyDeclaration(Member)) {
|
||||
Diag(MemberLoc,
|
||||
|
@ -1160,6 +1167,8 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
|
|||
return ExprError();
|
||||
}
|
||||
}
|
||||
|
||||
assert(ClassDeclared);
|
||||
|
||||
// If the decl being referenced had an error, return an error for this
|
||||
// sub-expr without emitting another error, in order to avoid cascading
|
||||
|
|
Загрузка…
Ссылка в новой задаче