diff options
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 1f390eec05..ed48c439b5 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -777,10 +777,12 @@ static LinkageInfo getLVForDecl(const NamedDecl *D, bool OnlyTemplate) { if (llvm::Optional<Visibility> Vis = Function->getExplicitVisibility()) LV.mergeVisibility(*Vis, true); } - - // Note that Sema::MergeCompatibleFunctionDecls already takes care of - // merging storage classes and visibility attributes, so we don't have to - // look at previous decls in here. + + if (const FunctionDecl *Prev = Function->getPreviousDecl()) { + LinkageInfo PrevLV = getLVForDecl(Prev, OnlyTemplate); + if (PrevLV.linkage()) LV.setLinkage(PrevLV.linkage()); + LV.mergeVisibility(PrevLV); + } return LV; } |