-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Improve diagnostics for constraints of inline asm (NFC) #96363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
e-kud
wants to merge
3
commits into
llvm:main
Choose a base branch
from
e-kud:iasm-errors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -309,6 +309,39 @@ def err_asm_invalid_type : Error< | |||||||||
def err_ms_asm_bitfield_unsupported : Error< | ||||||||||
"an inline asm block cannot have an operand which is a bit-field">; | ||||||||||
|
||||||||||
def asm_invalid_constraint_generic : TextSubstitution< | ||||||||||
"invalid %select{input|output}0 constraint '%1' in asm">; | ||||||||||
def err_asm_invalid_constraint : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1">; | ||||||||||
def err_asm_invalid_constraint_start : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: output constraint must start with" | ||||||||||
" '=' or '+'">; | ||||||||||
def err_asm_invalid_constraint_rw_clobber : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: early clobber with a read-write" | ||||||||||
" constraint must be a register">; | ||||||||||
def err_asm_invalid_constraint_mem_or_reg : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: constraint must allow either" | ||||||||||
" memory or register operands">; | ||||||||||
def err_asm_invalid_constraint_missing_bracket : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: missing ']'">; | ||||||||||
def err_asm_invalid_constraint_wrong_symbol : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: cannot find an output constraint" | ||||||||||
" with the specified name">; | ||||||||||
def err_asm_invalid_constraint_empty : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: empty constraint has been" | ||||||||||
" provided">; | ||||||||||
def err_asm_invalid_constraint_oob : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: the index is out of bounds">; | ||||||||||
def err_asm_invalid_constraint_missing : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: references to a non-existing output" | ||||||||||
" constraint">; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
nit |
||||||||||
def err_asm_invalid_constraint_wrongly_tied : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: tied constraint must be tied to" | ||||||||||
" the same operand referenced to by the number">; | ||||||||||
def err_asm_invalid_constraint_output_only : Error< | ||||||||||
"%sub{asm_invalid_constraint_generic}0,1: must refer to an output only" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
another nit here too |
||||||||||
" operand">; | ||||||||||
|
||||||||||
def warn_stack_clash_protection_inline_asm : Warning< | ||||||||||
"unable to protect inline asm that clobbers stack pointer against stack " | ||||||||||
"clash">, InGroup<DiagGroup<"stack-protector">>; | ||||||||||
|
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has to be a corresponding output constraint with the same name as I understand it? This confused me a bit just now while I was looking at the tests, so maybe something like this would make that a bit clearer?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is similar to digits. From GCC reference: