Skip to content

Accept name filters and exclusions in --export - #321

Merged
ASDAlexander77 merged 1 commit into
mainfrom
export-filters
Sep 14, 2026
Merged

Accept name filters and exclusions in --export#321
ASDAlexander77 merged 1 commit into
mainfrom
export-filters

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

  • --export is now a comma-separated list instead of the all/none enum. Existing --export=all and --export=none behave as before.
  • A name exports that declaration even without the export keyword. It matches the short or namespaced name (add, M.add) and accepts globs (M.*).
  • !name excludes a name and always wins over an including filter. With only exclusions (--export=!sub) the export keyword decides, minus the excluded names.
  • Class and interface members are filtered by their owner's name. Each variable of one export let a, b statement is decided on its own.
  • The rules live in MLIRExportFilter.h (isExportedByFilters), used by getExportModifier.

Example: --export=M.*,!M.internal*,!M.b

Note: in bash, quote values containing ! ('--export=!sub').

Test plan

  • New ExportFilterTest unit tests (7) pass; MLIRGenTests 66/66
  • All 268 shared-library ctest tests pass
  • DLL export tables checked with llvm-objdump -p for no option, none, M.add,sub, !sub and M.*,!M.internal*,!M.b: each exports exactly the expected symbols, including per-variable filtering of export let a = 1, b = 2
  • Known, not changed here: --export=all on a DLL that uses the default lib fails to link (LNK1242, a default-lib generic instantiation gets an invalid export name). A compiler built before this change fails the same way.

🤖 Generated with Claude Code

@ASDAlexander77
ASDAlexander77 merged commit 24b4209 into main Sep 14, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the export-filters branch September 14, 2026 10:28
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.

1 participant