[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
Tue Jul 9 05:28:16 PDT 2024
================
@@ -3125,6 +3125,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;
----------------
chestnykh wrote:
Moved the code to `parseEscapedString`. Seems that all cases are handled correctly, i've tried to write tests to each of them.
https://github.com/llvm/llvm-project/pull/98060
More information about the llvm-commits
mailing list