diff --git a/llvm/test/tools/llvm-rc/Inputs/inline-manifest.rc b/llvm/test/tools/llvm-rc/Inputs/inline-manifest.rc
new file mode 100644
--- /dev/null
+++ b/llvm/test/tools/llvm-rc/Inputs/inline-manifest.rc
@@ -0,0 +1,6 @@
+1 24
+BEGIN
+ "\n"
+ "\n"
+ "\n"
+END
diff --git a/llvm/test/tools/llvm-rc/Inputs/tag-user.rc b/llvm/test/tools/llvm-rc/Inputs/tag-user.rc
--- a/llvm/test/tools/llvm-rc/Inputs/tag-user.rc
+++ b/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 {}
diff --git a/llvm/test/tools/llvm-rc/inline-manifest.test b/llvm/test/tools/llvm-rc/inline-manifest.test
new file mode 100644
--- /dev/null
+++ b/llvm/test/tools/llvm-rc/inline-manifest.test
@@ -0,0 +1,23 @@
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/inline-manifest.rc
+; RUN: llvm-readobj %t | FileCheck %s
+
+; CHECK: Resource type (int): MANIFEST (ID 24)
+; CHECK-NEXT: Resource name (int): 1
+; CHECK-NEXT: Data version: 0
+; CHECK-NEXT: Memory flags: 0x30
+; CHECK-NEXT: Language ID: 1033
+; CHECK-NEXT: Version (major): 0
+; CHECK-NEXT: Version (minor): 0
+; CHECK-NEXT: Characteristics: 0
+; CHECK-NEXT: Data size: 142
+; CHECK-NEXT: Data: (
+; CHECK-NEXT: 0000: 3C3F786D 6C207665 7273696F 6E3D2231 |...|
+; CHECK-NEXT: )
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
--- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -506,15 +506,14 @@
RETURN_IF_ERROR(consumeType(Kind::BlockBegin));
std::vector 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(Type, std::move(Data),