Skip to content

Commit

Permalink
.github: Ensure header generation before include analysis
Browse files Browse the repository at this point in the history
When running clang-include-cleaner, the tool performs static analysis by
"compiling" specified source files. Previously, non-existent included headers
caused the tool to skip source files, reducing the effectiveness of unused
include detection.

Problem:
- Header files like 'rust/wasmtime_bindings.hh' were not pre-generated
- Compilation errors led to skipping source file analysis

  ```
  /__w/scylladb/scylladb/lang/wasm.hh:15:10: fatal error: 'rust/wasmtime_bindings.hh' file not found
     15 | #include "rust/wasmtime_bindings.hh"
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  Skipping file /__w/scylladb/scylladb/lang/wasm.hh due to compiler errors. clang-include-cleaner expects to work on compilable source code.
  1 error generated.
```

- This significantly reduced clang-include-cleaner's coverage

Solution:
- Build the `wasmtime_bindings` target to generate required header files
- Ensure all necessary headers are created before running static analysis
- Enable full source file checking for unused includes

By generating headers before analysis, we prevent skipping of source files
and improve the comprehensiveness of our include cleaner workflow.

Signed-off-by: Kefu Chai <[email protected]>

Closes scylladb#21739
  • Loading branch information
tchaikov authored and denesb committed Dec 19, 2024
1 parent dc375b8 commit 2a31a82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/iwyu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
-G Ninja \
-B $BUILD_DIR \
-S .
- run: |
cmake \
--build $BUILD_DIR \
--target wasmtime_bindings
- name: Build headers
run: |
swagger_targets=''
Expand Down

0 comments on commit 2a31a82

Please sign in to comment.