diff options
author | John McCall <rjmccall@apple.com> | 2009-11-17 02:14:36 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-11-17 02:14:36 +0000 |
commit | a24dc2e38c7fb0f7f138b3d14b5f0f241fd0eccf (patch) | |
tree | d040e3cf363229c97136c3663a267a040760acd8 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 936d2a8a3968231199dddbc78378e8fddbab6e25 (diff) |
Carry lookup configuration throughout lookup on the LookupResult. Give
LookupResult RAII powers to diagnose ambiguity in the results. Other diagnostics
(e.g. access control and deprecation) will be moved to automatically trigger
during lookup as part of this same mechanism.
This abstraction makes it much easier to encapsulate aliasing declarations
(e.g. using declarations) inside the lookup system: eventually, lookup will
just produce the aliases in the LookupResult, and the standard access methods
will naturally strip the aliases off.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 5d50d51df9..a37f3a2b99 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -677,9 +677,10 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { // Look only into the namespace where the friend would be declared to // find a previous declaration. This is the innermost enclosing namespace, // as described in ActOnFriendFunctionDecl. - Sema::LookupResult R; - SemaRef.LookupQualifiedName(R, DC, Function->getDeclName(), - Sema::LookupOrdinaryName, true); + Sema::LookupResult R(SemaRef, Function->getDeclName(), SourceLocation(), + Sema::LookupOrdinaryName, + Sema::LookupResult::ForRedeclaration); + SemaRef.LookupQualifiedName(R, DC); PrevDecl = R.getAsSingleDecl(SemaRef.Context); @@ -837,8 +838,10 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, NamedDecl *PrevDecl = 0; if (!FunctionTemplate || TemplateParams) { - Sema::LookupResult R; - SemaRef.LookupQualifiedName(R, Owner, Name, Sema::LookupOrdinaryName, true); + Sema::LookupResult R(SemaRef, Name, SourceLocation(), + Sema::LookupOrdinaryName, + Sema::LookupResult::ForRedeclaration); + SemaRef.LookupQualifiedName(R, Owner); PrevDecl = R.getAsSingleDecl(SemaRef.Context); // In C++, the previous declaration we find might be a tag type |