[PATCH] D15095: Accept "-Weverything" in pragma clang diagnostic ...

Sunil Srivastava via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 30 15:51:24 PST 2015


Sunil_Srivastava created this revision.
Sunil_Srivastava added a subscriber: cfe-commits.

Special handling for “-Weverything” in ‘pragma clang diagnostic handling’
There is no formal diagnostic group named “everything”, so this code is needed.


http://reviews.llvm.org/D15095

Files:
  lib/Basic/Diagnostic.cpp
  test/Frontend/Peverything.cpp

Index: test/Frontend/Peverything.cpp
===================================================================
--- test/Frontend/Peverything.cpp
+++ test/Frontend/Peverything.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+#pragma clang diagnostic error "-Weverything" 
+
+void ppp() // expected-error {{no previous prototype for function 'ppp'}}
+{
+}
Index: lib/Basic/Diagnostic.cpp
===================================================================
--- lib/Basic/Diagnostic.cpp
+++ lib/Basic/Diagnostic.cpp
@@ -248,6 +248,13 @@
 bool DiagnosticsEngine::setSeverityForGroup(diag::Flavor Flavor,
                                             StringRef Group, diag::Severity Map,
                                             SourceLocation Loc) {
+  // Special handling for pragma clang diagnostic ... "-Weverything"
+  // There is no formal group named "everything", so there has to be a special
+  // case for it.
+  if (Group == "everything") {
+   setSeverityForAll(Flavor, Map, Loc);
+   return false;
+  }
   // Get the diagnostics in this group.
   SmallVector<diag::kind, 256> GroupDiags;
   if (Diags->getDiagnosticsInGroup(Flavor, Group, GroupDiags))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15095.41448.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151130/0cb45a37/attachment.bin>


More information about the cfe-commits mailing list