summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-rc/ResourceScriptToken.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-10-06 22:05:15 +0000
committerZachary Turner <zturner@google.com>2017-10-06 22:05:15 +0000
commita92eb33ad59e3d01bd832f9c19a03d011f393a92 (patch)
treef22d4e1130854f98ad16609ddff84856c380c599 /llvm/tools/llvm-rc/ResourceScriptToken.cpp
parent9d8b358a49bec7cbd225062962d7959854d04338 (diff)
downloadbcm5719-llvm-a92eb33ad59e3d01bd832f9c19a03d011f393a92.tar.gz
bcm5719-llvm-a92eb33ad59e3d01bd832f9c19a03d011f393a92.zip
[llvm-rc] Implement escape sequences in .rc files.
This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*, \[0-7]*, "") to appear in .rc scripts. These are parsed and output in the same way as it's done in original MS implementation. The way these sequences are processed depends on the type of the resource it resides in, and on whether the user declared the string to be "wide" or "narrow". I tried to maintain the maximum compatibility with the original tool (and fail in some erroneous situations that are accepted by .rc). However, there are some (extremely rare) cases where Microsoft tool outputs nonsense. I found it infeasible to detect such casses. Patch by Marek Sokolowski Differential Revision: https://reviews.llvm.org/D38426 llvm-svn: 315118
Diffstat (limited to 'llvm/tools/llvm-rc/ResourceScriptToken.cpp')
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptToken.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-rc/ResourceScriptToken.cpp b/llvm/tools/llvm-rc/ResourceScriptToken.cpp
index 36027d14ba0..061070b479e 100644
--- a/llvm/tools/llvm-rc/ResourceScriptToken.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptToken.cpp
@@ -219,7 +219,10 @@ Error Tokenizer::consumeToken(const Kind TokenKind) {
} else if (Data[Pos] == '"') {
// Consume the ending double-quote.
advance();
- return Error::success();
+ // However, if another '"' follows this double-quote, the string didn't
+ // end and we just included '"' into the string.
+ if (!willNowRead("\""))
+ return Error::success();
} else if (Data[Pos] == '\n') {
return getStringError("String literal not terminated in the line.");
}
OpenPOWER on IntegriCloud