11 Commits

Author SHA1 Message Date
Henrik G. Olsson
65d5425955 Merge pull request #85400 from hnrklssn/update-verify-tests-litplugin
[utils] integrate update-verify-tests with lit's --update-tests
2025-11-12 18:03:33 +00:00
Henrik G. Olsson
5db7926e09 [utils] add support for expected-remarks to update-verify-tests.py 2025-11-11 16:35:00 -08:00
Henrik G. Olsson
c246140d7f [utils] remove trailing whitespace after removing diag 2025-11-11 16:34:59 -08:00
Henrik G. Olsson
4d5844b723 [utils] only steal 1 diagnostic
This fixes a bug in the diagnostic stealing logic when multiple
diagnostics target the same line, which would trigger an assert.
2025-11-11 16:34:59 -08:00
Henrik G. Olsson
4af20b25d5 [utils] fix bug in diagnostic stealing logic
When replacing expected diagnostic content, we should consider
expected diagnostics targeting the same target, not targeting the line
the expected diagnostic is on.
2025-11-11 16:34:55 -08:00
Henrik G. Olsson
38620d49b1 [utils] integrate update-verify-tests with lit's --update-tests
This adds a lit plugin wrapping the core of update-verify-tests. When
lit is invoked with --update-tests it will call the plugin, which checks
if the failure is due to a -verify mismatch. If it is, it tries to
repair the test. If the source file was originally created by
split-file, the changes are propagated to the parent file.

No tests are added, because I don't want to run nested llvm-lit tests
in Swift's test suite, but the core functionality is tested through
update-verify-tests.py.
2025-11-11 16:33:43 -08:00
Henrik G. Olsson
bf46369de7 [utils] only use column for comparison when emitted
This fixes a bug that was introduced where two diagnostics on the same
line, with the same content, would be emitted separately if they
occurred on separate columns. This despite the fact that neither of
these checks specify the column when emitted. The checks are now
properly merged again.
2025-11-07 16:02:05 -08:00
Henrik G. Olsson
d71c8cc29f [utils] run the formatter on update-verify-tests (NFC) 2025-11-07 13:50:05 -08:00
Henrik G. Olsson
3891080750 [utils] add support for expected-expansion to update-verify-tests
`expected-expansion` can be a bit unergonomic to use, because it requires
pointing out not only the line, but also the column (which is not always
obvious), and the nested diagnostics have to refer to absolute lines
that aren't present in the source file. This makes both creating and
updating these test cases easier through automation.
2025-11-07 13:34:39 -08:00
Henrik G. Olsson
8bff12a580 [utils] port update-verify-tests to Swift's -verify
This ports clang's test suite for update-verify-tests from C to Swift,
and adjusts update-verify-tests as needed. The main differences are the
Swift -verify output format being quite different, as well as Swift's
'-verify-additional-prefix foo' working differently than clang's
'-verify=foo'.
2025-11-05 16:02:06 -08:00
Henrik G. Olsson
d629a0089a [utils] add update-verify-tests.py from clang
This script is used to automatically update test cases using -verify in
clang's test suite. Swift also has a similar -verify test functionality,
and while it can automatically fix some of them using -verify-apply-all,
this functionality only updates existing checks - it doesn't add or
remove any, and it doesn't handle newer and more complex things like
expected-expansion. Handling that type of complexity feels out of scope
to embed in the compiler, so let's copy clang's approach.

This commit adds this script as is from clang. It doesn't work at all
for Swift in its current form, as the output from Swift's -verify is
formatted differently than in clang. This will be fixed in subsequent
commits.

This could have been done by adapting the script as-is in the
llvm-project repository (since it only exists in the Swift fork, not
upstream), but tests using swift-frontend would have to reside in the
swift repo, and modifying a script in one repo with tests in a different
repo sounds like a recipe for endless CI issues.
2025-11-05 16:02:03 -08:00