Add configurable argument filter for mx-index#584
Merged
Conversation
Skip TypeForDeclaration() type printing for TypedefNameDecls during fragment hashing. The typedef body tokens are already captured in the fragment's token range. The type printer can produce different output across TUs depending on how much type sugar Clang preserved, causing the same typedef to hash differently and create duplicate fragments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the hardcoded if/else chain in GetCompilerInfo() with a data-driven argument filter loaded from share/multiplier/unsupported_args.cfg. The config file uses a simple text format (exact/prefix/contains match types with optional following-argument counts) and is installed alongside the mx-index binary. At startup, mx-index locates the default config relative to its own executable path (<prefix>/share/multiplier/unsupported_args.cfg) via llvm::sys::fs::getMainExecutable. Users can supply additional patterns with --extra_arg_patterns <file> to augment the defaults. The default config includes all previously hardcoded patterns plus comprehensive coverage of GCC-specific flags not supported by Clang (--param, -fplugin, -fipa-*, -mrecord-mcount, kernel-common x86 flags, etc.) and flags removed from recent Clang versions (pass manager flags, -fmodules-ts, -fcoroutines-ts, etc.). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Guard the unsupported_args.cfg copy command with a path comparison so that it is skipped when PROJECT_BINARY_DIR == PROJECT_SOURCE_DIR (or the resolved paths otherwise collide). This avoids the ninja error "dependency cycle: share/multiplier/unsupported_args.cfg -> ..." in CI builds that reuse the source tree as the build tree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kumarak
approved these changes
Apr 20, 2026
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.
Summary
if/elsechain inGetCompilerInfo()with a data-drivenArgumentFilterclass that loads patterns from a config file at startupshare/multiplier/unsupported_args.cfgalongsidemx-index; the binary locates it at runtime relative to its own executable path viallvm::sys::fs::getMainExecutable--extra_arg_patterns <file>flag so users can supply additional patterns that augment the defaults without modifying the installed configexact/prefix/containsmatch types with optional following-argument counts (Nfor unconditional,~Nfor lenient skip that handles malformed compile databases like the Linux kernel's)--param,-fplugin=,-fipa-*,-mrecord-mcount, kernel x86 flags, etc.) and flags removed from recent Clang versions (pass manager flags,-fmodules-ts,-fcoroutines-ts, etc.)Test plan
unsupported_args.cfgappears in<build>/share/multiplier/compile_commands.json(e.g. Linux kernel) and verify no "unknown argument" errors from GCC-only flags--extra_arg_patternswith a custom file to confirm patterns are appendedcmake --installplaces the config into<prefix>/share/multiplier/🤖 Generated with Claude Code