diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-12-19 00:45:41 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-12-19 00:45:41 +0000 |
commit | ff7d47a354b7706ea4028ea4b0d0e0e858971b05 (patch) | |
tree | 78a366de36742b3ce063e174e2547174b69943d9 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | bbdb9f26538f889a042432c9e87407ab472db1bf (diff) | |
download | bcm5719-llvm-ff7d47a354b7706ea4028ea4b0d0e0e858971b05.tar.gz bcm5719-llvm-ff7d47a354b7706ea4028ea4b0d0e0e858971b05.zip |
Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365
This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).
Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)
llvm-svn: 170482
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 566f6eef7fa..cca7df3fc1e 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -245,8 +245,8 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { TypeAliasTemplateDecl *PrevAliasTemplate = 0; if (Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); - if (Found.first != Found.second) { - PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(*Found.first); + if (!Found.empty()) { + PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(Found.front()); } } @@ -745,8 +745,8 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { if (!isFriend && Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); - if (Found.first != Found.second) { - PrevClassTemplate = dyn_cast<ClassTemplateDecl>(*Found.first); + if (!Found.empty()) { + PrevClassTemplate = dyn_cast<ClassTemplateDecl>(Found.front()); if (PrevClassTemplate) PrevDecl = PrevClassTemplate->getTemplatedDecl(); } @@ -911,11 +911,11 @@ TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl( // of the class template and return that. DeclContext::lookup_result Found = Owner->lookup(ClassTemplate->getDeclName()); - if (Found.first == Found.second) + if (Found.empty()) return 0; ClassTemplateDecl *InstClassTemplate - = dyn_cast<ClassTemplateDecl>(*Found.first); + = dyn_cast<ClassTemplateDecl>(Found.front()); if (!InstClassTemplate) return 0; @@ -3531,7 +3531,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, NamedDecl *Result = 0; if (D->getDeclName()) { DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName()); - Result = findInstantiationOf(Context, D, Found.first, Found.second); + Result = findInstantiationOf(Context, D, Found.begin(), Found.end()); } else { // Since we don't have a name for the entity we're looking for, // our only option is to walk through all of the declarations to |