From: Chris Lattner Date: Sun, 11 Apr 2010 07:51:10 +0000 (+0000) Subject: actually the interface grossness in the previous patch was due to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9d4fc1f54924a7b242fb763192a40c19fa6103d;p=clang actually the interface grossness in the previous patch was due to typo correction. However, now that the code has been factored out of LookupMemberExpr, it can recurse to itself instead of to LookupMemberExpr! Remove grossness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100958 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 989215948b..d6476be685 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -3847,10 +3847,9 @@ public: Action::OwningExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, - Expr *&BaseExpr, bool &IsArrow, + Expr *BaseExpr, DeclarationName MemberName, - SourceLocation MemberLoc, SourceLocation OpLoc, - CXXScopeSpec &SS, DeclPtrTy ObjCImpDecl); + SourceLocation MemberLoc); virtual OwningExprResult ActOnClassPropertyRefExpr( IdentifierInfo &receiverName, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index c350bb9a78..c173705be5 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3143,9 +3143,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, if (!IsArrow) if (const ObjCObjectPointerType *OPT = BaseType->getAsObjCInterfacePointerType()) - return HandleExprPropertyRefExpr(OPT, BaseExpr, IsArrow, - MemberName, MemberLoc, - OpLoc, SS, ObjCImpDecl); + return HandleExprPropertyRefExpr(OPT, BaseExpr, MemberName, MemberLoc); // Handle the following exceptional case (*Obj).isa. if (!IsArrow && diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 86d69388e2..327e294f36 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -294,11 +294,8 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel, /// objective C interface. This is a property reference expression. Action::OwningExprResult Sema:: HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, - Expr *&BaseExpr, bool &IsArrow, - DeclarationName MemberName, - SourceLocation MemberLoc, SourceLocation OpLoc, - CXXScopeSpec &SS, DeclPtrTy ObjCImpDecl) { - assert(!IsArrow && "Should only be called with '.' expressions"); + Expr *BaseExpr, DeclarationName MemberName, + SourceLocation MemberLoc) { const ObjCInterfaceType *IFaceT = OPT->getInterfaceType(); ObjCInterfaceDecl *IFace = IFaceT->getDecl(); IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); @@ -377,23 +374,22 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, LookupResult Res(*this, MemberName, MemberLoc, LookupOrdinaryName); if (CorrectTypo(Res, 0, 0, IFace, false, OPT) && Res.getAsSingle()) { + DeclarationName TypoResult = Res.getLookupName(); Diag(MemberLoc, diag::err_property_not_found_suggest) - << MemberName << QualType(OPT, 0) << Res.getLookupName() - << FixItHint::CreateReplacement(MemberLoc, - Res.getLookupName().getAsString()); + << MemberName << QualType(OPT, 0) << TypoResult + << FixItHint::CreateReplacement(MemberLoc, TypoResult.getAsString()); ObjCPropertyDecl *Property = Res.getAsSingle(); Diag(Property->getLocation(), diag::note_previous_decl) << Property->getDeclName(); - - return LookupMemberExpr(Res, BaseExpr, IsArrow, OpLoc, SS, ObjCImpDecl); + return HandleExprPropertyRefExpr(OPT, BaseExpr, TypoResult, MemberLoc); } + Diag(MemberLoc, diag::err_property_not_found) << MemberName << QualType(OPT, 0); if (Setter && !Getter) Diag(Setter->getLocation(), diag::note_getter_unavailable) << MemberName << BaseExpr->getSourceRange(); return ExprError(); - }