From e6e622e78937a9a344255ef33d9b7903ba462d2f Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 1 Nov 2010 01:29:57 +0000 Subject: Only apply -fvisibility-inlines-hidden to definitions. Apparently isInlined() just gives meaningless results for non-definitions. Fixes rdar://problem/8614470 llvm-svn: 117887 --- clang/lib/AST/Decl.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 7469e8b27fb..5eb9e8501ed 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -459,9 +459,15 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, // about whether containing classes have visibility attributes, // and that's intentional. if (TSK != TSK_ExplicitInstantiationDeclaration && - ConsiderGlobalVisibility && MD->isInlined() && - MD->getASTContext().getLangOptions().InlineVisibilityHidden) - LV.setVisibility(HiddenVisibility); + ConsiderGlobalVisibility && + MD->getASTContext().getLangOptions().InlineVisibilityHidden) { + // InlineVisibilityHidden only applies to definitions, and + // isInlined() only gives meaningful answers on definitions + // anyway. + const FunctionDecl *Def = 0; + if (MD->hasBody(Def) && Def->isInlined()) + LV.setVisibility(HiddenVisibility); + } // Note that in contrast to basically every other situation, we // *do* apply -fvisibility to method declarations. -- cgit v1.2.3