r359858 - Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 20:16:07 PDT 2019
Author: nico
Date: Thu May 2 20:16:07 2019
New Revision: 359858
URL: http://llvm.org/viewvc/llvm-project?rev=359858&view=rev
Log:
Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"
See cfe-commits thread for r359814.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-visibility.c
cfe/trunk/test/SemaCXX/ast-print.cpp
cfe/trunk/test/SemaCXX/attr-visibility.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=359858&r1=359857&r2=359858&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 2 20:16:07 2019
@@ -2778,9 +2778,6 @@ def warn_attribute_ignored : Warning<"%0
def warn_attribute_ignored_on_inline :
Warning<"%0 attribute ignored on inline function">,
InGroup<IgnoredAttributes>;
-def warn_attribute_ignored_on_non_external :
- Warning<"%0 attribute is ignored on a non-external symbol">,
- InGroup<IgnoredAttributes>;
def warn_nocf_check_attribute_ignored :
Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
InGroup<IgnoredAttributes>;
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=359858&r1=359857&r2=359858&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu May 2 20:16:07 2019
@@ -2615,14 +2615,6 @@ static void handleVisibilityAttr(Sema &S
return;
}
- // Visibility attributes have no effect on symbols with internal linkage.
- if (const auto *ND = dyn_cast<NamedDecl>(D)) {
- if (!ND->isExternallyVisible())
- S.Diag(AL.getRange().getBegin(),
- diag::warn_attribute_ignored_on_non_external)
- << AL;
- }
-
// Check that the argument is a string literal.
StringRef TypeStr;
SourceLocation LiteralLoc;
Modified: cfe/trunk/test/Sema/attr-visibility.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-visibility.c?rev=359858&r1=359857&r2=359858&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-visibility.c (original)
+++ cfe/trunk/test/Sema/attr-visibility.c Thu May 2 20:16:07 2019
@@ -26,9 +26,3 @@ typedef int __attribute__((visibility("d
int x __attribute__((type_visibility("default"))); // expected-error {{'type_visibility' attribute only applies to types and namespaces}}
int PR17105 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}}
-
-static int test8 __attribute__((visibility("default"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
-static int test9 __attribute__((visibility("hidden"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
-static int test10 __attribute__((visibility("internal"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
-
-static int test11() __attribute__((visibility("default"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=359858&r1=359857&r2=359858&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Thu May 2 20:16:07 2019
@@ -209,8 +209,10 @@ void test(int i) {
}
}
+namespace {
// CHECK: struct {{\[\[gnu::visibility\(\"hidden\"\)\]\]}} S;
struct [[gnu::visibility("hidden")]] S;
+}
// CHECK: struct CXXFunctionalCastExprPrint {
// CHECK-NEXT: } fce = CXXFunctionalCastExprPrint{};
Modified: cfe/trunk/test/SemaCXX/attr-visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-visibility.cpp?rev=359858&r1=359857&r2=359858&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-visibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-visibility.cpp Thu May 2 20:16:07 2019
@@ -18,9 +18,3 @@ void foo<int>() {
struct x3 {
static int y;
} __attribute((visibility("default"))); // expected-warning {{attribute 'visibility' after definition is ignored}}
-
-const int test4 __attribute__((visibility("default"))) = 0; // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
-
-namespace {
- int test5 __attribute__((visibility("default"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
-};
More information about the cfe-commits
mailing list