forked from OSchip/llvm-project
Add hasExternalLinkageUncached back with the test that Richard provided, but
keep the call at the current location. llvm-svn: 178741
This commit is contained in:
parent
5dacbec4aa
commit
7b51ae8e0e
|
@ -219,6 +219,10 @@ public:
|
|||
return getLinkage() == ExternalLinkage;
|
||||
}
|
||||
|
||||
/// \brief True if this decl has external linkage. Don't cache the linkage,
|
||||
/// because we are not finished setting up the redecl chain for the decl.
|
||||
bool hasExternalLinkageUncached() const;
|
||||
|
||||
/// \brief Determines the visibility of this entity.
|
||||
Visibility getVisibility() const {
|
||||
return getLinkageAndVisibility().getVisibility();
|
||||
|
|
|
@ -866,6 +866,10 @@ bool NamedDecl::isLinkageValid() const {
|
|||
Linkage(CachedLinkage);
|
||||
}
|
||||
|
||||
bool NamedDecl::hasExternalLinkageUncached() const {
|
||||
return getLVForDecl(this, LVForExplicitValue).getLinkage() == ExternalLinkage;
|
||||
}
|
||||
|
||||
Linkage NamedDecl::getLinkage() const {
|
||||
if (HasCachedLinkage)
|
||||
return Linkage(CachedLinkage);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
int f();
|
|
@ -199,3 +199,13 @@ module builtin {
|
|||
header "builtin_sub.h"
|
||||
}
|
||||
}
|
||||
|
||||
module linkage_merge {
|
||||
explicit module foo {
|
||||
header "linkage-merge-foo.h"
|
||||
}
|
||||
explicit module bar {
|
||||
header "linkage-merge-bar.h"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s
|
||||
|
||||
#include "linkage-merge-bar.h"
|
||||
|
||||
static int f(int);
|
||||
int f(int);
|
Loading…
Reference in New Issue