In a github comment @Xazax-hun mentioned that the directory /clang/test/Analysis “has tests that are independent of the CSA”. I became curios and investigated this, which showed that practically all testcases “belong to us” and we can take ownership of the directory.
Most tests (i.e. files that contain “RUN” lines) contained either %clang_analyze_cc1 calls or %clang_cc1 calls with a separately added -analyze flag. (By the way should we standardize all these tests to use %clang_analyze_cc1?)
I listed the “exceptional” test files with
for i in $(find . -type f); do
if grep -q 'RUN' $i && ! grep -q 'clang_analyze_cc1\|-analyze\b' $i; then
echo $i;
fi;
done
and got the following list:
- PR9741.cpp
- added in 2011 Fix PR9741. The implicit declarations created for range-based for loo… · llvm/llvm-project@0c502d2 · GitHub
- single testcase to verify that CFG is correct around range-based for loops
- very basic check, probably hundreds of TCs cover it incidentally
- analyzer-list-configs.c
- tests
-analyzer-config-help
- tests
- cxx-for-range-cfg.cpp
- added in 2012
- tests another crash in CFG construction
- dead-stores.c
- analyzer test that uses
%check_analyzer_fixit
- analyzer test that uses
- func-mapping-test.cpp
- uses
%clang_extdef_map– if I understand correctly that also “belongs to” the analyzer
- uses
- method-arg-decay.m
- strange testcase from 2008 which invokes clang like
%clang_cc1 -analyzer-checker=core -verify %s - does
-analyzer-checkerautomatically imply-analyze??
- strange testcase from 2008 which invokes clang like
- preprocessor-setup.c
- tests behavior of
__clang_analyzer__
- tests behavior of
- show-checker-list.c
- tests
-analyzer-checker-help
- tests
- uninit-asm-goto.cpp
- relatively recent test file from 2020…2023
- tests
-Wuninitialized - apparently not related to the static analyzer
- uninit-sometimes.cpp
- old test file from 2012…13
- tests
-Wsometimes-uninitialized - apparently not related to the static analyzer
- builtin_signbit.cpp
- old test file from 2015, but significantly edited in the last few years
- tests LLVM internal representation generated for
__builtin_signbit() - apparently not related to the static analyzer
- RELOCATED by [CodeGen][NFC] Move test builtin_signbit.cpp to CodeGen by NagyDonat · Pull Request #127814 · llvm/llvm-project · GitHub
- analyzer-checker-option-help.c
- tests
-analyzer-checker-option-help
- tests
plus 15 .dot files under exploded-graph-rewriter/ and 9 .test files under scan-build/. (Those .dot and .test files test subprojects that “belong to” the static analyzer, so I think they clearly deserve to be here.)
Based on this I’ll find more suitable places for the three test files (uninit-asm-goto.cpp, uninit-sometimes.cpp, builtin_signbit.cpp) that are not related to the static analyzer – probably by contacting the contributors who have recent commits connected to them.
However, I think we can already start “taking ownership” of the directory as these three exceptions don’t represent a significant external interest. @Xazax-hun (or somebody else who knows the process) could you configure the github bots to tag commits editing files under /clang/test/Analysis with clang:static analyzer?
Moreover, what do you think about standardizing use of %clang_analyze_cc1 instead of %clang_cc1 ... -analyze or the strange solution in method-arg-decay.m? Should I create a commit that ensures that the analyzer is started consistently in all the test files?