diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-15 22:33:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-15 22:33:43 +0000 |
commit | c83c6874e3bf1432d3df5e8d3530f8561ff5441f (patch) | |
tree | 019abd862bb3edb26aa71cd48ddba1fb27e331b1 /lib/Sema/SemaExprObjC.cpp | |
parent | 6f153956158a2780c46872a8e987a8dc66b5f76a (diff) |
Feed proper source-location information into Sema::LookupSingleResult,
in case it ends up doing something that might trigger diagnostics
(template instantiation, ambiguity reporting, access
reporting). Noticed while working on PR6831.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index faa1ffc31e..530a40f49c 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -78,7 +78,8 @@ Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, Ty = Context.getObjCObjectPointerType(Ty); } else { IdentifierInfo *NSIdent = &Context.Idents.get("NSString"); - NamedDecl *IF = LookupSingleName(TUScope, NSIdent, LookupOrdinaryName); + NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLocs[0], + LookupOrdinaryName); if (ObjCInterfaceDecl *StrIF = dyn_cast_or_null<ObjCInterfaceDecl>(IF)) { Context.setObjCConstantStringInterface(StrIF); Ty = Context.getObjCConstantStringInterface(); @@ -149,7 +150,7 @@ Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { - ObjCProtocolDecl* PDecl = LookupProtocol(ProtocolId); + ObjCProtocolDecl* PDecl = LookupProtocol(ProtocolId, ProtoLoc); if (!PDecl) { Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId; return true; @@ -401,7 +402,8 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, SourceLocation propertyNameLoc) { IdentifierInfo *receiverNamePtr = &receiverName; - ObjCInterfaceDecl *IFace = getObjCInterfaceDecl(receiverNamePtr); + ObjCInterfaceDecl *IFace = getObjCInterfaceDecl(receiverNamePtr, + receiverNameLoc); if (IFace == 0) { // If the "receiver" is 'super' in a method, handle it as an expression-like // property reference. @@ -603,7 +605,7 @@ ActOnClassMessage(Scope *S, IdentifierInfo *receiverName, Selector Sel, } if (ClassDecl == 0) - ClassDecl = getObjCInterfaceDecl(receiverName, receiverLoc); + ClassDecl = getObjCInterfaceDecl(receiverName, receiverLoc, true); // The following code allows for the following GCC-ism: // @@ -617,7 +619,8 @@ ActOnClassMessage(Scope *S, IdentifierInfo *receiverName, Selector Sel, // If necessary, the following lookup could move to getObjCInterfaceDecl(). if (!ClassDecl) { NamedDecl *IDecl - = LookupSingleName(TUScope, receiverName, LookupOrdinaryName); + = LookupSingleName(TUScope, receiverName, receiverLoc, + LookupOrdinaryName); if (TypedefDecl *OCTD = dyn_cast_or_null<TypedefDecl>(IDecl)) if (const ObjCInterfaceType *OCIT = OCTD->getUnderlyingType()->getAs<ObjCInterfaceType>()) |