diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-04 01:51:11 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-04 01:51:11 +0000 |
commit | 86c0d06194f055a7c12505302bebb904240dfeed (patch) | |
tree | b3e8ed1d8d0cd9fa82546a5c3c47c60b6a89d108 /clang/lib/Sema/SemaDecl.cpp | |
parent | 34951275497192fc5bad19004d45d84f0418347b (diff) | |
download | bcm5719-llvm-86c0d06194f055a7c12505302bebb904240dfeed.tar.gz bcm5719-llvm-86c0d06194f055a7c12505302bebb904240dfeed.zip |
Fix 41 of the 61 tests which fail with modules enabled: we were computing and
caching the linkage for a declaration before we set up its redeclaration chain,
when determining whether a declaration could be a redeclaration of something
from an unimported submodule. We actually want to look at the declaration as if
it were not a redeclaration here, so compute the linkage but don't cache it.
llvm-svn: 178733
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 12885684016..42d7d2bdf5f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1605,8 +1605,18 @@ static void filterNonConflictingPreviousDecls(ASTContext &context, if (previous.empty()) return; - // If this declaration has external - bool hasExternalLinkage = decl->hasExternalLinkage(); + // If this declaration would have external linkage if it were the first + // declaration of this name, then it may in fact be a redeclaration of + // some hidden declaration, so include those too. We don't need to worry + // about some previous visible declaration giving this declaration external + // linkage, because in that case, we'll mark this declaration as a redecl + // of the visible decl, and that decl will already be a redecl of the + // hidden declaration if that's appropriate. + // + // Don't cache this linkage computation, because it's not yet correct: we + // may later give this declaration a previous declaration which changes + // its linkage. + bool hasExternalLinkage = decl->hasExternalLinkageUncached(); LookupResult::Filter filter = previous.makeFilter(); while (filter.hasNext()) { |