Repository navigation
fix: split compilation database command strings with shell quoting rules - #10
Open
code-steadfast wants to merge 2 commits into
Open
code-steadfast wants to merge 2 commits into
code-steadfast wants to merge 2 commits into
Conversation
Owner
|
I think |
code-steadfast
force-pushed
the
fix/compile-command-quoted-defines
branch
from
October 5, 2026 19:37
5930646 to
cb076ef
Compare
A compile_commands.json record may carry its flags as `command`, a single string the shell would have tokenized. Splitting it with `str.split()` kept the quotes, so an empty define written by CMake as `-DMACRO=""` reached libclang as the string literal `""`. A declaration starting with such a macro no longer parsed as a function and disappeared from `docs` output with no diagnostic. `shlex.split()` is not a drop-in replacement: in POSIX mode it treats the backslashes in a Windows compiler path as escapes, so `-IC:\inc` arrives as `-IC:inc`. Disabling escapes outright is wrong in the other direction, because a POSIX string define is written `-DVERSION=\"1.0\"` and those backslashes have to resolve. Drive `shlex` directly and disable escaping only on Windows, so the backslash rule follows the shell that wrote the command.
code-steadfast
force-pushed
the
fix/compile-command-quoted-defines
branch
from
October 5, 2026 19:54
cb076ef to
881a2d6
Compare
Author
|
You are right. Fixed it with if os.name == "nt" and added the POSIX test case for -DVERSION="1.0". |
libclang only received the -I and -D options, so headers found through -isystem were missing. Code inside #if blocks that depend on such a header was skipped, for example gtest test cases guarded by a KConfig symbol from autoconf.h. Also apply ruff-format to one test string. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
I suggest we do not add the |
This branch had an error being 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.
A compile_commands.json record may carry its flags as
command, a single string the shell would have tokenized. Splitting it withstr.split()kept the quotes, so an empty define written by CMake as-DMACRO=""reached libclang as the string literal"". A declaration starting with such a macro no longer parsed as a function and disappeared fromdocsoutput with no diagnostic.shlex.split()is not a drop-in replacement: in POSIX mode it treats the backslashes in a Windows compiler path as escapes. Driveshlexdirectly with escaping disabled instead, so quotes are stripped and backslashes stay literal.