summaryrefslogtreecommitdiffstats
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-23 04:02:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-23 04:02:17 +0000
commit2e4086bb2d8b007a7232fae27e6068a83c2433fd (patch)
treece73b3557b178f4b96fa9444e9cc6e77ffdfb705 /lib/AST/Decl.cpp
parent38808933e4ef56f23fdd514c0d2bcbfb2e81eded (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.cpp9
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