diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-04 04:40:17 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-04 04:40:17 +0000 |
commit | c855ce7ab97aa25c609a5f83e19b27289fede21a (patch) | |
tree | 282a2e2a5550be0fd1bddafad0a138b451e21fe8 /lib/Sema | |
parent | 98735a91d53296a76fbcfc00328f6b9aa8bc6cef (diff) |
Add hasExternalLinkageUncached back with the test that Richard provided, but
keep the call at the current location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178741 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 0ad539ef17..436fca35cb 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1614,7 +1614,19 @@ static void filterNonConflictingPreviousDecls(ASTContext &context, continue; // If either has no-external linkage, ignore the old declaration. - if (old->getLinkage() != ExternalLinkage || !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. + if (old->getLinkage() != ExternalLinkage || + !decl->hasExternalLinkageUncached()) filter.erase(); } |