You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update rules for clang-tidy and clang --analyze (#125)
Why:
Bazel rules for clang-tidy and clang --analyze
were never updated and never tested on real projects.
What:
- Collect sources and headers in transitive dependencies
- Support platform transitions (for multi platform projects)
- Simplify launcher scripts, bazelify parameters
- Fix plist generation for clang --analyze
- Support config file to accept input from a file_group
- Remove clang-tidy aspect since it is not actually used
- Minor cosmetic changes
- Test on some of real Ericsson projects
- Updated README
Copy file name to clipboardExpand all lines: README.md
+11-15Lines changed: 11 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,8 +21,8 @@ The main Bazel rule for CodeChecker is `codechecker_test()`.
21
21
22
22
### Clang-tidy
23
23
24
-
Clang-tidy is a fast static analyzer/linter for the C family of languages. This
25
-
repository provides Bazel aspect `clang_tidy_aspect()` and rule `clang_tidy_test()`
24
+
Clang-tidy is a fast static analyzer/linter for the C family of languages.
25
+
This repository provides Bazel rule `clang_tidy_test()`
26
26
to run clang-tidy natively (without CodeChecker).
27
27
28
28
Find more information about LLVM clang-tidy:
@@ -313,9 +313,10 @@ codechecker_test(
313
313
314
314
The following rules are _not_ using CodeChecker.
315
315
316
-
### Clang-tidy: `clang_tidy_aspect()` and `clang_tidy_test()`
316
+
### Clang-tidy: `clang_tidy_test()`
317
317
318
-
The Bazel rule `clang_tidy_test()` runs clang-tidy natively without CodeChecker. To use it, add the following to your BUILD file:
318
+
The Bazel rule `clang_tidy_test()` runs clang-tidy natively without CodeChecker.
319
+
To use it, add the following to your BUILD file:
319
320
320
321
```python
321
322
load(
@@ -331,15 +332,11 @@ clang_tidy_test(
331
332
)
332
333
```
333
334
334
-
You can also run clang-tidy via the Bazel aspect `clang_tidy_aspect()` that can be invoked from the command line by passing the following parameter to Bazel build/test: `--aspects @codechecker_bazel//src:clang.bzl%clang_tidy_aspect`:
The Bazel rule `clang_analyze_test()` runs The Clang Static Analyzer natively without CodeChecker. To use it, add the following to your BUILD file:
337
+
The Bazel rule `clang_analyze_test()` runs The Clang Static Analyzer
338
+
natively without CodeChecker.
339
+
To use it, add the following to your BUILD file:
343
340
344
341
```python
345
342
load(
@@ -355,6 +352,9 @@ clang_analyze_test(
355
352
)
356
353
```
357
354
355
+
> [!Note]
356
+
> Currently `clang_analyze_test()` rule does not support CTU (Cross Translation Unit) analysis.
357
+
358
358
### Generating a compilation database: `compile_commands()`
359
359
360
360
As generating a compilation database for C/C++ is a known pain point for bazel, this repository defines the Bazel rule `compile_commands()` rule which can be used independently of CodeChecker. The implementation is based on https://github.com/grailbio/bazel-compilation-database with some fixes on some tricky edge cases. To use it, include the following in your BUILD file:
@@ -420,7 +420,3 @@ After that you can find all artifacts in `bazel-bin` directory:
0 commit comments