[llvm] [MC,ELF] Emit warning if a string constant contains newline char (PR #98060)
Dmitriy Chestnykh via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 19:33:39 PDT 2024
https://github.com/chestnykh updated https://github.com/llvm/llvm-project/pull/98060
>From 5ba8182d86bfbd943c235a7df7522f22e7fa84bd Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Mon, 8 Jul 2024 21:06:19 +0300
Subject: [PATCH 01/16] [MC,ELF] Emit warning if a string constant contains
newline char.
GAS emits warning about newline in the string constant
so make the same behaviour.
---
llvm/lib/MC/MCParser/AsmLexer.cpp | 7 ++++++-
llvm/test/MC/ELF/warn-newline-in-string-constant.s | 6 ++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/MC/ELF/warn-newline-in-string-constant.s
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index e08404ae0ad92..43f4a87c3c2d3 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -21,6 +21,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SaveAndRestore.h"
+#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cctype>
#include <cstdio>
@@ -646,13 +647,17 @@ AsmToken AsmLexer::LexQuote() {
return AsmToken(AsmToken::String, StringRef(TokStart, CurPtr - TokStart));
}
- // TODO: does gas allow multiline string constants?
+ // gas doesn't allow multiline string constants
+ // and emits a warning if a string constant contains newline character
while (CurChar != '"') {
if (CurChar == '\\') {
// Allow \", etc.
CurChar = getNextChar();
}
+ if (CurChar == '\n')
+ outs() << "Warning: unterminated string; newline inserted\n";
+
if (CurChar == EOF)
return ReturnError(TokStart, "unterminated string constant");
diff --git a/llvm/test/MC/ELF/warn-newline-in-string-constant.s b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
new file mode 100644
index 0000000000000..e126db30ee47a
--- /dev/null
+++ b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
@@ -0,0 +1,6 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t | FileCheck %s
+
+.string "abcdefg
+12345678"
+
+// CHECK: Warning: unterminated string; newline inserted
>From 9cbe1ce5bcbfcad605578f3afcfd9e38c13c6871 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 12:38:03 +0300
Subject: [PATCH 02/16] [MC,ELF] Move warning handling to parser code
Emit warning about newline characters in strings
for `.string`, '.ascii' and '.asciz' directives
like GAS.
---
llvm/lib/MC/MCParser/AsmLexer.cpp | 4 --
llvm/lib/MC/MCParser/AsmParser.cpp | 10 ++++
.../MC/ELF/warn-newline-in-string-constant.s | 50 ++++++++++++++++++-
3 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index 43f4a87c3c2d3..ef516b8e37ee4 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -21,7 +21,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SaveAndRestore.h"
-#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cctype>
#include <cstdio>
@@ -655,9 +654,6 @@ AsmToken AsmLexer::LexQuote() {
CurChar = getNextChar();
}
- if (CurChar == '\n')
- outs() << "Warning: unterminated string; newline inserted\n";
-
if (CurChar == EOF)
return ReturnError(TokStart, "unterminated string constant");
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index ee5bebf324570..222d3739fb512 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3129,6 +3129,16 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
do {
if (parseEscapedString(Data))
return true;
+
+ // Warn about newline characters in parsed string like GAS.
+ size_t NewlinePos = -1;
+ size_t DataSize = Data.size();
+ const char *Start = getTok().getLoc().getPointer() - DataSize - 1;
+
+ while ((NewlinePos = Data.find('\n', NewlinePos + 1)) < DataSize)
+ Warning(SMLoc::getFromPointer(Start + NewlinePos),
+ "unterminated string; newline inserted");
+
getStreamer().emitBytes(Data);
} while (!ZeroTerminated && getTok().is(AsmToken::String));
if (ZeroTerminated)
diff --git a/llvm/test/MC/ELF/warn-newline-in-string-constant.s b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
index e126db30ee47a..6e67e542b7832 100644
--- a/llvm/test/MC/ELF/warn-newline-in-string-constant.s
+++ b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
@@ -1,6 +1,52 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck %s --check-prefix=CHECK-WARN
.string "abcdefg
12345678"
-// CHECK: Warning: unterminated string; newline inserted
+.ascii "some test ascii
+
+sequence
+with
+newlines
+"
+
+.asciz "another test string
+
+with
+newline characters
+
+
+"
+
+// CHECK-WARN: warn-newline-in-string-constant.s:3:17: warning: unterminated string; newline inserted
+// CHECK-WARN: .string "abcdefg
+
+// CHECK-WARN: warn-newline-in-string-constant.s:6:24: warning: unterminated string; newline inserted
+// CHECK-WARN: .ascii "some test ascii
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:7:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:8:9: warning: unterminated string; newline inserted
+// CHECK-WARN: sequence
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:9:5: warning: unterminated string; newline inserted
+// CHECK-WARN: with
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:10:9: warning: unterminated string; newline inserted
+// CHECK-WARN: newlines
+// CHECK-WARN: ^
+
+// CHECK-WATN: warn-newline-in-string-constant.s:13:28: warning: unterminated string; newline inserted
+// CHECK-WARN: .asciz "another test string
+// CHECK-WARN: warn-newline-in-string-constant.s:14:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:15:5: warning: unterminated string; newline inserted
+// CHECK-WARN: with
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:16:19: warning: unterminated string; newline inserted
+// CHECK-WARN: newline characters
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:17:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-string-constant.s:18:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
>From 8cc91db4ab50d8a3b1e1782699bcb89f655ee864 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 15:19:36 +0300
Subject: [PATCH 03/16] [MC,AsmParser] Warn about newlines in some cases
Move the point of check into `parseEscapedString`.
Check if the `Warning()` returned true to stop compilation.
---
llvm/include/llvm/MC/MCParser/MCAsmParser.h | 2 +-
llvm/lib/MC/MCParser/AsmLexer.cpp | 2 --
llvm/lib/MC/MCParser/AsmParser.cpp | 21 +++++++--------
llvm/lib/MC/MCParser/DarwinAsmParser.cpp | 2 +-
llvm/lib/MC/MCParser/MasmParser.cpp | 4 +--
.../AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 2 +-
.../lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 2 +-
.../AsmParser/WebAssemblyAsmParser.cpp | 2 +-
.../MC/ELF/warn-newline-in-string-constant.s | 26 ++++++++++++++-----
9 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index faa72d5f3144c..de10fd74ed75e 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -286,7 +286,7 @@ class MCAsmParser {
/// Parse the current token as a string which may include escaped
/// characters and return the string contents.
- virtual bool parseEscapedString(std::string &Data) = 0;
+ virtual bool parseEscapedString(std::string &Data, bool WarnNewline) = 0;
/// Parse an angle-bracket delimited string at the current position if one is
/// present, returning the string contents.
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index ef516b8e37ee4..778ca340e1248 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -646,8 +646,6 @@ AsmToken AsmLexer::LexQuote() {
return AsmToken(AsmToken::String, StringRef(TokStart, CurPtr - TokStart));
}
- // gas doesn't allow multiline string constants
- // and emits a warning if a string constant contains newline character
while (CurChar != '"') {
if (CurChar == '\\') {
// Allow \", etc.
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 222d3739fb512..5f158de0f03bc 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -675,7 +675,7 @@ class AsmParser : public MCAsmParser {
bool parseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif"
bool parseDirectiveElse(SMLoc DirectiveLoc); // ".else"
bool parseDirectiveEndIf(SMLoc DirectiveLoc); // .endif
- bool parseEscapedString(std::string &Data) override;
+ bool parseEscapedString(std::string &Data, bool WarnNewline = false) override;
bool parseAngleBracketString(std::string &Data) override;
const MCExpr *applyModifierToExpr(const MCExpr *E,
@@ -3025,7 +3025,7 @@ bool AsmParser::parseDirectiveSet(StringRef IDVal, AssignmentKind Kind) {
return false;
}
-bool AsmParser::parseEscapedString(std::string &Data) {
+bool AsmParser::parseEscapedString(std::string &Data, bool WarnNewline) {
if (check(getTok().isNot(AsmToken::String), "expected string"))
return true;
@@ -3033,6 +3033,12 @@ bool AsmParser::parseEscapedString(std::string &Data) {
StringRef Str = getTok().getStringContents();
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
if (Str[i] != '\\') {
+ if (Str[i] == '\n' && WarnNewline) {
+ SMLoc NewlineLoc =
+ SMLoc::getFromPointer(getTok().getLoc().getPointer() + i + 1);
+ if (Warning(NewlineLoc, "unterminated string; newline inserted"))
+ return true;
+ }
Data += Str[i];
continue;
}
@@ -3127,18 +3133,9 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
// Only support spaces as separators for .ascii directive for now. See the
// discusssion at https://reviews.llvm.org/D91460 for more details.
do {
- if (parseEscapedString(Data))
+ if (parseEscapedString(Data, /* WarnNewline */ true))
return true;
- // Warn about newline characters in parsed string like GAS.
- size_t NewlinePos = -1;
- size_t DataSize = Data.size();
- const char *Start = getTok().getLoc().getPointer() - DataSize - 1;
-
- while ((NewlinePos = Data.find('\n', NewlinePos + 1)) < DataSize)
- Warning(SMLoc::getFromPointer(Start + NewlinePos),
- "unterminated string; newline inserted");
-
getStreamer().emitBytes(Data);
} while (!ZeroTerminated && getTok().is(AsmToken::String));
if (ZeroTerminated)
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index a97b72997ae39..568e6d078e709 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -613,7 +613,7 @@ bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
return TokError("expected string in '" + Twine(IDVal) + "' directive");
std::string Data;
- if (getParser().parseEscapedString(Data))
+ if (getParser().parseEscapedString(Data, false))
return true;
Args.push_back(Data);
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index f64b7f62d61d0..c7441559ac8b6 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -1029,7 +1029,7 @@ class MasmParser : public MCAsmParser {
bool CaseInsensitive);
bool parseDirectiveElse(SMLoc DirectiveLoc); // "else"
bool parseDirectiveEndIf(SMLoc DirectiveLoc); // "endif"
- bool parseEscapedString(std::string &Data) override;
+ bool parseEscapedString(std::string &Data, bool WarnNewline = false) override;
bool parseAngleBracketString(std::string &Data) override;
// Macro-like directives
@@ -3509,7 +3509,7 @@ bool MasmParser::parseDirectiveEquate(StringRef IDVal, StringRef Name,
return false;
}
-bool MasmParser::parseEscapedString(std::string &Data) {
+bool MasmParser::parseEscapedString(std::string &Data, bool WarnNewline) {
if (check(getTok().isNot(AsmToken::String), "expected string"))
return true;
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index b08957d22ee74..20b42e5c67bd3 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -5337,7 +5337,7 @@ bool AMDGPUAsmParser::ParseDirectiveAMDGCNTarget() {
std::string TargetIDDirective;
SMLoc TargetStart = getTok().getLoc();
- if (getParser().parseEscapedString(TargetIDDirective))
+ if (getParser().parseEscapedString(TargetIDDirective, /* WarnNewline */ false))
return true;
SMRange TargetRange = SMRange(TargetStart, getTok().getLoc());
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index e54314cc7d00a..242823bd61dae 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -11878,7 +11878,7 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) {
return Error(Parser.getTok().getLoc(), "bad string constant");
if (Tag == ARMBuildAttrs::also_compatible_with) {
- if (Parser.parseEscapedString(EscapedValue))
+ if (Parser.parseEscapedString(EscapedValue, /* WarnNewline */ false))
return Error(Parser.getTok().getLoc(), "bad escaped string constant");
StringValue = EscapedValue;
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index c63740d267819..1c088c097a2f3 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -980,7 +980,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (CheckDataSection())
return ParseStatus::Failure;
std::string S;
- if (Parser.parseEscapedString(S))
+ if (Parser.parseEscapedString(S, /* WarnNewline */ false))
return error("Cannot parse string constant: ", Lexer.getTok());
Out.emitBytes(StringRef(S.c_str(), S.length() + 1));
return expect(AsmToken::EndOfStatement, "EOL");
diff --git a/llvm/test/MC/ELF/warn-newline-in-string-constant.s b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
index 6e67e542b7832..d48e1cce2e466 100644
--- a/llvm/test/MC/ELF/warn-newline-in-string-constant.s
+++ b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
@@ -1,13 +1,13 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck %s --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
-.string "abcdefg
+.string "abcd\xFFefg
12345678"
.ascii "some test ascii
sequence
with
-newlines
+newlines\x0A
"
.asciz "another test string
@@ -18,8 +18,8 @@ newline characters
"
-// CHECK-WARN: warn-newline-in-string-constant.s:3:17: warning: unterminated string; newline inserted
-// CHECK-WARN: .string "abcdefg
+// CHECK-WARN: warn-newline-in-string-constant.s:3:21: warning: unterminated string; newline inserted
+// CHECK-WARN: .string "abcd\xFFefg
// CHECK-WARN: warn-newline-in-string-constant.s:6:24: warning: unterminated string; newline inserted
// CHECK-WARN: .ascii "some test ascii
@@ -32,8 +32,8 @@ newline characters
// CHECK-WARN: warn-newline-in-string-constant.s:9:5: warning: unterminated string; newline inserted
// CHECK-WARN: with
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:10:9: warning: unterminated string; newline inserted
-// CHECK-WARN: newlines
+// CHECK-WARN: warn-newline-in-string-constant.s:10:13: warning: unterminated string; newline inserted
+// CHECK-WARN: newlines\x0A
// CHECK-WARN: ^
// CHECK-WATN: warn-newline-in-string-constant.s:13:28: warning: unterminated string; newline inserted
@@ -50,3 +50,15 @@ newline characters
// CHECK-WARN: ^
// CHECK-WARN: warn-newline-in-string-constant.s:18:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
+
+.ascii "test\nstring\xFF\n\n\xFF"
+
+// CHECK-WARN-NOT: warn-newline-in-string-constant.s:55{{.*}}
+
+.asciz "\n\n\ntest_string\x0A"
+
+// CHECK-WARN-NOT: warn-newline-in-string-constant.s:59{{.*}}
+
+.string "1234\n\xFF\n\xFF\n"
+
+// CHECK-WARN-NOT: warn-newline-in-string-constant.s:63{{.*}}
\ No newline at end of file
>From 02b653597c37fca6dc40cdeb49380520463fe1c2 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 15:33:44 +0300
Subject: [PATCH 04/16] [MC,AMDGPU] Correct code format
---
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index 20b42e5c67bd3..f989b7a0de402 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -5337,7 +5337,8 @@ bool AMDGPUAsmParser::ParseDirectiveAMDGCNTarget() {
std::string TargetIDDirective;
SMLoc TargetStart = getTok().getLoc();
- if (getParser().parseEscapedString(TargetIDDirective, /* WarnNewline */ false))
+ if (getParser().parseEscapedString(TargetIDDirective,
+ /* WarnNewline */ false))
return true;
SMRange TargetRange = SMRange(TargetStart, getTok().getLoc());
>From 602019f1af4adcf5aa4b9edc40dc92967f68d121 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 17:43:03 +0300
Subject: [PATCH 05/16] [MC,AsmParser] Rework `parseEscapedString`
- Remove `WarnNewline` arg
- Emit warning to `\n` symbol unconditionally
---
llvm/include/llvm/MC/MCParser/MCAsmParser.h | 2 +-
llvm/lib/MC/MCParser/AsmParser.cpp | 10 +++++-----
llvm/lib/MC/MCParser/DarwinAsmParser.cpp | 2 +-
llvm/lib/MC/MCParser/MasmParser.cpp | 4 ++--
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 3 +--
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 2 +-
.../WebAssembly/AsmParser/WebAssemblyAsmParser.cpp | 2 +-
7 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index de10fd74ed75e..faa72d5f3144c 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -286,7 +286,7 @@ class MCAsmParser {
/// Parse the current token as a string which may include escaped
/// characters and return the string contents.
- virtual bool parseEscapedString(std::string &Data, bool WarnNewline) = 0;
+ virtual bool parseEscapedString(std::string &Data) = 0;
/// Parse an angle-bracket delimited string at the current position if one is
/// present, returning the string contents.
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 5f158de0f03bc..d6ff14a6ee338 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -675,7 +675,7 @@ class AsmParser : public MCAsmParser {
bool parseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif"
bool parseDirectiveElse(SMLoc DirectiveLoc); // ".else"
bool parseDirectiveEndIf(SMLoc DirectiveLoc); // .endif
- bool parseEscapedString(std::string &Data, bool WarnNewline = false) override;
+ bool parseEscapedString(std::string &Data) override;
bool parseAngleBracketString(std::string &Data) override;
const MCExpr *applyModifierToExpr(const MCExpr *E,
@@ -3025,7 +3025,7 @@ bool AsmParser::parseDirectiveSet(StringRef IDVal, AssignmentKind Kind) {
return false;
}
-bool AsmParser::parseEscapedString(std::string &Data, bool WarnNewline) {
+bool AsmParser::parseEscapedString(std::string &Data) {
if (check(getTok().isNot(AsmToken::String), "expected string"))
return true;
@@ -3033,9 +3033,9 @@ bool AsmParser::parseEscapedString(std::string &Data, bool WarnNewline) {
StringRef Str = getTok().getStringContents();
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
if (Str[i] != '\\') {
- if (Str[i] == '\n' && WarnNewline) {
+ if (Str[i] == '\n') {
SMLoc NewlineLoc =
- SMLoc::getFromPointer(getTok().getLoc().getPointer() + i + 1);
+ SMLoc::getFromPointer(Str.data() + i);
if (Warning(NewlineLoc, "unterminated string; newline inserted"))
return true;
}
@@ -3133,7 +3133,7 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
// Only support spaces as separators for .ascii directive for now. See the
// discusssion at https://reviews.llvm.org/D91460 for more details.
do {
- if (parseEscapedString(Data, /* WarnNewline */ true))
+ if (parseEscapedString(Data))
return true;
getStreamer().emitBytes(Data);
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index 568e6d078e709..a97b72997ae39 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -613,7 +613,7 @@ bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
return TokError("expected string in '" + Twine(IDVal) + "' directive");
std::string Data;
- if (getParser().parseEscapedString(Data, false))
+ if (getParser().parseEscapedString(Data))
return true;
Args.push_back(Data);
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index c7441559ac8b6..f64b7f62d61d0 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -1029,7 +1029,7 @@ class MasmParser : public MCAsmParser {
bool CaseInsensitive);
bool parseDirectiveElse(SMLoc DirectiveLoc); // "else"
bool parseDirectiveEndIf(SMLoc DirectiveLoc); // "endif"
- bool parseEscapedString(std::string &Data, bool WarnNewline = false) override;
+ bool parseEscapedString(std::string &Data) override;
bool parseAngleBracketString(std::string &Data) override;
// Macro-like directives
@@ -3509,7 +3509,7 @@ bool MasmParser::parseDirectiveEquate(StringRef IDVal, StringRef Name,
return false;
}
-bool MasmParser::parseEscapedString(std::string &Data, bool WarnNewline) {
+bool MasmParser::parseEscapedString(std::string &Data) {
if (check(getTok().isNot(AsmToken::String), "expected string"))
return true;
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index f989b7a0de402..b08957d22ee74 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -5337,8 +5337,7 @@ bool AMDGPUAsmParser::ParseDirectiveAMDGCNTarget() {
std::string TargetIDDirective;
SMLoc TargetStart = getTok().getLoc();
- if (getParser().parseEscapedString(TargetIDDirective,
- /* WarnNewline */ false))
+ if (getParser().parseEscapedString(TargetIDDirective))
return true;
SMRange TargetRange = SMRange(TargetStart, getTok().getLoc());
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 242823bd61dae..e54314cc7d00a 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -11878,7 +11878,7 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) {
return Error(Parser.getTok().getLoc(), "bad string constant");
if (Tag == ARMBuildAttrs::also_compatible_with) {
- if (Parser.parseEscapedString(EscapedValue, /* WarnNewline */ false))
+ if (Parser.parseEscapedString(EscapedValue))
return Error(Parser.getTok().getLoc(), "bad escaped string constant");
StringValue = EscapedValue;
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index 1c088c097a2f3..c63740d267819 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -980,7 +980,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (CheckDataSection())
return ParseStatus::Failure;
std::string S;
- if (Parser.parseEscapedString(S, /* WarnNewline */ false))
+ if (Parser.parseEscapedString(S))
return error("Cannot parse string constant: ", Lexer.getTok());
Out.emitBytes(StringRef(S.c_str(), S.length() + 1));
return expect(AsmToken::EndOfStatement, "EOL");
>From deeed1ddd745a60d532eb25f658a74d60454037d Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 17:44:36 +0300
Subject: [PATCH 06/16] [MC,AsmParser] Rework test to newline warnings.
- Add new testcases
---
.../MC/ELF/warn-newline-in-escaped-string.s | 69 +++++++++++++++++++
.../MC/ELF/warn-newline-in-string-constant.s | 64 -----------------
2 files changed, 69 insertions(+), 64 deletions(-)
create mode 100644 llvm/test/MC/ELF/warn-newline-in-escaped-string.s
delete mode 100644 llvm/test/MC/ELF/warn-newline-in-string-constant.s
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
new file mode 100644
index 0000000000000..444801ea17088
--- /dev/null
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -0,0 +1,69 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
+
+.string "abcd\xFFefg
+12345678"
+
+.ascii "some test ascii
+
+sequence
+with
+newlines\x0A
+"
+
+.asciz "another test string
+
+with
+newline characters
+
+
+"
+
+// CHECK-WARN: warn-newline-in-escaped-string.s:3:21: warning: unterminated string; newline inserted
+// CHECK-WARN: .string "abcd\xFFefg
+
+// CHECK-WARN: warn-newline-in-escaped-string.s:6:24: warning: unterminated string; newline inserted
+// CHECK-WARN: .ascii "some test ascii
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:7:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:8:9: warning: unterminated string; newline inserted
+// CHECK-WARN: sequence
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:9:5: warning: unterminated string; newline inserted
+// CHECK-WARN: with
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:10:13: warning: unterminated string; newline inserted
+// CHECK-WARN: newlines\x0A
+// CHECK-WARN: ^
+
+// CHECK-WATN: warn-newline-in-escaped-string.s:13:28: warning: unterminated string; newline inserted
+// CHECK-WARN: .asciz "another test string
+// CHECK-WARN: warn-newline-in-escaped-string.s:14:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:15:5: warning: unterminated string; newline inserted
+// CHECK-WARN: with
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:16:19: warning: unterminated string; newline inserted
+// CHECK-WARN: newline characters
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:17:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+// CHECK-WARN: warn-newline-in-escaped-string.s:18:1: warning: unterminated string; newline inserted
+// CHECK-WARN: ^
+
+.file "warn-newline
+.s"
+// CHECK-WARN: warn-newline-in-escaped-string.s:54:20: warning: unterminated string; newline inserted
+
+.cv_file 1 "some_an
+other_file.s"
+// HECK-WARN: warn-newline-in-escaped-string.s:58:20: warning: unterminated string; newline inserted
+
+.ascii "test\nstring\xFF\n\n\xFF"
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:62{{.*}}
+
+.asciz "\n\n\ntest_string\x0A"
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:65{{.*}}
+
+.string "1234\n\xFF\n\xFF\n"
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:68{{.*}}
diff --git a/llvm/test/MC/ELF/warn-newline-in-string-constant.s b/llvm/test/MC/ELF/warn-newline-in-string-constant.s
deleted file mode 100644
index d48e1cce2e466..0000000000000
--- a/llvm/test/MC/ELF/warn-newline-in-string-constant.s
+++ /dev/null
@@ -1,64 +0,0 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
-
-.string "abcd\xFFefg
-12345678"
-
-.ascii "some test ascii
-
-sequence
-with
-newlines\x0A
-"
-
-.asciz "another test string
-
-with
-newline characters
-
-
-"
-
-// CHECK-WARN: warn-newline-in-string-constant.s:3:21: warning: unterminated string; newline inserted
-// CHECK-WARN: .string "abcd\xFFefg
-
-// CHECK-WARN: warn-newline-in-string-constant.s:6:24: warning: unterminated string; newline inserted
-// CHECK-WARN: .ascii "some test ascii
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:7:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:8:9: warning: unterminated string; newline inserted
-// CHECK-WARN: sequence
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:9:5: warning: unterminated string; newline inserted
-// CHECK-WARN: with
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:10:13: warning: unterminated string; newline inserted
-// CHECK-WARN: newlines\x0A
-// CHECK-WARN: ^
-
-// CHECK-WATN: warn-newline-in-string-constant.s:13:28: warning: unterminated string; newline inserted
-// CHECK-WARN: .asciz "another test string
-// CHECK-WARN: warn-newline-in-string-constant.s:14:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:15:5: warning: unterminated string; newline inserted
-// CHECK-WARN: with
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:16:19: warning: unterminated string; newline inserted
-// CHECK-WARN: newline characters
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:17:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-string-constant.s:18:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-
-.ascii "test\nstring\xFF\n\n\xFF"
-
-// CHECK-WARN-NOT: warn-newline-in-string-constant.s:55{{.*}}
-
-.asciz "\n\n\ntest_string\x0A"
-
-// CHECK-WARN-NOT: warn-newline-in-string-constant.s:59{{.*}}
-
-.string "1234\n\xFF\n\xFF\n"
-
-// CHECK-WARN-NOT: warn-newline-in-string-constant.s:63{{.*}}
\ No newline at end of file
>From c2baa2c1e8ca9edca394147cd1e840e6cd483862 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 17:48:09 +0300
Subject: [PATCH 07/16] [MC,AsmParser] Adjuct test to newline warnings
---
llvm/test/MC/ELF/warn-newline-in-escaped-string.s | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index 444801ea17088..d734f89e15900 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o %t | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
.string "abcd\xFFefg
12345678"
@@ -57,13 +57,13 @@ newline characters
.cv_file 1 "some_an
other_file.s"
-// HECK-WARN: warn-newline-in-escaped-string.s:58:20: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:58:20: warning: unterminated string; newline inserted
.ascii "test\nstring\xFF\n\n\xFF"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:62{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:62{{.*}}
.asciz "\n\n\ntest_string\x0A"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:65{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:65{{.*}}
.string "1234\n\xFF\n\xFF\n"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:68{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:68{{.*}}
>From b30d7566bf9691b21ac28b8bc9ae6fb3a155c84e Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 9 Jul 2024 17:50:37 +0300
Subject: [PATCH 08/16] [MC,AsmParser] Correct code style
---
llvm/lib/MC/MCParser/AsmParser.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index d6ff14a6ee338..9c322c6ff6a1a 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3034,8 +3034,7 @@ bool AsmParser::parseEscapedString(std::string &Data) {
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
if (Str[i] != '\\') {
if (Str[i] == '\n') {
- SMLoc NewlineLoc =
- SMLoc::getFromPointer(Str.data() + i);
+ SMLoc NewlineLoc = SMLoc::getFromPointer(Str.data() + i);
if (Warning(NewlineLoc, "unterminated string; newline inserted"))
return true;
}
>From b866eff40710ee19291f62a95db4ed8b46963c0d Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 10 Jul 2024 08:20:15 +0300
Subject: [PATCH 09/16] [MC,AsmParser] Refactor AsmParser.c and the test
- Revert unneeded change
- Refactor test to use string/check style and
[[#@LINE]] instead of hardcoded line numbers
---
llvm/lib/MC/MCParser/AsmParser.cpp | 1 -
.../MC/ELF/warn-newline-in-escaped-string.s | 54 +++++++++----------
2 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 9c322c6ff6a1a..d05712bca73cd 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3134,7 +3134,6 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
do {
if (parseEscapedString(Data))
return true;
-
getStreamer().emitBytes(Data);
} while (!ZeroTerminated && getTok().is(AsmToken::String));
if (ZeroTerminated)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index d734f89e15900..f7f0d4e42b25a 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -3,6 +3,9 @@
.string "abcd\xFFefg
12345678"
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-3]]:21: warning: unterminated string; newline inserted
+// CHECK-WARN: .string "abcd\xFFefg
+
.ascii "some test ascii
sequence
@@ -10,60 +13,57 @@ with
newlines\x0A
"
-.asciz "another test string
-
-with
-newline characters
-
-
-"
-
-// CHECK-WARN: warn-newline-in-escaped-string.s:3:21: warning: unterminated string; newline inserted
-// CHECK-WARN: .string "abcd\xFFefg
-
-// CHECK-WARN: warn-newline-in-escaped-string.s:6:24: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-7]]:24: warning: unterminated string; newline inserted
// CHECK-WARN: .ascii "some test ascii
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:7:1: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-9]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:8:9: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-10]]:9: warning: unterminated string; newline inserted
// CHECK-WARN: sequence
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:9:5: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-12]]:5: warning: unterminated string; newline inserted
// CHECK-WARN: with
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:10:13: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-14]]:13: warning: unterminated string; newline inserted
// CHECK-WARN: newlines\x0A
// CHECK-WARN: ^
-// CHECK-WATN: warn-newline-in-escaped-string.s:13:28: warning: unterminated string; newline inserted
+.asciz "another test string
+
+with
+newline characters
+
+
+"
+
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-8]]:28: warning: unterminated string; newline inserted
// CHECK-WARN: .asciz "another test string
-// CHECK-WARN: warn-newline-in-escaped-string.s:14:1: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-9]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:15:5: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-10]]:5: warning: unterminated string; newline inserted
// CHECK-WARN: with
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:16:19: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-12]]:19: warning: unterminated string; newline inserted
// CHECK-WARN: newline characters
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:17:1: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-14]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:18:1: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-15]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
.file "warn-newline
.s"
-// CHECK-WARN: warn-newline-in-escaped-string.s:54:20: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-2]]:20: warning: unterminated string; newline inserted
.cv_file 1 "some_an
other_file.s"
-// CHECK-WARN: warn-newline-in-escaped-string.s:58:20: warning: unterminated string; newline inserted
+// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-2]]:20: warning: unterminated string; newline inserted
.ascii "test\nstring\xFF\n\n\xFF"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:62{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
.asciz "\n\n\ntest_string\x0A"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:65{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
.string "1234\n\xFF\n\xFF\n"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:68{{.*}}
+// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
>From 3cbfa5fba45ec996c8d44884a24b5cec12756aff Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 10 Jul 2024 08:24:03 +0300
Subject: [PATCH 10/16] [MC,AsmParser] Remove unneeded filename from the test
---
.../MC/ELF/warn-newline-in-escaped-string.s | 34 +++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index f7f0d4e42b25a..64f4e02a9c019 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --check-prefix=CHECK-WARN
.string "abcd\xFFefg
12345678"
@@ -13,18 +13,18 @@ with
newlines\x0A
"
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-7]]:24: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
// CHECK-WARN: .ascii "some test ascii
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-9]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-10]]:9: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-10]]:9: warning: unterminated string; newline inserted
// CHECK-WARN: sequence
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-12]]:5: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-12]]:5: warning: unterminated string; newline inserted
// CHECK-WARN: with
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-14]]:13: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-14]]:13: warning: unterminated string; newline inserted
// CHECK-WARN: newlines\x0A
// CHECK-WARN: ^
@@ -36,34 +36,34 @@ newline characters
"
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-8]]:28: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
// CHECK-WARN: .asciz "another test string
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-9]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-10]]:5: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-10]]:5: warning: unterminated string; newline inserted
// CHECK-WARN: with
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-12]]:19: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-12]]:19: warning: unterminated string; newline inserted
// CHECK-WARN: newline characters
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-14]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-14]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-15]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-15]]:1: warning: unterminated string; newline inserted
// CHECK-WARN: ^
.file "warn-newline
.s"
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.cv_file 1 "some_an
other_file.s"
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.ascii "test\nstring\xFF\n\n\xFF"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
+// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
.asciz "\n\n\ntest_string\x0A"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
+// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
.string "1234\n\xFF\n\xFF\n"
-// CHECK-WARN-NOT: warn-newline-in-escaped-string.s:[[#@LINE-1]]{{.*}}
+// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
>From 91f2c7f7c0daee4c2ce0f6ddd8d297fb9f743662 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 10 Jul 2024 09:18:09 +0300
Subject: [PATCH 11/16] [MC,AsmParser] Refactor test
- Use `CHECK-NEXT`
- Use `implicit-check-not` instead of `CHECK-WARN-NOT`
---
.../MC/ELF/warn-newline-in-escaped-string.s | 61 +++++++------------
1 file changed, 21 insertions(+), 40 deletions(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index 64f4e02a9c019..1b57ff2fe2272 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,10 +1,10 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not=valid1_string --implicit-check-not=valid2_string --implicit-check-not=valid3_string --check-prefix=CHECK-WARN
.string "abcd\xFFefg
12345678"
// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-3]]:21: warning: unterminated string; newline inserted
-// CHECK-WARN: .string "abcd\xFFefg
+// CHECK-NEXT: .string "abcd\xFFefg
.ascii "some test ascii
@@ -13,20 +13,14 @@ with
newlines\x0A
"
-// CHECK-WARN: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
-// CHECK-WARN: .ascii "some test ascii
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-10]]:9: warning: unterminated string; newline inserted
-// CHECK-WARN: sequence
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-12]]:5: warning: unterminated string; newline inserted
-// CHECK-WARN: with
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-14]]:13: warning: unterminated string; newline inserted
-// CHECK-WARN: newlines\x0A
-// CHECK-WARN: ^
+// CHECK-NEXT: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
+// CHECK-NEXT: .ascii "some test ascii
+// CHECK-NEXT: [[#@LINE-7]]:9: warning: unterminated string; newline inserted
+// CHECK-NEXT: sequence
+// CHECK-NEXT: [[#@LINE-8]]:5: warning: unterminated string; newline inserted
+// CHECK-NEXT: with
+// CHECK-NEXT: [[#@LINE-9]]:13: warning: unterminated string; newline inserted
+// CHECK-NEXT: newlines\x0A
.asciz "another test string
@@ -36,34 +30,21 @@ newline characters
"
-// CHECK-WARN: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
-// CHECK-WARN: .asciz "another test string
-// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-10]]:5: warning: unterminated string; newline inserted
-// CHECK-WARN: with
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-12]]:19: warning: unterminated string; newline inserted
-// CHECK-WARN: newline characters
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-14]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
-// CHECK-WARN: [[#@LINE-15]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: ^
+// CHECK-NEXT: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
+// CHECK-NEXT: .asciz "another test string
+// CHECK-NEXT: [[#@LINE-8]]:5: warning: unterminated string; newline inserted
+// CHECK-NEXT: with
+// CHECK-NEXT: [[#@LINE-9]]:19: warning: unterminated string; newline inserted
+// CHECK-NEXT: newline characters
.file "warn-newline
.s"
-// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-NEXT: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.cv_file 1 "some_an
other_file.s"
-// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-NEXT: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
-.ascii "test\nstring\xFF\n\n\xFF"
-// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
-
-.asciz "\n\n\ntest_string\x0A"
-// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
-
-.string "1234\n\xFF\n\xFF\n"
-// CHECK-WARN-NOT: [[#@LINE-1]]{{.*}}
+.ascii "test\nvalid1_string\xFF\n\n\xFF"
+.asciz "\n\n\nvalid2_string\x0A"
+.string "1234\nvalid3_string\xFF\n\xFF\n"
>From b43c4fa70d4f113131b88301ca5b250088cc9606 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Mon, 15 Jul 2024 08:49:08 +0300
Subject: [PATCH 12/16] [MC] Use x86_64 as triple in test
---
llvm/test/MC/ELF/warn-newline-in-escaped-string.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index 1b57ff2fe2272..c786e977ef10b 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not=valid1_string --implicit-check-not=valid2_string --implicit-check-not=valid3_string --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not=valid1_string --implicit-check-not=valid2_string --implicit-check-not=valid3_string --check-prefix=CHECK-WARN
.string "abcd\xFFefg
12345678"
>From 60392b7f4ee5a12fbb336b4c93687424c9c7a850 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Mon, 15 Jul 2024 10:33:50 +0300
Subject: [PATCH 13/16] [MC, ELF] Refactor test
- Add one `--implicit-check-not` with the appropriate pattern
- Refactor checks
---
.../MC/ELF/warn-newline-in-escaped-string.s | 28 +++++++++++--------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index c786e977ef10b..a39ed582e529a 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,9 +1,9 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not=valid1_string --implicit-check-not=valid2_string --implicit-check-not=valid3_string --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not="{{[0-9]+:[0-9]+: warning: unterminated string}}" --check-prefix=CHECK-WARN
.string "abcd\xFFefg
12345678"
-// CHECK-WARN: warn-newline-in-escaped-string.s:[[#@LINE-3]]:21: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-3]]:21: warning: unterminated string; newline inserted
// CHECK-NEXT: .string "abcd\xFFefg
.ascii "some test ascii
@@ -13,13 +13,14 @@ with
newlines\x0A
"
-// CHECK-NEXT: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
-// CHECK-NEXT: .ascii "some test ascii
-// CHECK-NEXT: [[#@LINE-7]]:9: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
+// CHECK-NEXT: .ascii "some test ascii
+// CHECK-WARN: [[#@LINE-8]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-8]]:9: warning: unterminated string; newline inserted
// CHECK-NEXT: sequence
-// CHECK-NEXT: [[#@LINE-8]]:5: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
// CHECK-NEXT: with
-// CHECK-NEXT: [[#@LINE-9]]:13: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-10]]:13: warning: unterminated string; newline inserted
// CHECK-NEXT: newlines\x0A
.asciz "another test string
@@ -30,20 +31,23 @@ newline characters
"
-// CHECK-NEXT: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
// CHECK-NEXT: .asciz "another test string
-// CHECK-NEXT: [[#@LINE-8]]:5: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
// CHECK-NEXT: with
-// CHECK-NEXT: [[#@LINE-9]]:19: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-10]]:19: warning: unterminated string; newline inserted
// CHECK-NEXT: newline characters
+// CHECK-WARN: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
.file "warn-newline
.s"
-// CHECK-NEXT: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.cv_file 1 "some_an
other_file.s"
-// CHECK-NEXT: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.ascii "test\nvalid1_string\xFF\n\n\xFF"
.asciz "\n\n\nvalid2_string\x0A"
>From 2f517c33cbe9b192e23159fda0f02259a62ebd91 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Mon, 15 Jul 2024 11:40:10 +0300
Subject: [PATCH 14/16] [MC,ELF] Refactor the test
- Remove redundant `--check-prefix`
- Remove `-DFILE=`
---
.../MC/ELF/warn-newline-in-escaped-string.s | 31 ++++++++++---------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index a39ed582e529a..fb13c340d406c 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,9 +1,10 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null | FileCheck -DFILE=%s --strict-whitespace %s --implicit-check-not="{{[0-9]+:[0-9]+: warning: unterminated string}}" --check-prefix=CHECK-WARN
+// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null \
+// RUN: | FileCheck %s --implicit-check-not="{{[0-9]+:[0-9]+: warning: unterminated string}}"
.string "abcd\xFFefg
12345678"
-// CHECK-WARN: [[#@LINE-3]]:21: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-3]]:21: warning: unterminated string; newline inserted
// CHECK-NEXT: .string "abcd\xFFefg
.ascii "some test ascii
@@ -13,14 +14,14 @@ with
newlines\x0A
"
-// CHECK-WARN: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-7]]:24: warning: unterminated string; newline inserted
// CHECK-NEXT: .ascii "some test ascii
-// CHECK-WARN: [[#@LINE-8]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: [[#@LINE-8]]:9: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-8]]:1: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-8]]:9: warning: unterminated string; newline inserted
// CHECK-NEXT: sequence
-// CHECK-WARN: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
// CHECK-NEXT: with
-// CHECK-WARN: [[#@LINE-10]]:13: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-10]]:13: warning: unterminated string; newline inserted
// CHECK-NEXT: newlines\x0A
.asciz "another test string
@@ -31,23 +32,23 @@ newline characters
"
-// CHECK-WARN: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-8]]:28: warning: unterminated string; newline inserted
// CHECK-NEXT: .asciz "another test string
-// CHECK-WARN: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-9]]:1: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-9]]:5: warning: unterminated string; newline inserted
// CHECK-NEXT: with
-// CHECK-WARN: [[#@LINE-10]]:19: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-10]]:19: warning: unterminated string; newline inserted
// CHECK-NEXT: newline characters
-// CHECK-WARN: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
-// CHECK-WARN: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-11]]:1: warning: unterminated string; newline inserted
.file "warn-newline
.s"
-// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.cv_file 1 "some_an
other_file.s"
-// CHECK-WARN: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
+// CHECK: [[#@LINE-2]]:20: warning: unterminated string; newline inserted
.ascii "test\nvalid1_string\xFF\n\n\xFF"
.asciz "\n\n\nvalid2_string\x0A"
>From d8cd073207fe7e946e8882faddae8b5812f63403 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 16 Jul 2024 05:34:06 +0300
Subject: [PATCH 15/16] [MC,ELF] Simplify `--implicit-check-not` argument
---
llvm/test/MC/ELF/warn-newline-in-escaped-string.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index fb13c340d406c..51ff363bcaccc 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,5 +1,5 @@
// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null \
-// RUN: | FileCheck %s --implicit-check-not="{{[0-9]+:[0-9]+: warning: unterminated string}}"
+// RUN: | FileCheck %s --implicit-check-not=warning
.string "abcd\xFFefg
12345678"
>From f1264d4ff96c2d8d16b569ac0d2163d370ed4358 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Tue, 16 Jul 2024 05:35:17 +0300
Subject: [PATCH 16/16] [MC,ELF] Add missed colon
---
llvm/test/MC/ELF/warn-newline-in-escaped-string.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
index 51ff363bcaccc..9514a8a1ef2b4 100644
--- a/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
+++ b/llvm/test/MC/ELF/warn-newline-in-escaped-string.s
@@ -1,5 +1,5 @@
// RUN: llvm-mc -filetype=obj -triple x86_64 %s 2>&1 -o /dev/null \
-// RUN: | FileCheck %s --implicit-check-not=warning
+// RUN: | FileCheck %s --implicit-check-not=warning:
.string "abcd\xFFefg
12345678"
More information about the llvm-commits
mailing list