Skip to content

Add configurable argument filter for mx-index#584

Merged
kumarak merged 3 commits intomainfrom
fix/indexer-improvements
Apr 20, 2026
Merged

Add configurable argument filter for mx-index#584
kumarak merged 3 commits intomainfrom
fix/indexer-improvements

Conversation

@pgoodman
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the hardcoded ~60-line if/else chain in GetCompilerInfo() with a data-driven ArgumentFilter class that loads patterns from a config file at startup
  • Installs share/multiplier/unsupported_args.cfg alongside mx-index; the binary locates it at runtime relative to its own executable path via llvm::sys::fs::getMainExecutable
  • Adds --extra_arg_patterns <file> flag so users can supply additional patterns that augment the defaults without modifying the installed config
  • Config format supports exact/prefix/contains match types with optional following-argument counts (N for unconditional, ~N for lenient skip that handles malformed compile databases like the Linux kernel's)
  • Expands coverage from ~30 patterns to 135, adding GCC-specific flags (--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

  • Build mx-index and verify unsupported_args.cfg appears in <build>/share/multiplier/
  • Run mx-index on a GCC-built compile_commands.json (e.g. Linux kernel) and verify no "unknown argument" errors from GCC-only flags
  • Test --extra_arg_patterns with a custom file to confirm patterns are appended
  • Verify cmake --install places the config into <prefix>/share/multiplier/

🤖 Generated with Claude Code

pgoodman and others added 3 commits April 17, 2026 22:15
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>
@pgoodman pgoodman requested a review from kumarak April 19, 2026 23:11
@kumarak kumarak merged commit a784e63 into main Apr 20, 2026
2 checks passed
@pgoodman pgoodman deleted the fix/indexer-improvements branch April 20, 2026 15:16
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