Split MLIRGen.cpp: extract MLIRGenImpl into private header, move cast family to MLIRGenCast.cpp (review doc 1)#217
Merged
Conversation
… family to MLIRGenCast.cpp (review doc 1) Mechanical first slice of the TU split: MLIRGenImpl moves from MLIRGen.cpp's anonymous namespace into typescript::mlirgen in the private header MLIRGenImpl.h (bodies still inline; later slices move them out). MLIRGenCast.cpp is the first satellite TU with the 29 cast-family methods defined out-of-line. Enabling fixes: GenContext/PassResult/ValueOrLogicalResult had internal linkage (anonymous namespace in MLIRGenContext.h) and now live in namespace typescript; ts::print(Node) in dump.h is now inline; compileOptionsPtr stays TU-local behind setCompileOptions(). Verified: MLIRGenTests 12/12, ctest JIT 339/339, AOT 342/342. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 12, 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.
First mechanical slice of the §1 TU split from docs/MLIRGen-refactoring-review.md.
What
MLIRGenImpl.h(new, private tolib/TypeScript): the wholeMLIRGenImplclass moved out of MLIRGen.cpp's anonymous namespace intotypescript::mlirgen. Bodies remain inline for now; each following slice replaces one family's inline bodies with declarations and moves the definitions into a new TU.MLIRGenCast.cpp(new): first satellite TU — the contiguous cast family (selectFieldsValues…createBoundMethodFromExtensionMethod, 29 methods, ~1,600 lines) defined out-of-line. Default arguments stay on the declarations only.MLIRGen.cppshrinks to 101 lines:compileOptionsPtrstatic +getCompileOptions()/newsetCompileOptions(),SourceMgrDiagnosticHandlerExmethods, and the two public entry points.Enabling fixes (single-TU assumptions the split exposed)
GenContext/PassResult/ValueOrLogicalResultwere defined in an anonymous namespace inside a header (MLIRGenContext.h), so every TU got its own distinct types — fine with one TU, an ODR/link break with two. They now live innamespace typescript(the header already hadusing namespace ::typescript;above, so all unqualified uses keep working).ts::print(Node)ints-new-parser/dump.hwas a non-inline function defined in a header → multiply defined; nowinline.compileOptionsPtrdirectly (inline code referencing a TU-static would be an ODR trap); it callssetCompileOptions()defined in MLIRGen.cpp.Verification
MLIRGenTests12/12.🤖 Generated with Claude Code