Open firewave opened 8 months ago
Use cases:
1) With run-clang-tidy
I want to scan a compilation database from a CMake project but exclude all moc_*.cpp
(generated by moc
from Qt) files.
2) With bugprone-unused-return-value.CheckFunctions
I want to check all functions (via ::.*
) but need to exclude functions like std::map::insert()
and std::map::emplace()
where the return code is rarely checked.
@EugeneZelenko This is actually a question. The feature is supposedly already there.
@firewave: Do you have triage
role? If not, please request it, since you file issues often, it'll be definitely helpful to have possibility to adjust labels.
@firewave: Do you have
triage
role? If not, please request it, since you file issues often, it'll be definitely helpful to have possibility to adjust labels.
No, I don't. How do I request that? The contribution guides do not seem to mention that.
"often" seems a bit like a stretch though. 😀 I am happy to help out though.
@firewave: I asked for commit access (roles were split only recently) as described on https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access. My guess that procedure for triage access is same.
Hi!
Sorry for the delay in answering. I have looked a bit deeper into this. It seems llvm::Regex
implements POSIX Extended Regular Expression (ERE), which does not support negative lookahead patterns (which would be required for this use case). Thus my original comment was wrong, it's not possible to get this behavior out of the box. Apologies for introducing confusion!
Thus we probably need to make do with two filters, one for filtering in, and one for filtering out.
@tstellar: I think will be good idea to extend https://llvm.org/docs/DeveloperPolicy.html or https://llvm.org/docs/BugLifeCycle.html with details about getting triage
access.
@EugeneZelenko We don't currently have a process to apply for triage access. Users should follow the process for requesting commit access.
I want to use this with
-source-filter
forrun-clang-tidy
.
This will work for run-clang-tidy.py
, because the source-filter
there uses Python regular expressions, it's not passed to the underlying Clang-Tidy.
Just a silly example to demonstrate: all files in a clang-query
directory not in tool
subdirectory. clang-tools-extra/clang-query/tool/ClangQuery.cpp
is not matched anymore.
python3~/llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
-source-filter='.*/clang-query/(?!tool).*'
https://github.com/llvm/llvm-project/pull/82416#issuecomment-1955055082 mentioned that filter options with regular expression support can use negative expressions as exclude patterns.
I thought one of the limitations of
llvm::RegEx
is that it doesn't support negative expressions so I wonder how that should work.I want to use this with
-source-filter
forrun-clang-tidy
as well asbugprone-unused-return-value.CheckFunctions
.CC @carlosgalvezp @HerrCai0907