summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-03-13 04:12:34 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-03-13 04:12:34 +0000
commit2bd636f589302ec937c732d3761325ecc2f88dd2 (patch)
tree248432a13dd707f00814cb4f8e99e4aada3ee658 /clang
parent05afe5e0841e08889d8fc7b2fe9d0ced91578cc7 (diff)
downloadbcm5719-llvm-2bd636f589302ec937c732d3761325ecc2f88dd2.tar.gz
bcm5719-llvm-2bd636f589302ec937c732d3761325ecc2f88dd2.zip
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. llvm-svn: 152609
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/DeclBase.cpp3
-rw-r--r--clang/lib/Sema/SemaLookup.cpp11
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp4
3 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 9171d2792c0..2e275cfab1e 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1084,6 +1084,9 @@ void DeclContext::addDeclInternal(Decl *D) {
DeclContext::lookup_result
DeclContext::lookup(DeclarationName Name) {
+ assert(DeclKind != Decl::LinkageSpec &&
+ "Should not perform lookups into linkage specs!");
+
DeclContext *PrimaryContext = getPrimaryContext();
if (PrimaryContext != this)
return PrimaryContext->lookup(Name);
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index fbb0dc6b0f9..0382a835489 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/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);
}
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index cb320684426..a6cccbf4b54 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2792,10 +2792,6 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
if (DC->isTranslationUnit() && !Context.getLangOpts().CPlusPlus)
return 0;
- // Force the DeclContext to build a its name-lookup table.
- if (!DC->hasExternalVisibleStorage())
- DC->lookup(DeclarationName());
-
// Serialize the contents of the mapping used for lookup. Note that,
// although we have two very different code paths, the serialized
// representation is the same for both cases: a declaration name,
OpenPOWER on IntegriCloud