Repository navigation
Fix nested managed ilasm preprocessor conditionals - #137441
Merged
jkoritzinsky merged 2 commits intoNov 14, 2026
Merged
jkoritzinsky merged 2 commits into
jkoritzinsky merged 2 commits into
Conversation
Process directives after conditional transitions, balance active conditional state, and track nested ifndef blocks while skipping disabled input. Add regression coverage for nested macro selection and conditional transitions. Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the nested-conditional preprocessor changes.
No open issues 🎉
What changed in this PR
This PR fixes nested conditional handling in the managed IL assembler’s preprocessor, ensuring the selected branches and macros are processed correctly.
Changes:
- Restore the active conditional stack when leaving a block and process adjacent directives immediately.
- Recognize nested
#ifndefdirectives while skipping disabled input. - Add regression tests for architecture-dependent macro selection, disabled nested branches, and conditional-state restoration.
| File | Description |
|---|---|
src/tools/ilasm/tests/ILAssembler.Tests/PreprocessedTokenSourceTests.cs |
Adds parameterized coverage for nested and adjacent conditionals. |
src/tools/ilasm/src/ILAssembler/PreprocessedTokenSource.cs |
Fixes conditional-stack restoration, directive processing, and nested #ifndef recognition. |
Review effort: Balanced
jkotas
approved these changes
Nov 12, 2026
3 tasks
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
#ifndefblocks while skipping disabled input.Validation
.\dotnet.cmd build src\tools\ilasm\src\ilasm\ilasm_inbuild.csproj -c Debug -p:NuGetAudit=false -v:q -nologo: passed..\dotnet.cmd test src\tools\ilasm\tests\ILAssembler.Tests -f net11.0 -p:NuGetAudit=false --filter "FullyQualifiedName~PreprocessedTokenSource" -v:q -nologo: passed (34 tests).Resolves #137424
Note
This PR description was generated with GitHub Copilot.