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 | cdb06f2150d0c75bf7ff13971fd40075568c0226 (patch) | |
tree | fb99b909cd0de44b565d5b45531d18fa74e9cd17 /clang/lib/AST/Decl.cpp | |
parent | 5b81dfc76eeed0c1a47ac4d5704e70c072887d04 (diff) | |
download | bcm5719-llvm-cdb06f2150d0c75bf7ff13971fd40075568c0226.tar.gz bcm5719-llvm-cdb06f2150d0c75bf7ff13971fd40075568c0226.zip |
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.
llvm-svn: 314054
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 3f9eaf28ef9..f77345f9c2d 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/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 |