[PATCH] D105621: [llvm-rc] Make commas in user data structs optional
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 04:12:08 PDT 2021
mstorsjo created this revision.
mstorsjo added a reviewer: amccarth.
mstorsjo requested review of this revision.
Herald added a project: LLVM.
This matches what rc.exe tolerates in this type.
This fixes cases like this:
1 RT_MANIFEST
BEGIN
"<?xml version=""1.0""?>\n"
"<assembly>\n"
"</assembly>\n"
END
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105621
Files:
llvm/test/tools/llvm-rc/Inputs/tag-user.rc
llvm/tools/llvm-rc/ResourceScriptParser.cpp
Index: llvm/tools/llvm-rc/ResourceScriptParser.cpp
===================================================================
--- llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -509,15 +509,13 @@
RETURN_IF_ERROR(consumeType(Kind::BlockBegin));
std::vector<IntOrString> Data;
- // Consume comma before each consecutive token except the first one.
- bool ConsumeComma = false;
while (!consumeOptionalType(Kind::BlockEnd)) {
- if (ConsumeComma)
- RETURN_IF_ERROR(consumeType(Kind::Comma));
- ConsumeComma = true;
-
ASSIGN_OR_RETURN(Item, readIntOrString());
Data.push_back(*Item);
+
+ // There can be zero or more commas after each token (but not before
+ // the first one).
+ while (consumeOptionalType(Kind::Comma));
}
return std::make_unique<UserDefinedResource>(Type, std::move(Data),
Index: llvm/test/tools/llvm-rc/Inputs/tag-user.rc
===================================================================
--- llvm/test/tools/llvm-rc/Inputs/tag-user.rc
+++ llvm/test/tools/llvm-rc/Inputs/tag-user.rc
@@ -1,8 +1,8 @@
500 500 {
- 1, 2, 3, 4, 5, "data", L"wide data", 0xABCD, 0xABCDEF01L
+ 1, 2 3, ,4, 5, "da", "ta" L"wide data", 0xABCD, 0xABCDEF01L
}
501 RCDATA {
- 1, 2, 3, 4, 5, "data", L"wide data", 0xABCD, 0xABCDEF01L
+ 1, 2, 3, 4, 5, "da" "ta" L"wide", L" data", 0xABCD 0xABCDEF01L,
}
NAME1 NAME2 {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105621.357187.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210708/0692280b/attachment.bin>
More information about the llvm-commits
mailing list