aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-15 22:33:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-15 22:33:43 +0000
commitc83c6874e3bf1432d3df5e8d3530f8561ff5441f (patch)
tree019abd862bb3edb26aa71cd48ddba1fb27e331b1 /lib/Sema/SemaCodeComplete.cpp
parent6f153956158a2780c46872a8e987a8dc66b5f76a (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/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index d990591dc2..bd5d1487c5 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -3181,7 +3181,8 @@ void Sema::CodeCompleteObjCProtocolReferences(IdentifierLocPair *Protocols,
// Tell the result set to ignore all of the protocols we have
// already seen.
for (unsigned I = 0; I != NumProtocols; ++I)
- if (ObjCProtocolDecl *Protocol = LookupProtocol(Protocols[I].first))
+ if (ObjCProtocolDecl *Protocol = LookupProtocol(Protocols[I].first,
+ Protocols[I].second))
Results.Ignore(Protocol);
// Add all protocols.
@@ -3245,13 +3246,14 @@ void Sema::CodeCompleteObjCInterfaceDecl(Scope *S) {
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
-void Sema::CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName) {
+void Sema::CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName,
+ SourceLocation ClassNameLoc) {
ResultBuilder Results(*this);
Results.EnterNewScope();
// Make sure that we ignore the class we're currently defining.
NamedDecl *CurClass
- = LookupSingleName(TUScope, ClassName, LookupOrdinaryName);
+ = LookupSingleName(TUScope, ClassName, ClassNameLoc, LookupOrdinaryName);
if (CurClass && isa<ObjCInterfaceDecl>(CurClass))
Results.Ignore(CurClass);
@@ -3276,7 +3278,8 @@ void Sema::CodeCompleteObjCImplementationDecl(Scope *S) {
}
void Sema::CodeCompleteObjCInterfaceCategory(Scope *S,
- IdentifierInfo *ClassName) {
+ IdentifierInfo *ClassName,
+ SourceLocation ClassNameLoc) {
typedef CodeCompleteConsumer::Result Result;
ResultBuilder Results(*this);
@@ -3285,7 +3288,7 @@ void Sema::CodeCompleteObjCInterfaceCategory(Scope *S,
// interface.
llvm::SmallPtrSet<IdentifierInfo *, 16> CategoryNames;
NamedDecl *CurClass
- = LookupSingleName(TUScope, ClassName, LookupOrdinaryName);
+ = LookupSingleName(TUScope, ClassName, ClassNameLoc, LookupOrdinaryName);
if (ObjCInterfaceDecl *Class = dyn_cast_or_null<ObjCInterfaceDecl>(CurClass))
for (ObjCCategoryDecl *Category = Class->getCategoryList(); Category;
Category = Category->getNextClassCategory())
@@ -3306,17 +3309,18 @@ void Sema::CodeCompleteObjCInterfaceCategory(Scope *S,
}
void Sema::CodeCompleteObjCImplementationCategory(Scope *S,
- IdentifierInfo *ClassName) {
+ IdentifierInfo *ClassName,
+ SourceLocation ClassNameLoc) {
typedef CodeCompleteConsumer::Result Result;
// Find the corresponding interface. If we couldn't find the interface, the
// program itself is ill-formed. However, we'll try to be helpful still by
// providing the list of all of the categories we know about.
NamedDecl *CurClass
- = LookupSingleName(TUScope, ClassName, LookupOrdinaryName);
+ = LookupSingleName(TUScope, ClassName, ClassNameLoc, LookupOrdinaryName);
ObjCInterfaceDecl *Class = dyn_cast_or_null<ObjCInterfaceDecl>(CurClass);
if (!Class)
- return CodeCompleteObjCInterfaceCategory(S, ClassName);
+ return CodeCompleteObjCInterfaceCategory(S, ClassName, ClassNameLoc);
ResultBuilder Results(*this);