Repository navigation
[analyzer] Warn when CTU merge drops a USR defined in several TUs - #5189
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
The externalDefMap merge kept a mangled name only when it mapped to one AST file and dropped every other name without a log. Clang then skips those functions for CTU inlining, so defects reachable only that way are missed. Warn with the USR and the AST paths, and still drop it. Fixes Ericsson#5086 Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
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.
Fixes #5086
During CTU pre-analysis,
merge_clang_extdef_mappingsbuilds oneexternalDefMap.txtfrom the per-TU maps. A USR that appears in more than one AST file is omitted from that map and nothing is logged. Clang then has no definition to inline, so defects that are reachable only through CTU are not reported. The same name in different source files is a normal case; the compilation database does not have to list one file twice.The merge still drops those USRs. It now logs a warning with the USR and the AST paths.
CodeChecker analyzealready configures theanalyzerlogger, so the warning uses that channel when it has handlers. The standalonemerge-clang-extdef-mappingstool keeps usingMergeClangExtdefMappings. Choosing which definition to keep (theusr-uniqueingidea on the issue) is left out: that would change which body CTU inlines, and this change only makes the current drop visible.Tests in
analyzer/tools/merge_clang_extdef_mappings/tests/unitfeed two map files that sharec:@F@both#and otherwise unique names. Before the change the shared USR is absent from the merged map and no warning is emitted. After the change the unique names are still merged, the shared USR is still absent, and exactly one warning names that USR and both AST paths. A second test attaches a handler to theanalyzerlogger and checks the warning is emitted there.This change was prepared with the help of an AI coding assistant.