[snippy] Reject function-number/function-layers with explicit call-graph#420
Open
MaxGud10 wants to merge 1 commit into
Open
[snippy] Reject function-number/function-layers with explicit call-graph#420MaxGud10 wants to merge 1 commit into
MaxGud10 wants to merge 1 commit into
Conversation
arromanoff
reviewed
Apr 14, 2026
| # CHECK: error: Options "function-number" cannot be used together with "call-graph" | ||
|
|
||
| options: | ||
| mtriple: riscv64-unknown-elf |
Contributor
There was a problem hiding this comment.
Suggested change
| mtriple: riscv64-unknown-elf | |
| mtriple: riscv64 |
Comment on lines
+12
to
+27
| sections: | ||
| - name: text | ||
| VMA: 0x210000 | ||
| SIZE: 0x100000 | ||
| LMA: 0x210000 | ||
| ACCESS: rx | ||
| - name: data | ||
| VMA: 0x100000 | ||
| SIZE: 0x50000 | ||
| LMA: 0x100000 | ||
| ACCESS: rw | ||
| - name: rodata | ||
| VMA: 0x310000 | ||
| SIZE: 0x50000 | ||
| LMA: 0x360000 | ||
| ACCESS: r |
Contributor
There was a problem hiding this comment.
reuse sections from Inputs/ directory if possible
Comment on lines
+37
to
+38
| static bool isFunctionLayersSpecified(); | ||
| static bool isFunctionNumberSpecified(); |
Comment on lines
+1067
to
+1084
| if (std::holds_alternative<FunctionDescs>(Info.PassCfg.CGLayout)) { | ||
| std::string ConflictingOpts; | ||
|
|
||
| if (CallGraphLayout::isFunctionNumberSpecified()) | ||
| ConflictingOpts = "function-number"; | ||
|
|
||
| if (CallGraphLayout::isFunctionLayersSpecified()) { | ||
| if (!ConflictingOpts.empty()) | ||
| ConflictingOpts += ", "; | ||
| ConflictingOpts += "function-layers"; | ||
| } | ||
|
|
||
| if (!ConflictingOpts.empty()) | ||
| return formatv("Options \"{0}\" cannot be used together with " | ||
| "\"call-graph\"", | ||
| ConflictingOpts) | ||
| .str(); | ||
| } |
Contributor
There was a problem hiding this comment.
I understand what you want to achieve here but let's just report them separately.
With 2 separate return's
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.
Fixes #405
Previously, when an explicit call-graph was provided, function-number was
silently ignored instead of being diagnosed as an invalid configuration.
This change rejects configurations that specify an explicit call-graph together
with function-number or function-layers.
Added a regression test based on the reproducer from the issue.
Updated existing tests that used now-invalid config combinations.