Add argument to parse headers via a source's flags#58
Merged
compnerd merged 5 commits intoMay 22, 2026
Conversation
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.
36 tasks
compnerd
reviewed
May 13, 2026
compnerd
reviewed
May 21, 2026
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
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
approved these changes
May 22, 2026
Steelskin
added a commit
to Steelskin/llvm-project
that referenced
this pull request
Jun 10, 2026
In compnerd/ids#58, support was added to parse a header file using a given source file's flags. This solves many of the issues we had encountered with the `ids-check-helper.py` script and its corresponding workflow. * Update ids to the current version, which includes the `--main-file` changes. * Use a more recent LLVM compiler to build a subset of LLVM. * Build a subset of LLVM targets to properly parse more header files. * Use the `--main-file` argument when invoking `idt`. * Add explicit overrides and exclude header lists. This was tested on every public header in LLVM and forthcoming PRs will land the changes found with the updated script. Once all of the headers have been updated, the workflow will be re-enabled. This effort is tracked in llvm#109483.
Steelskin
added a commit
to llvm/llvm-project
that referenced
this pull request
Jun 10, 2026
In compnerd/ids#58, support was added to parse a header file using a given source file's flags. This solves many of the issues we had encountered with the `ids-check-helper.py` script and its corresponding workflow. * Update ids to the current version, which includes the `--main-file` changes. * Use a more recent LLVM compiler to build a subset of LLVM. * Build a subset of LLVM targets to properly parse more header files. * Use the `--main-file` argument when invoking `idt`. * Add explicit overrides and exclude header lists. This was tested on every public header in LLVM and forthcoming PRs will land the changes found with the updated script. Once all of the headers have been updated, the workflow will be re-enabled. This effort is tracked in #109483.
llvm-upstreamsync Bot
pushed a commit
to qualcomm/cpullvm-toolchain
that referenced
this pull request
Jun 10, 2026
In compnerd/ids#58, support was added to parse a header file using a given source file's flags. This solves many of the issues we had encountered with the `ids-check-helper.py` script and its corresponding workflow. * Update ids to the current version, which includes the `--main-file` changes. * Use a more recent LLVM compiler to build a subset of LLVM. * Build a subset of LLVM targets to properly parse more header files. * Use the `--main-file` argument when invoking `idt`. * Add explicit overrides and exclude header lists. This was tested on every public header in LLVM and forthcoming PRs will land the changes found with the updated script. Once all of the headers have been updated, the workflow will be re-enabled. This effort is tracked in #109483.
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.
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-fileis set to prevent spilling of fixits outside of the positional input. The helper is a no-op otherwise, preserving existing behavior.