This is an archive of the discontinued LLVM Phabricator instance.

[clang-tools-extra] [cmake] Support running extra clang tool tests without static analyzer
ClosedPublic

Authored by mgorny on Aug 27 2017, 3:18 AM.

Details

Summary

Support running the extra clang tool tests when the static analyzer
is disabled. Disable the relevant clang-tidy tests and one include-fixer
test that require it to work.

Previously, the tests were disabled entirely with
CLANG_ENABLE_STATIC_ANALYZER being false. Now, the tests are being
enabled and the relevant tests are excluded and marked unsupported
appropriately.

In order to disable clang-tidy tests, the whole test directory is added
to the exclude lists, to avoid having to explicitly add 'REQUIRES' line
to every single test. If the other solution is preferable, I can update
the patch.

The yamldb_plugin include-fixer test is also updated to be disabled
without static analyzer. It fails in that case because clang is not
outputting a replacement suggestion -- but I don't know the exact
reason why it does not do that.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Aug 27 2017, 3:18 AM
mgorny added inline comments.
test/include-fixer/yamldb_plugin.cpp
7 ↗(On Diff #112811)

Differential is showing this a bit weird, all that's changed here and below are adjusted line numbers.

alexfh edited edge metadata.Aug 28 2017, 8:04 AM

This could be done even more granularly, since clang-tidy only needs static analyzer to run clang-analyzer-* checks. But that would involve some careful #ifdef-ing of the parts of clang-tidy/ClangTidy.cpp, so I'll understand if you say you have little interest in this.

IIUC, these are the only clang-tidy tests that need static analyzer:

clang/tools/extra/test/clang-tidy/nolint.cpp
clang/tools/extra/test/clang-tidy/static-analyzer.cpp
clang/tools/extra/test/clang-tidy/static-analyzer-config.cpp
clang/tools/extra/test/clang-tidy/temporaries.cpp

as well as the mpi module and its tests:
clang/tools/extra/clang-tidy/mpi/*
clang/tools/extra/test/clang-tidy/mpi-buffer-deref.cpp
clang/tools/extra/test/clang-tidy/mpi-type-mismatch.cpp

I might be missing something but currently clang-tidy is not built at all when static analyzer is disabled.

alexfh accepted this revision.Aug 28 2017, 5:36 PM

I might be missing something but currently clang-tidy is not built at all when static analyzer is disabled.

Yes, but it could be built except for the parts that actually need the static analyzer. As I've said, this would require careful surgery of ClangTidy.cpp and of some other files.

We can do that later.

LG

This revision is now accepted and ready to land.Aug 28 2017, 5:36 PM

Thanks for the clarification.

This revision was automatically updated to reflect the committed changes.