[all-commits] [llvm/llvm-project] cf9b25: [lit] Script to automate use of %(line-n). Use in ...
Sam McCall via All-commits
all-commits at lists.llvm.org
Mon Dec 19 05:19:36 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cf9b25e0adc42546e4dc5ff51ee8674d45bac26b
https://github.com/llvm/llvm-project/commit/cf9b25e0adc42546e4dc5ff51ee8674d45bac26b
Author: Sam McCall <sam.mccall at gmail.com>
Date: 2022-12-19 (Mon, 19 Dec 2022)
Changed paths:
M clang/test/CodeCompletion/PR9728.cpp
M clang/test/CodeCompletion/accessibility-crash.cpp
M clang/test/CodeCompletion/accessibility.cpp
M clang/test/CodeCompletion/after-function-equals.cpp
M clang/test/CodeCompletion/attr.cpp
M clang/test/CodeCompletion/auto.cpp
M clang/test/CodeCompletion/auto_type.c
M clang/test/CodeCompletion/bracket-decl.c
M clang/test/CodeCompletion/call.c
M clang/test/CodeCompletion/call.cpp
M clang/test/CodeCompletion/comments.cpp
M clang/test/CodeCompletion/constexpr.cpp
M clang/test/CodeCompletion/crash-func-decl.cpp
M clang/test/CodeCompletion/crash-func-init.cpp
M clang/test/CodeCompletion/crash-if-directive.cpp
M clang/test/CodeCompletion/crash-null-type.cpp
M clang/test/CodeCompletion/ctor-initializer.cpp
M clang/test/CodeCompletion/ctor-signature.cpp
M clang/test/CodeCompletion/desig-init.cpp
M clang/test/CodeCompletion/deuglify.cpp
M clang/test/CodeCompletion/documentation.cpp
M clang/test/CodeCompletion/documentation.m
M clang/test/CodeCompletion/enable-if-attr-crash.cpp
M clang/test/CodeCompletion/end-of-file.cpp
M clang/test/CodeCompletion/end-of-ident-macro.cpp
M clang/test/CodeCompletion/end-of-ident.cpp
M clang/test/CodeCompletion/enum-preferred-type.cpp
M clang/test/CodeCompletion/enum-switch-case-qualified.cpp
M clang/test/CodeCompletion/enum-switch-case.c
M clang/test/CodeCompletion/enum-switch-case.cpp
M clang/test/CodeCompletion/function-templates.cpp
M clang/test/CodeCompletion/functions.cpp
M clang/test/CodeCompletion/ignore-ns-level-decls.cpp
M clang/test/CodeCompletion/included-symlinks.cpp
M clang/test/CodeCompletion/incomplete-member.cpp
M clang/test/CodeCompletion/incomplete-ret-type.cpp
M clang/test/CodeCompletion/inside-macros.cpp
M clang/test/CodeCompletion/invalid-initialized-class.cpp
M clang/test/CodeCompletion/lambdas.cpp
M clang/test/CodeCompletion/macros-in-modules.c
M clang/test/CodeCompletion/macros-in-modules.m
M clang/test/CodeCompletion/macros.c
M clang/test/CodeCompletion/member-access-qualifiers.cpp
M clang/test/CodeCompletion/member-access.c
M clang/test/CodeCompletion/namespace-alias.cpp
M clang/test/CodeCompletion/namespace.cpp
M clang/test/CodeCompletion/nested-name-specifier.cpp
M clang/test/CodeCompletion/objc-expr.m
M clang/test/CodeCompletion/objc-member-access.m
M clang/test/CodeCompletion/objc-message.m
M clang/test/CodeCompletion/objc-message.mm
M clang/test/CodeCompletion/objc-protocol-member-access.m
M clang/test/CodeCompletion/operator.cpp
M clang/test/CodeCompletion/ordinary-name.c
M clang/test/CodeCompletion/overrides.cpp
M clang/test/CodeCompletion/paren_locs.cpp
M clang/test/CodeCompletion/pragma-macro-token-caching.c
M clang/test/CodeCompletion/preamble.c
M clang/test/CodeCompletion/preferred-type.cpp
M clang/test/CodeCompletion/qualifiers-as-written.cpp
M clang/test/CodeCompletion/self-inits.cpp
M clang/test/CodeCompletion/signatures-crash.cpp
M clang/test/CodeCompletion/tag.c
M clang/test/CodeCompletion/tag.cpp
M clang/test/CodeCompletion/template-signature.cpp
M clang/test/CodeCompletion/templates.cpp
M clang/test/CodeCompletion/this-quals.cpp
M clang/test/CodeCompletion/truncation.c
M clang/test/CodeCompletion/uninstantiated_params.cpp
M clang/test/CodeCompletion/using-enum.cpp
M clang/test/CodeCompletion/using-namespace.cpp
M clang/test/CodeCompletion/using.cpp
M clang/test/CodeCompletion/variadic-template.cpp
A llvm/utils/relative_lines.py
Log Message:
-----------
[lit] Script to automate use of %(line-n). Use in CodeComplete tests.
Tests where the RUN-lines/CHECK-ed output refer to line numbers in the test
file are a maintenance burden, as inserting text in the appropriate place
invalidates all the subsequent line numbers.
Lit supports %(line+n) for this, and FileCheck supports [[@LINE+N]].
But many existing tests don't make use of it and still need to be modified.
This commit adds a script that can find line numbers in tests according to a
regex and replace them with the appropriate relative-line reference.
It contains some options to avoid inappropriately rewriting tests where absolute
numbers are appropriate: a "nearby" threshold and a refusal by default to
replace only some matched line numbers.
I've applied it to CodeComplete tests, this proves the concept but also are the
single worst group of tests I've seen in this respect.
These changes are likely to hit merge conflicts, but can be regenerated with:
```
find ../clang/test/CodeCompletion/ -type f | grep -v /Inputs/ | xargs ../llvm/utils/relative_lines.py --verbose --near=20 --pattern='-code-completion-at[ =]%s:(\\d+):' --pattern='requires fix-it: {(\d+):\d+-(\d+):\d+}'
````
As requested in https://reviews.llvm.org/D140044
Fixes https://github.com/llvm/llvm-project/issues/59553
Differential Revision: https://reviews.llvm.org/D140217
More information about the All-commits
mailing list