Endill updated this revision to Diff 525216.
Endill added a comment.

Add missing comma after enum item


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c

Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===================================================================
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: %clang_cc1 -DTEST_C2 -verify %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+#error test_c2
+// expected-error@-1 {{test_c2}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//      D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//      D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//      D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D4
+// expected-no-diagnostics
+#error test_d4
+// expected-error@-1 {{test_d4}}
+// expected-maybe-no-diagnostics
+
+//      D4-CHECK: error: 'error' diagnostics seen but not expected:
+// D4-CHECK-NEXT:   {{test_d4}}
+// D4-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D4-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D5
+#error test_d5
+// expected-error@-1 {{test_d5}}
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+
+//      D5-CHECK: error: 'error' diagnostics seen but not expected:
+// D5-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D5-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D6
+#error test_d6
+// expected-error@-1 {{test_d6}}
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+
+//      D6-CHECK: error: 'error' diagnostics seen but not expected:
+// D6-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D6-CHECK-NEXT: 1 error generated.
+#endif
Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===================================================================
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -462,7 +462,11 @@
       D.DL = ED ? &ED->Remarks : nullptr;
     else if (DToken.endswith(DType="-note"))
       D.DL = ED ? &ED->Notes : nullptr;
-    else if (DToken.endswith(DType="-no-diagnostics")) {
+    else if (DToken.endswith(DType="-maybe-no-diagnostics")) {
+      if (Status == VerifyDiagnosticConsumer::HasNoDirectives)
+        Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+      continue;
+    } else if (DToken.endswith(DType="-no-diagnostics")) {
       NoDiag = true;
       if (D.RegexKind)
         continue;
Index: clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
===================================================================
--- clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -251,7 +251,8 @@
     HasNoDirectives,
     HasNoDirectivesReported,
     HasExpectedNoDiagnostics,
-    HasOtherExpectedDirectives
+    HasOtherExpectedDirectives,
+    HasExpectedMaybeNoDiagnostics,
   };
 
   class MarkerTracker;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to