Skip to content

[capture] report failed compilation database commands under --keep-going - #2316

Open
VladimirMakaev wants to merge 1 commit into
meta:mainfrom
VladimirMakaev:capture-compilation-db-failures
Open

VladimirMakaev wants to merge 1 commit into
meta:mainfrom
VladimirMakaev:capture-compilation-db-failures

Conversation

@VladimirMakaev

Copy link
Copy Markdown
Contributor

With --keep-going, Infer logged a failed compilation database command at debug level only.
The compiler's own errors reached the console, mixed into the progress output, but the run
exited 0 with no summary of how many files were lost or captured partially, or which ones.

# compile_commands.json: a.c compiles, the command of b.c has an unknown flag
infer --keep-going --compilation-database compile_commands.json
# before: exit code 0; only clang's own errors, mixed into the progress output, show
#         that b.c was lost
# now: WARNING: 1 of 2 compilation commands failed, starting with the one for b.c.

The warning gives the number of failed commands and the first failing file in database order,
and points to the logs file, which still has the errors of each command. The count is also
logged in the stats as count.capture.failed_compilation_commands.

Test plan

New build_systems test clang_compilation_db_failures: one file compiles, one has a syntax error
(captured partially), and the command of one has an unknown flag (not captured). It checks the
warning and the issues. The codetoanalyze tests pass.

With `--keep-going`, Infer logged a failed compilation database command at debug level only.
The compiler's own errors reached the console, mixed into the progress output, but the run
exited 0 with no summary of how many files were lost or captured partially, or which ones.

```sh
# compile_commands.json: a.c compiles, the command of b.c has an unknown flag
infer --keep-going --compilation-database compile_commands.json
# before: exit code 0; only clang's own errors, mixed into the progress output, show
#         that b.c was lost
# now: WARNING: 1 of 2 compilation commands failed, starting with the one for b.c.
```

The warning gives the number of failed commands and the first failing file in database order,
and points to the logs file, which still has the errors of each command. The count is also
logged in the stats as `count.capture.failed_compilation_commands`.

## Test plan

New build_systems test `clang_compilation_db_failures`: one file compiles, one has a syntax error
(captured partially), and the command of one has an unknown flag (not captured). It checks the
warning and the issues. The codetoanalyze tests pass.
@meta-cla meta-cla Bot added the CLA Signed label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant