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))
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))
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits