diff options
| author | John McCall <rjmccall@apple.com> | 2010-10-28 07:07:52 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-10-28 07:07:52 +0000 |
| commit | 2efaf1169595fe67a6ac3251e486babc801eee07 (patch) | |
| tree | 592e49f5e78b062c4657adf9710ec99130432b76 /clang/lib/AST/Decl.cpp | |
| parent | ff310737e5d5cbb5e29637f9d9f2c8a31a60afc8 (diff) | |
| download | bcm5719-llvm-2efaf1169595fe67a6ac3251e486babc801eee07.tar.gz bcm5719-llvm-2efaf1169595fe67a6ac3251e486babc801eee07.zip | |
Abandon the type-visibility optimization for functions. GCC doesn't do it,
and it's too much trouble to push for. Fixes PR8478.
llvm-svn: 117532
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 2069054b3a7..8526eccd658 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -268,15 +268,10 @@ static LVPair getLVForNamespaceScopeDecl(const NamedDecl *D) { // - a function, unless it has internal linkage; or } else if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) { - // Modify the function's LV by the LV of its type unless this is - // C or extern "C". See the comment above about variables. - if (Context.getLangOptions().CPlusPlus && !Function->isExternC() && - !ExplicitVisibility) { - LVPair TypeLV = Function->getType()->getLinkageAndVisibility(); - if (TypeLV.first != ExternalLinkage) - return LVPair(UniqueExternalLinkage, DefaultVisibility); - LV.second = minVisibility(LV.second, TypeLV.second); - } + // In theory, we can modify the function's LV by the LV of its + // type unless it has C linkage (see comment above about variables + // for justification). In practice, GCC doesn't do this, so it's + // just too painful to make work. // C99 6.2.2p5: // If the declaration of an identifier for a function has no @@ -437,11 +432,11 @@ static LVPair getLVForClassMember(const NamedDecl *D) { const VisibilityAttr *VA = GetExplicitVisibility(D); if (VA) LV.second = minVisibility(LV.second, GetVisibilityFromAttr(VA)); - // If it's a value declaration and we don't have an explicit visibility - // attribute, apply the LV from its type. + // If it's a variable declaration and we don't have an explicit + // visibility attribute, apply the LV from its type. // See the comment about namespace-scope variable decls above. - if (!VA && isa<ValueDecl>(D)) { - LVPair TypeLV = cast<ValueDecl>(D)->getType()->getLinkageAndVisibility(); + if (!VA && isa<VarDecl>(D)) { + LVPair TypeLV = cast<VarDecl>(D)->getType()->getLinkageAndVisibility(); if (TypeLV.first != ExternalLinkage) LV.first = minLinkage(LV.first, UniqueExternalLinkage); LV.second = minVisibility(LV.second, TypeLV.second); |

