[DRAFT] [backend] analyze procedures defined in changed headers - #2151
Draft
VladimirMakaev wants to merge 1 commit into
Draft
VladimirMakaev wants to merge 1 commit into
VladimirMakaev wants to merge 1 commit into
Conversation
VladimirMakaev
force-pushed
the
changed-files-index-headers
branch
from
October 2, 2026 20:00
094cdc4 to
6b24a53
Compare
With `--changed-files-index`, a changed header only selects the source file with the same name, so
procedures defined in headers (inline functions, in-class methods, templates) are not analyzed when
only the header changes.
```cpp
// include/widget.h; changed files index: include/widget.h
inline int widget_get() {
int* p = nullptr;
return *p; // Infer missed: null dereference
}
// src/user.cpp, unchanged
#include "widget.h"
int use_widget() { return widget_get(); }
```
Now, for each procedure defined in a changed header, a captured source file that contains it is
analyzed too, and `--incremental-analysis` invalidates these procedures. With
`--compilation-database`, Infer warns about changed headers whose includers were not captured.
Limitations: such files are analyzed in full, so their unrelated issues are reported too, and the
file chosen for a header can change between versions, which `reportdiff` shows as fixed or
introduced issues.
## Test plan
New build system tests `incremental_analysis_change_header` and `differential_changed_header`;
`clang_compilation_db_headers` also covers a partial index and a template used by two files. These,
the other `clang_compilation_db*` and `incremental_analysis_*` tests and the codetoanalyze tests
pass.
VladimirMakaev
force-pushed
the
changed-files-index-headers
branch
from
October 3, 2026 21:52
6b24a53 to
61b4da7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
--changed-files-index, a changed header only selects the source file with the same name, soprocedures defined in headers (inline functions, in-class methods, templates) are not analyzed when
only the header changes.
Now, for each procedure defined in a changed header, a captured source file that contains it is
analyzed too, and
--incremental-analysisinvalidates these procedures. With--compilation-database, Infer warns about changed headers whose includers were not captured.Limitations: such files are analyzed in full, so their unrelated issues are reported too, and the
file chosen for a header can change between versions, which
reportdiffshows as fixed orintroduced issues.
Test plan
New build system tests
incremental_analysis_change_headeranddifferential_changed_header;clang_compilation_db_headersalso covers a partial index and a template used by two files. These,the other
clang_compilation_db*andincremental_analysis_*tests and the codetoanalyze testspass.