diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-23 04:02:17 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-23 04:02:17 +0000 |
commit | 2e4086bb2d8b007a7232fae27e6068a83c2433fd (patch) | |
tree | ce73b3557b178f4b96fa9444e9cc6e77ffdfb705 /lib/AST/Decl.cpp | |
parent | 38808933e4ef56f23fdd514c0d2bcbfb2e81eded (diff) |
Correctly compute linkage for members of internal linkage classes.
We used to give such members no linkage instead of giving them the linkage of
the class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 3f9eaf28ef..f77345f9c2 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -871,12 +871,11 @@ LinkageComputer::getLVForClassMember(const NamedDecl *D, LinkageInfo classLV = getLVForDecl(cast<RecordDecl>(D->getDeclContext()), classComputation); - // If the class already has unique-external linkage, we can't improve. - if (classLV.getLinkage() == UniqueExternalLinkage) - return LinkageInfo::uniqueExternal(); - + // The member has the same linkage as the class. If that's not externally + // visible, we don't need to compute anything about the linkage. + // FIXME: If we're only computing linkage, can we bail out here? if (!isExternallyVisible(classLV.getLinkage())) - return LinkageInfo::none(); + return classLV; // Otherwise, don't merge in classLV yet, because in certain cases |