[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 03:58:22 PDT 2024


https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/98613

>From d22741375619b2b134509049aad7958348abcc30 Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Fri, 12 Jul 2024 12:26:07 +0200
Subject: [PATCH 1/2] [clang] Allow to opt out the
 missing_dependent_template_keyword diagnostic.

---
 clang/include/clang/Basic/DiagnosticParseKinds.td | 3 ++-
 clang/test/Misc/warning-flags.c                   | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 0bd2e35bf2e31..e00cd47411cb3 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -896,7 +896,8 @@ def missing_template_arg_list_after_template_kw : Extension<
   DefaultError;
 
 def ext_missing_dependent_template_keyword : ExtWarn<
-  "use 'template' keyword to treat '%0' as a dependent template name">;
+  "use 'template' keyword to treat '%0' as a dependent template name">,
+  InGroup<DiagGroup<"missing-dependent-template-keyword">>;
 
 def ext_extern_template : Extension<
   "extern templates are a C++11 extension">, InGroup<CXX11>;
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 651a86fb6e226..7b993f6849363 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,10 +18,9 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (65):
+CHECK: Warnings without flags (64):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
-CHECK-NEXT:   ext_missing_dependent_template_keyword
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
 CHECK-NEXT:   ext_plain_complex

>From 2c474db9145ef66af17e09ac68343a1666fa0877 Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Fri, 12 Jul 2024 12:57:48 +0200
Subject: [PATCH 2/2] Add release note

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c9b7d4e6d75e0..a0e15975744d8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -313,6 +313,7 @@ Resolutions to C++ Defect Reports
 
 - Clang now correctly implements lookup for the terminal name of a member-qualified nested-name-specifier.
   (`CWG1835: Dependent member lookup before < <https://cplusplus.github.io/CWG/issues/1835.html>`_).
+  The warning can be disabled via `-Wno-missing-dependent-template-keyword`.
 
 C Language Changes
 ------------------



More information about the cfe-commits mailing list