llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Rahul Joshi (jurahul) <details> <summary>Changes</summary> Reverts llvm/llvm-project#<!-- -->97369 --- Patch is 33.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/108630.diff 36 Files Affected: - (removed) clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c (-8) - (removed) clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c.expected (-8) - (removed) clang/test/utils/update-verify-tests/Inputs/infer-indentation.c (-8) - (removed) clang/test/utils/update-verify-tests/Inputs/infer-indentation.c.expected (-11) - (removed) clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c (-11) - (removed) clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c.expected (-12) - (removed) clang/test/utils/update-verify-tests/Inputs/multiple-errors.c (-6) - (removed) clang/test/utils/update-verify-tests/Inputs/multiple-errors.c.expected (-9) - (removed) clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c (-8) - (removed) clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c.expected (-13) - (removed) clang/test/utils/update-verify-tests/Inputs/no-checks.c (-3) - (removed) clang/test/utils/update-verify-tests/Inputs/no-checks.c.expected (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/no-diags.c (-5) - (removed) clang/test/utils/update-verify-tests/Inputs/no-diags.c.expected (-5) - (removed) clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c.expected (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c (-5) - (removed) clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c.expected (-5) - (removed) clang/test/utils/update-verify-tests/Inputs/update-same-line.c (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/update-same-line.c.expected (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/update-single-check.c (-4) - (removed) clang/test/utils/update-verify-tests/Inputs/update-single-check.c.expected (-4) - (removed) clang/test/utils/update-verify-tests/duplicate-diag.test (-4) - (removed) clang/test/utils/update-verify-tests/infer-indentation.test (-3) - (removed) clang/test/utils/update-verify-tests/leave-existing-diags.test (-4) - (removed) clang/test/utils/update-verify-tests/lit.local.cfg (-25) - (removed) clang/test/utils/update-verify-tests/multiple-errors.test (-3) - (removed) clang/test/utils/update-verify-tests/multiple-missing-errors-same-line.test (-3) - (removed) clang/test/utils/update-verify-tests/no-checks.test (-3) - (removed) clang/test/utils/update-verify-tests/no-diags.test (-4) - (removed) clang/test/utils/update-verify-tests/no-expected-diags.test (-4) - (removed) clang/test/utils/update-verify-tests/non-default-prefix.test (-4) - (removed) clang/test/utils/update-verify-tests/update-same-line.test (-4) - (removed) clang/test/utils/update-verify-tests/update-single-check.test (-3) - (removed) clang/utils/UpdateVerifyTests/core.py (-452) - (removed) clang/utils/update-verify-tests.py (-38) ``````````diff diff --git a/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c b/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c deleted file mode 100644 index 8c7e46c6eca9c1..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c +++ /dev/null @@ -1,8 +0,0 @@ -void foo() { - // expected-error@+1{{use of undeclared identifier 'a'}} - a = 2; a = 2; - b = 2; b = 2; - // expected-error@+1 3{{use of undeclared identifier 'c'}} - c = 2; c = 2; - // expected-error 2{{asdf}} -} diff --git a/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c.expected b/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c.expected deleted file mode 100644 index 6214ff382f4495..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/duplicate-diag.c.expected +++ /dev/null @@ -1,8 +0,0 @@ -void foo() { - // expected-error@+1 2{{use of undeclared identifier 'a'}} - a = 2; a = 2; - // expected-error@+1 2{{use of undeclared identifier 'b'}} - b = 2; b = 2; - // expected-error@+1 2{{use of undeclared identifier 'c'}} - c = 2; c = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c b/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c deleted file mode 100644 index 0210ac35fd5cd1..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c +++ /dev/null @@ -1,8 +0,0 @@ -void foo() { - // expected-error@+1 2 {{use of undeclared identifier 'a'}} - a = 2; a = 2; b = 2; b = 2; c = 2; - // expected-error@+1 2 {{asdf}} - d = 2; - e = 2; f = 2; // expected-error 2 {{use of undeclared identifier 'e'}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c.expected b/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c.expected deleted file mode 100644 index 5c5aaeeef97acf..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/infer-indentation.c.expected +++ /dev/null @@ -1,11 +0,0 @@ -void foo() { - // expected-error@+3 {{use of undeclared identifier 'c'}} - // expected-error@+2 2 {{use of undeclared identifier 'b'}} - // expected-error@+1 2 {{use of undeclared identifier 'a'}} - a = 2; a = 2; b = 2; b = 2; c = 2; - // expected-error@+1 {{use of undeclared identifier 'd'}} - d = 2; - // expected-error@+1 {{use of undeclared identifier 'f'}} - e = 2; f = 2; // expected-error {{use of undeclared identifier 'e'}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c b/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c deleted file mode 100644 index 1aa8d088e97273..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c +++ /dev/null @@ -1,11 +0,0 @@ -void foo() { - a = 2; - // expected-error@-1{{use of undeclared identifier 'a'}} - b = 2;// expected-error{{use of undeclared identifier 'b'}} - c = 2; - // expected-error@5{{use of undeclared identifier 'c'}} - d = 2; // expected-error-re{{use of {{.*}} identifier 'd'}} - - e = 2; // error to trigger mismatch -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c.expected b/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c.expected deleted file mode 100644 index 6b621061bbfbbd..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/leave-existing-diags.c.expected +++ /dev/null @@ -1,12 +0,0 @@ -void foo() { - a = 2; - // expected-error@-1{{use of undeclared identifier 'a'}} - b = 2;// expected-error{{use of undeclared identifier 'b'}} - c = 2; - // expected-error@5{{use of undeclared identifier 'c'}} - d = 2; // expected-error-re{{use of {{.*}} identifier 'd'}} - - // expected-error@+1{{use of undeclared identifier 'e'}} - e = 2; // error to trigger mismatch -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c b/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c deleted file mode 100644 index e230e0a337bf49..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo() { - a = 2; - b = 2; - - c = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c.expected b/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c.expected deleted file mode 100644 index 27dc1f30a26faf..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/multiple-errors.c.expected +++ /dev/null @@ -1,9 +0,0 @@ -void foo() { - // expected-error@+1{{use of undeclared identifier 'a'}} - a = 2; - // expected-error@+1{{use of undeclared identifier 'b'}} - b = 2; - - // expected-error@+1{{use of undeclared identifier 'c'}} - c = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c b/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c deleted file mode 100644 index 03f723d44bbe82..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c +++ /dev/null @@ -1,8 +0,0 @@ -void foo() { - a = 2; b = 2; c = 2; -} - -void bar() { - x = 2; y = 2; z = 2; - // expected-error@-1{{use of undeclared identifier 'x'}} -} diff --git a/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c.expected b/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c.expected deleted file mode 100644 index 24b57f4353d95d..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/multiple-missing-errors-same-line.c.expected +++ /dev/null @@ -1,13 +0,0 @@ -void foo() { - // expected-error@+3{{use of undeclared identifier 'c'}} - // expected-error@+2{{use of undeclared identifier 'b'}} - // expected-error@+1{{use of undeclared identifier 'a'}} - a = 2; b = 2; c = 2; -} - -void bar() { - x = 2; y = 2; z = 2; - // expected-error@-1{{use of undeclared identifier 'x'}} - // expected-error@-2{{use of undeclared identifier 'y'}} - // expected-error@-3{{use of undeclared identifier 'z'}} -} diff --git a/clang/test/utils/update-verify-tests/Inputs/no-checks.c b/clang/test/utils/update-verify-tests/Inputs/no-checks.c deleted file mode 100644 index 8fd1f7cd333705..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-checks.c +++ /dev/null @@ -1,3 +0,0 @@ -void foo() { - bar = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/no-checks.c.expected b/clang/test/utils/update-verify-tests/Inputs/no-checks.c.expected deleted file mode 100644 index e80548fbe50f2c..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-checks.c.expected +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - // expected-error@+1{{use of undeclared identifier 'bar'}} - bar = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/no-diags.c b/clang/test/utils/update-verify-tests/Inputs/no-diags.c deleted file mode 100644 index 66d169be439402..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-diags.c +++ /dev/null @@ -1,5 +0,0 @@ -void foo() { - // expected-error@+1{{asdf}} - int a = 2; -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/no-diags.c.expected b/clang/test/utils/update-verify-tests/Inputs/no-diags.c.expected deleted file mode 100644 index 05230284945702..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-diags.c.expected +++ /dev/null @@ -1,5 +0,0 @@ -// expected-no-diagnostics -void foo() { - int a = 2; -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c b/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c deleted file mode 100644 index 78b72e1357da76..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c +++ /dev/null @@ -1,4 +0,0 @@ -// expected-no-diagnostics -void foo() { - a = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c.expected b/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c.expected deleted file mode 100644 index d948ffce56189a..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/no-expected-diags.c.expected +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - // expected-error@+1{{use of undeclared identifier 'a'}} - a = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c b/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c deleted file mode 100644 index 3d63eaf0f1b878..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c +++ /dev/null @@ -1,5 +0,0 @@ -void foo() { - a = 2; // check-error{{asdf}} - // expected-error@-1{ignored}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c.expected b/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c.expected deleted file mode 100644 index a877f86922123d..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/non-default-prefix.c.expected +++ /dev/null @@ -1,5 +0,0 @@ -void foo() { - a = 2; // check-error{{use of undeclared identifier 'a'}} - // expected-error@-1{ignored}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/update-same-line.c b/clang/test/utils/update-verify-tests/Inputs/update-same-line.c deleted file mode 100644 index 5278ce0c57c319..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/update-same-line.c +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - bar = 2; // expected-error {{asdf}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/update-same-line.c.expected b/clang/test/utils/update-verify-tests/Inputs/update-same-line.c.expected deleted file mode 100644 index 8ba47f788319b1..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/update-same-line.c.expected +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - bar = 2; // expected-error {{use of undeclared identifier 'bar'}} -} - diff --git a/clang/test/utils/update-verify-tests/Inputs/update-single-check.c b/clang/test/utils/update-verify-tests/Inputs/update-single-check.c deleted file mode 100644 index 20b011bfc3d77e..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/update-single-check.c +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - // expected-error@+1{{asdf}} - bar = 2; -} diff --git a/clang/test/utils/update-verify-tests/Inputs/update-single-check.c.expected b/clang/test/utils/update-verify-tests/Inputs/update-single-check.c.expected deleted file mode 100644 index e80548fbe50f2c..00000000000000 --- a/clang/test/utils/update-verify-tests/Inputs/update-single-check.c.expected +++ /dev/null @@ -1,4 +0,0 @@ -void foo() { - // expected-error@+1{{use of undeclared identifier 'bar'}} - bar = 2; -} diff --git a/clang/test/utils/update-verify-tests/duplicate-diag.test b/clang/test/utils/update-verify-tests/duplicate-diag.test deleted file mode 100644 index 3163ce46199c3f..00000000000000 --- a/clang/test/utils/update-verify-tests/duplicate-diag.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/duplicate-diag.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/duplicate-diag.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c - diff --git a/clang/test/utils/update-verify-tests/infer-indentation.test b/clang/test/utils/update-verify-tests/infer-indentation.test deleted file mode 100644 index 6ba2f5d9d505bf..00000000000000 --- a/clang/test/utils/update-verify-tests/infer-indentation.test +++ /dev/null @@ -1,3 +0,0 @@ -# RUN: cp %S/Inputs/infer-indentation.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/infer-indentation.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c diff --git a/clang/test/utils/update-verify-tests/leave-existing-diags.test b/clang/test/utils/update-verify-tests/leave-existing-diags.test deleted file mode 100644 index cde690ef715a67..00000000000000 --- a/clang/test/utils/update-verify-tests/leave-existing-diags.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/leave-existing-diags.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/leave-existing-diags.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c - diff --git a/clang/test/utils/update-verify-tests/lit.local.cfg b/clang/test/utils/update-verify-tests/lit.local.cfg deleted file mode 100644 index a0b6afccc25010..00000000000000 --- a/clang/test/utils/update-verify-tests/lit.local.cfg +++ /dev/null @@ -1,25 +0,0 @@ -import lit.util - -# python 2.7 backwards compatibility -try: - from shlex import quote as shell_quote -except ImportError: - from pipes import quote as shell_quote - -if config.standalone_build: - # These tests require the update-verify-tests.py script from the clang - # source tree, so skip these tests if we are doing standalone builds. - config.unsupported = True -else: - config.suffixes = [".test"] - - script_path = os.path.join( - config.clang_src_dir, "utils", "update-verify-tests.py" - ) - python = shell_quote(config.python_executable) - config.substitutions.append( - ( - "%update-verify-tests", - "%s %s" % (python, shell_quote(script_path)), - ) - ) diff --git a/clang/test/utils/update-verify-tests/multiple-errors.test b/clang/test/utils/update-verify-tests/multiple-errors.test deleted file mode 100644 index 1332ef365dc863..00000000000000 --- a/clang/test/utils/update-verify-tests/multiple-errors.test +++ /dev/null @@ -1,3 +0,0 @@ -# RUN: cp %S/Inputs/multiple-errors.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/multiple-errors.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c diff --git a/clang/test/utils/update-verify-tests/multiple-missing-errors-same-line.test b/clang/test/utils/update-verify-tests/multiple-missing-errors-same-line.test deleted file mode 100644 index a9c21cd77e192b..00000000000000 --- a/clang/test/utils/update-verify-tests/multiple-missing-errors-same-line.test +++ /dev/null @@ -1,3 +0,0 @@ -# RUN: cp %S/Inputs/multiple-missing-errors-same-line.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/multiple-missing-errors-same-line.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c diff --git a/clang/test/utils/update-verify-tests/no-checks.test b/clang/test/utils/update-verify-tests/no-checks.test deleted file mode 100644 index f6ea91fa552be4..00000000000000 --- a/clang/test/utils/update-verify-tests/no-checks.test +++ /dev/null @@ -1,3 +0,0 @@ -# RUN: cp %S/Inputs/no-checks.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/no-checks.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c diff --git a/clang/test/utils/update-verify-tests/no-diags.test b/clang/test/utils/update-verify-tests/no-diags.test deleted file mode 100644 index 464fe8894253b6..00000000000000 --- a/clang/test/utils/update-verify-tests/no-diags.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/no-diags.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/no-diags.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c - diff --git a/clang/test/utils/update-verify-tests/no-expected-diags.test b/clang/test/utils/update-verify-tests/no-expected-diags.test deleted file mode 100644 index 75235f17a64a29..00000000000000 --- a/clang/test/utils/update-verify-tests/no-expected-diags.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/no-expected-diags.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/no-expected-diags.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c - diff --git a/clang/test/utils/update-verify-tests/non-default-prefix.test b/clang/test/utils/update-verify-tests/non-default-prefix.test deleted file mode 100644 index e581755a6e6038..00000000000000 --- a/clang/test/utils/update-verify-tests/non-default-prefix.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/non-default-prefix.c %t.c && not %clang_cc1 -verify=check %t.c 2>&1 | %update-verify-tests --prefix check -# RUN: diff -u %S/Inputs/non-default-prefix.c.expected %t.c -# RUN: %clang_cc1 -verify=check %t.c - diff --git a/clang/test/utils/update-verify-tests/update-same-line.test b/clang/test/utils/update-verify-tests/update-same-line.test deleted file mode 100644 index 324768eae5faac..00000000000000 --- a/clang/test/utils/update-verify-tests/update-same-line.test +++ /dev/null @@ -1,4 +0,0 @@ -# RUN: cp %S/Inputs/update-same-line.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/update-same-line.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c - diff --git a/clang/test/utils/update-verify-tests/update-single-check.test b/clang/test/utils/update-verify-tests/update-single-check.test deleted file mode 100644 index 2cb1ae3bcbd3b8..00000000000000 --- a/clang/test/utils/update-verify-tests/update-single-check.test +++ /dev/null @@ -1,3 +0,0 @@ -# RUN: cp %S/Inputs/update-single-check.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests -# RUN: diff -u %S/Inputs/update-single-check.c.expected %t.c -# RUN: %clang_cc1 -verify %t.c diff --git a/clang/utils/UpdateVerifyTests/core.py b/clang/utils/UpdateVerifyTests/core.py deleted file mode 100644 index d1350cdbb698b6..00000000000000 --- a/clang/utils/UpdateVerifyTests/core.py +++ /dev/null @@ -1,452 +0,0 @@ -import sys -import re - -DEBUG = False - - -def dprint(*args): - if DEBUG: - print(*args, file=sys.stderr) - - -class KnownException(Exception): - pass - - -def parse_error_category(s, prefix): - if "no expected directives found" in s: - return None - parts = s.split("diagnostics") - diag_category = parts[0] - category_parts = parts[0].strip().strip("'").split("-") - expected = category_parts[0] - if expected != prefix: - raise Exception( - f"expected prefix '{prefix}', but found '{expected}'. Multiple verify prefixes are not supported." - ) - diag_category = category_parts[1] - if "seen but not expected" in parts[1]: - seen = True - elif "expected but not seen" in parts[1]: - seen = False - else: - raise KnownException(f"unexpected category '{parts[1]}'") - return (diag_category, seen) - - -diag_error_re = re.compile(r"File (\S+) Line (\d+): (.+)") -diag_error_re2 = re.compile(r"File \S+ Line \d+ \(directive at (\S+):(\d+)\): (.+)") - - -def parse_diag_error(s): - m = diag_error_re2.match(s) - if not m: - m = diag_error_re.match(s) - if not m: - return None - return (m.group(1), int(m.group(2)), m.group(3)) - - -class Line: - def __init__(self, content, line_n): - self.content = content - self.diag = None - self.line_n = line_n - self.targeting_diags = [] - - def update_line_n(self, n): - self.line_n = n - - def render(self): - if not self.diag: - return self.content - assert "{{DIAG}}" in self.content - res = self.content.replace("{{DIAG}}", self.diag.render()) - if not res.strip(): - return "" - return res - - -class Diag: - def __init__( - self, - prefix, - diag_content, - category, - parsed_target_line_n, - line_is_absolute, - count, - line, - is_re, - whitespace_strings, - is_from_source_file, - ): - self.prefix = prefix - self.diag_content = diag_content - self.category = category - self.parsed_target_line_n = parsed_target_line_n - self.line_is_absolute = line_is_absolute - self.count = count - self.line = line - self.target = None - self.is_re = is_re - self.absolute_target() - self.whitespace_strings = whitespace_strings - self.is_from_source_file = is_from_source_file - - def decrement_count(self): - self.count -= 1 - assert self.count >= 0 - - def increment_count(self): - assert self.count >= 0 - self.count += 1 - - def unset_target(self): - assert self.target is not None - self.target.targeting_diags.remove(self) - ... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/108630 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits