-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[MC,ELF] Emit warning if a string constant contains newline char #98060
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
Merged
s-barannikov
merged 17 commits into
llvm:main
from
chestnykh:warn-newline-in-string-constant
Jul 16, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5ba8182
[MC,ELF] Emit warning if a string constant contains newline char.
chestnykh 9cbe1ce
[MC,ELF] Move warning handling to parser code
chestnykh 8cc91db
[MC,AsmParser] Warn about newlines in some cases
chestnykh 02b6535
[MC,AMDGPU] Correct code format
chestnykh 602019f
[MC,AsmParser] Rework `parseEscapedString`
chestnykh deeed1d
[MC,AsmParser] Rework test to newline warnings.
chestnykh c2baa2c
[MC,AsmParser] Adjuct test to newline warnings
chestnykh b30d756
[MC,AsmParser] Correct code style
chestnykh b866eff
[MC,AsmParser] Refactor AsmParser.c and the test
chestnykh 3cbfa5f
[MC,AsmParser] Remove unneeded filename from the test
chestnykh 91f2c7f
[MC,AsmParser] Refactor test
chestnykh b43c4fa
[MC] Use x86_64 as triple in test
chestnykh 60392b7
[MC, ELF] Refactor test
chestnykh 2f517c3
[MC,ELF] Refactor the test
chestnykh d8cd073
[MC,ELF] Simplify `--implicit-check-not` argument
chestnykh f1264d4
[MC,ELF] Add missed colon
chestnykh de4772d
[MC,ELF] Add needed indent
chestnykh 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null \ | ||
// RUN: | FileCheck %s --implicit-check-not=warning: | ||
|
||
.string "abcd\xFFefg | ||
12345678" | ||
|
||
// CHECK: [[#@LINE-3]]:21: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: .string "abcd\xFFefg | ||
|
||
.ascii "some test ascii | ||
|
||
sequence | ||
with | ||
newlines\x0A | ||
" | ||
|
||
// CHECK: [[#@LINE-7]]:24: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: .ascii "some test ascii | ||
// CHECK: [[#@LINE-8]]:1: warning: unterminated string; newline inserted | ||
// CHECK: [[#@LINE-8]]:9: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: sequence | ||
// CHECK: [[#@LINE-9]]:5: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: with | ||
// CHECK: [[#@LINE-10]]:13: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: newlines\x0A | ||
|
||
.asciz "another test string | ||
|
||
with | ||
newline characters | ||
|
||
|
||
" | ||
|
||
// CHECK: [[#@LINE-8]]:28: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: .asciz "another test string | ||
// CHECK: [[#@LINE-9]]:1: warning: unterminated string; newline inserted | ||
// CHECK: [[#@LINE-9]]:5: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: with | ||
// CHECK: [[#@LINE-10]]:19: warning: unterminated string; newline inserted | ||
// CHECK-NEXT: newline characters | ||
// CHECK: [[#@LINE-11]]:1: warning: unterminated string; newline inserted | ||
// CHECK: [[#@LINE-11]]:1: warning: unterminated string; newline inserted | ||
|
||
.file "warn-newline | ||
.s" | ||
// CHECK: [[#@LINE-2]]:20: warning: unterminated string; newline inserted | ||
|
||
.cv_file 1 "some_an | ||
other_file.s" | ||
// CHECK: [[#@LINE-2]]:20: warning: unterminated string; newline inserted | ||
|
||
.ascii "test\nvalid1_string\xFF\n\n\xFF" | ||
.asciz "\n\n\nvalid2_string\x0A" | ||
.string "1234\nvalid3_string\xFF\n\xFF\n" |
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.
Uh oh!
There was an error while loading. Please reload this page.