Recognize --target=<value>/-target=<value> equals-sign form (#1158) - #5001
Open
mmido6039 wants to merge 2 commits into
Open
Recognize --target=<value>/-target=<value> equals-sign form (#1158)#5001mmido6039 wants to merge 2 commits into
mmido6039 wants to merge 2 commits into
Conversation
Support parsing of the equals-sign form of the --target option (e.g. --target=aarch64-linux-gnu) in addition to the existing space-separated form. The compilation target is now correctly stored and the original --target=<value> flag is preserved in analyzer options, ensuring the analyzer receives the intended target architecture. Add a regression test covering the equals-sign syntax and update the test to satisfy pylint.
mmido6039
force-pushed
the
fix-1158-target-equals-sign
branch
from
August 2, 2026 21:48
c12f112 to
0ee5586
Compare
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 #1158
Problem
CodeChecker did not differentiate compile database entries with
different Clang
-targetswitches, as described in the issue.Root cause
__get_target()in log_parser.py only matched the space-separatedform of the target flag ('-target ' / '--target ').
The equals-sign form ('--target=' / '-target='), a
very common cross-compilation syntax, was not recognized at all and
fell through unhandled. As a result, the explicitly requested target
was silently dropped, and the compiler's own native default target
was used instead (verified directly:
clang++ --target=aarch64-linux-gnuended up analyzed as
x86_64-pc-linux-gnuon the test machine).Fix
Extended
__get_target()to also recognize and strip the'--target='/'-target=' prefix form, in addition to the existing
space-separated form.
Testing
Added a regression test (test_target_equals_sign_form) with a new
fixture covering both the equals-sign and space-separated forms for
the same source file, asserting the exact resolved target for each -
the existing similarly-named test only asserted
len(target) > 0,which would not have caught this regression. All tests in
test_log_parser.py pass; pycodestyle clean.
Known follow-up (out of scope for this PR)
The compiler-info caching key (used to cache implicit include paths/
standard/target per compiler+language+flags) also does not account
for an explicit target, so two different
--target=values on thesame compiler binary could still share cached compiler_includes.
Fixing that touches the persisted compiler_info.json cache format
and felt like a separate, riskier change - happy to follow up in a
second PR if useful.