[PATCH] D140217: [lit] Script to automate use of %(line-n). Use in CodeComplete tests.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 16 07:12:38 PST 2022
sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140217
Files:
clang/test/CodeCompletion/PR9728.cpp
clang/test/CodeCompletion/accessibility-crash.cpp
clang/test/CodeCompletion/accessibility.cpp
clang/test/CodeCompletion/after-function-equals.cpp
clang/test/CodeCompletion/attr.cpp
clang/test/CodeCompletion/auto.cpp
clang/test/CodeCompletion/auto_type.c
clang/test/CodeCompletion/bracket-decl.c
clang/test/CodeCompletion/call.c
clang/test/CodeCompletion/call.cpp
clang/test/CodeCompletion/comments.cpp
clang/test/CodeCompletion/constexpr.cpp
clang/test/CodeCompletion/crash-func-decl.cpp
clang/test/CodeCompletion/crash-func-init.cpp
clang/test/CodeCompletion/crash-if-directive.cpp
clang/test/CodeCompletion/crash-null-type.cpp
clang/test/CodeCompletion/ctor-initializer.cpp
clang/test/CodeCompletion/ctor-signature.cpp
clang/test/CodeCompletion/desig-init.cpp
clang/test/CodeCompletion/deuglify.cpp
clang/test/CodeCompletion/documentation.cpp
clang/test/CodeCompletion/documentation.m
clang/test/CodeCompletion/enable-if-attr-crash.cpp
clang/test/CodeCompletion/end-of-file.cpp
clang/test/CodeCompletion/end-of-ident-macro.cpp
clang/test/CodeCompletion/end-of-ident.cpp
clang/test/CodeCompletion/enum-preferred-type.cpp
clang/test/CodeCompletion/enum-switch-case-qualified.cpp
clang/test/CodeCompletion/enum-switch-case.c
clang/test/CodeCompletion/enum-switch-case.cpp
clang/test/CodeCompletion/function-templates.cpp
clang/test/CodeCompletion/functions.cpp
clang/test/CodeCompletion/ignore-ns-level-decls.cpp
clang/test/CodeCompletion/included-symlinks.cpp
clang/test/CodeCompletion/incomplete-member.cpp
clang/test/CodeCompletion/incomplete-ret-type.cpp
clang/test/CodeCompletion/inside-macros.cpp
clang/test/CodeCompletion/invalid-initialized-class.cpp
clang/test/CodeCompletion/lambdas.cpp
clang/test/CodeCompletion/macros-in-modules.c
clang/test/CodeCompletion/macros-in-modules.m
clang/test/CodeCompletion/macros.c
clang/test/CodeCompletion/member-access-qualifiers.cpp
clang/test/CodeCompletion/member-access.c
clang/test/CodeCompletion/namespace-alias.cpp
clang/test/CodeCompletion/namespace.cpp
clang/test/CodeCompletion/nested-name-specifier.cpp
clang/test/CodeCompletion/objc-expr.m
clang/test/CodeCompletion/objc-member-access.m
clang/test/CodeCompletion/objc-message.m
clang/test/CodeCompletion/objc-message.mm
clang/test/CodeCompletion/objc-protocol-member-access.m
clang/test/CodeCompletion/operator.cpp
clang/test/CodeCompletion/ordinary-name.c
clang/test/CodeCompletion/overrides.cpp
clang/test/CodeCompletion/paren_locs.cpp
clang/test/CodeCompletion/pragma-macro-token-caching.c
clang/test/CodeCompletion/preamble.c
clang/test/CodeCompletion/preferred-type.cpp
clang/test/CodeCompletion/qualifiers-as-written.cpp
clang/test/CodeCompletion/self-inits.cpp
clang/test/CodeCompletion/signatures-crash.cpp
clang/test/CodeCompletion/tag.c
clang/test/CodeCompletion/tag.cpp
clang/test/CodeCompletion/template-signature.cpp
clang/test/CodeCompletion/templates.cpp
clang/test/CodeCompletion/this-quals.cpp
clang/test/CodeCompletion/truncation.c
clang/test/CodeCompletion/uninstantiated_params.cpp
clang/test/CodeCompletion/using-enum.cpp
clang/test/CodeCompletion/using-namespace.cpp
clang/test/CodeCompletion/using.cpp
clang/test/CodeCompletion/variadic-template.cpp
llvm/utils/relative_lines.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140217.483533.patch
Type: text/x-patch
Size: 103285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221216/b6accec8/attachment-0001.bin>
More information about the cfe-commits
mailing list