AFAIK the only difference between %clang_cc1 and %clang_analyze_cc1 that the latter inserts a placeholder which is going to be replaced by the appropriate constraint manager.
This placeholder was placed by the llvm/utils/lit/lit/llvm/config.py:
ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze', '-setup-static-analyzer']+additional_flags), ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags),
The constraint manager could either the ranged based CM or the Z3 based CM, depending on the test environment and configuration.
Relevant code, that substitutes the %analyzer placeholder first to the range based one, then to the z3 based one:
if 'z3' not in test.requires: results.append(self.executeWithAnalyzeSubstitution( saved_test, litConfig, '-analyzer-constraints=range')) if results[-1].code == lit.Test.FAIL: return results[-1] # If z3 backend available, add an additional run line for it if self.use_z3_solver == '1': assert(test.config.clang_staticanalyzer_z3 == '1') results.append(self.executeWithAnalyzeSubstitution( saved_test, litConfig, '-analyzer-constraints=z3 -DANALYZER_CM_Z3'))
After seeing all of the relevant code segments, I assume that %clang_analyze_cc1 should be ONLY USED if the test author wants to run ALL available constraint managers on each RUN command.
So, if the code depends on a specific constraint manager, it should use the %clang_cc1 placeholder instead, and explicitly state which CM it depends on.
We could also introduce a new joker command (like %clang_analyze_cc1_ranged or something similar) in the llvm/utils/lit/lit/llvm/config.py if it's more appropriate.
On the cfe-dev mailing list we had a related discussion, dealing with this subject in more depth:
ClangSA tests that 'REQUIRES: z3' won't run even if you have z3 installed