[PATCH] D45697: [clang-tidy] Fix clang-tidy doesn't read .clangtidy configuration file.
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 17 06:40:49 PDT 2018
alexfh accepted this revision.
alexfh added inline comments.
This revision is now accepted and ready to land.
================
Comment at: test/clang-tidy/read_file_config.cpp:5
+// RUN: echo '[{"command": "cc -c -o test.o test.cpp", "directory": "%T/read-file-config", "file": "%T/read-file-config/test.cpp"}]' > %T/read-file-config/compile_commands.json
+// RUN: clang-tidy %T/read-file-config/test.cpp | not grep "clang-analyzer-*"
+
----------------
hokein wrote:
> alexfh wrote:
> > Please add a sanity check to ensure the code triggers the static analyzer check, when enabled explicitly:
> >
> > // RUN: clang-tidy -checks=-*,clang-analyzer-* %T/read-file-config/test.cpp | grep "clang-analyzer-*"
> >
> >
> > (hint: it won't pass, since your regex in grep is incorrect ;)
> Done. This is valid regex, but doesn't do the expect thing, we expect to match the whole check name, which should be `clang-analyzer-.*`
I didn't say the regex is //invalid//, I said it's //incorrect// (in the sense that it matches a pattern different from the one useful in this test). Anyway, thanks for the fix!
One more idea is to expand the pattern a bit to make it obvious it matches a specific static analyzer warning (`"warning: .* [clang-analyzer-specific.checker.Name]$"`).
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D45697
More information about the cfe-commits
mailing list