diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-03-13 04:12:34 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-03-13 04:12:34 +0000 |
commit | 65daef179790a02eab1b5a989f53984375a06483 (patch) | |
tree | 1b8c672a04a8d0b01be2aa0c314e18525a4d063d /lib/Sema/SemaLookup.cpp | |
parent | 1b7f9cbed1b96b58a6e5f7808ebc9345a76a0936 (diff) |
It never makes sense to do a lookup into a LinkageSpecDecl, so assert that we
don't, and clean up the places that do it.
The change to ASTWriter is surprising, but the deleted code is a no-op as of
r152608.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index fbb0dc6b0f..0382a83548 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -106,14 +106,15 @@ namespace { assert(InnermostFileDC && InnermostFileDC->isFileContext()); for (; S; S = S->getParent()) { + // C++ [namespace.udir]p1: + // A using-directive shall not appear in class scope, but may + // appear in namespace scope or in block scope. DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()); - if (Ctx && !Ctx->isFunctionOrMethod()) { - DeclContext *EffectiveDC = (Ctx->isFileContext() ? Ctx : InnermostFileDC); - visit(Ctx, EffectiveDC); - } else { + if (Ctx && Ctx->isFileContext()) { + visit(Ctx, Ctx); + } else if (!Ctx || Ctx->isFunctionOrMethod()) { Scope::udir_iterator I = S->using_directives_begin(), End = S->using_directives_end(); - for (; I != End; ++I) visit(*I, InnermostFileDC); } |