This patch adds the option for disabling warn_inline_namespace_reopened_noninline
warning described here: https://bugs.llvm.org/show_bug.cgi?id=46106
Patch by Elvina Yakubova
Differential Revision: https://reviews.llvm.org/D81825
def PrivateModule : DiagGroup<"private-module">;
def CXX11InlineNamespace : DiagGroup<"c++11-inline-namespace">;
+def InlineNamespaceReopenedNoninline
+ : DiagGroup<"inline-namespace-reopened-noninline">;
def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;
DefaultIgnore, InGroup<CXXPre17Compat>;
def warn_inline_namespace_reopened_noninline : Warning<
- "inline namespace reopened as a non-inline namespace">;
+ "inline namespace reopened as a non-inline namespace">,
+ InGroup<InlineNamespaceReopenedNoninline>;
def err_inline_namespace_mismatch : Error<
"non-inline namespace cannot be reopened as inline">;
The list of warnings below should NEVER grow. It should gradually shrink to 0.
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
CHECK-NEXT: ext_expected_semi_decl_list
CHECK-NEXT: ext_explicit_specialization_storage_class
CHECK-NEXT: warn_ignoring_ftabstop_value
CHECK-NEXT: warn_implements_nscopying
CHECK-NEXT: warn_incompatible_qualified_id
-CHECK-NEXT: warn_inline_namespace_reopened_noninline
CHECK-NEXT: warn_invalid_asm_cast_lvalue
CHECK-NEXT: warn_maynot_respond
CHECK-NEXT: warn_method_param_redefinition
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-inline-namespace-reopened-noninline -DSILENCE -verify -std=c++11 %s
+
+namespace X {
+ #ifndef SILENCE
+ inline namespace {} // expected-note {{previous definition}}
+ namespace {} // expected-warning {{inline namespace reopened as a non-inline namespace}}
+ #else
+ // expected-no-diagnostics
+ inline namespace {}
+ namespace {}
+ #endif
+}