Skip to content

Add argument to parse headers via a source's flags#58

Merged
compnerd merged 5 commits into
compnerd:mainfrom
Steelskin:fabrice/add-cdb-source-parameter
May 22, 2026
Merged

Add argument to parse headers via a source's flags#58
compnerd merged 5 commits into
compnerd:mainfrom
Steelskin:fabrice/add-cdb-source-parameter

Conversation

@Steelskin
Copy link
Copy Markdown
Contributor

@Steelskin Steelskin commented May 7, 2026

idt requires input to have an entry in the compilation database in order to be properly parsed. This is not always the case when parsing headers, depending on the project configuration.

This change adds --main-file=<path>. When set, idt looks up <path> in the compilation database and adjusts the command line to parse the positional argument with the same flags as <path>, assuming that the positional argument is a header.

Fixits are gated behind the is_in_main_tu() helper when --main-file is set to prevent spilling of fixits outside of the positional input. The helper is a no-op otherwise, preserving existing behavior.

idt requires input to have an entry in the compilation database in order
to be properly parsed. This is not always the case when parsing headers,
depending on the project configuration.

This change adds `--cdb-source=<path>`. When set, idt looks up `<path>`
in the compilation database and adjusts the command line to parse the
positional argument with the same flags as `<path>`, assuming that the
positional argument is a header.

Fixits are gated behind the `is_in_main_tu()` helper when `--cdb-source`
is set to prevent spilling of fixits outside of the positional input.
The helper is a no-op otherwise, preserving existing behavior.
Comment thread Sources/idt/idt.cc Outdated
Comment thread Sources/idt/idt.cc Outdated
Comment thread Sources/idt/idt.cc Outdated
@Steelskin Steelskin requested a review from compnerd May 19, 2026 08:24
Comment thread Sources/idt/idt.cc Outdated
Comment thread Sources/idt/idt.cc
Comment thread Sources/idt/idt.cc Outdated
Comment thread Sources/idt/idt.cc Outdated
compnerd and others added 2 commits May 21, 2026 16:28
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
@Steelskin Steelskin requested a review from compnerd May 22, 2026 15:05
@Steelskin
Copy link
Copy Markdown
Contributor Author

@compnerd It looks like I can't run the workflow to double-check this is working as expected, though the tests pass on my machine.

@compnerd compnerd merged commit 6d9b77c into compnerd:main May 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants