forked from OSchip/llvm-project
[llvm-rc] Make commas in user data structs optional
This matches what rc.exe tolerates in this type. This fixes cases like this: 1 24 BEGIN "<?xml version=""1.0""?>\n" "<assembly>\n" "</assembly>\n" END Differential Revision: https://reviews.llvm.org/D105621
This commit is contained in:
parent
e479777d3c
commit
beb0e7e338
|
@ -0,0 +1,6 @@
|
||||||
|
1 24
|
||||||
|
BEGIN
|
||||||
|
"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>\n"
|
||||||
|
"<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">\n"
|
||||||
|
"</assembly>\n"
|
||||||
|
END
|
|
@ -1,8 +1,8 @@
|
||||||
500 500 {
|
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 {
|
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 {}
|
NAME1 NAME2 {}
|
||||||
|
|
|
@ -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 |<?xml version="1|
|
||||||
|
; CHECK-NEXT: 0010: 2E302220 656E636F 64696E67 3D225554 |.0" encoding="UT|
|
||||||
|
; CHECK-NEXT: 0020: 462D3822 20737461 6E64616C 6F6E653D |F-8" standalone=|
|
||||||
|
; CHECK-NEXT: 0030: 22796573 223F3E0A 3C617373 656D626C |"yes"?>.<assembl|
|
||||||
|
; CHECK-NEXT: 0040: 7920786D 6C6E733D 2275726E 3A736368 |y xmlns="urn:sch|
|
||||||
|
; CHECK-NEXT: 0050: 656D6173 2D6D6963 726F736F 66742D63 |emas-microsoft-c|
|
||||||
|
; CHECK-NEXT: 0060: 6F6D3A61 736D2E76 3122206D 616E6966 |om:asm.v1" manif|
|
||||||
|
; CHECK-NEXT: 0070: 65737456 65727369 6F6E3D22 312E3022 |estVersion="1.0"|
|
||||||
|
; CHECK-NEXT: 0080: 3E0A3C2F 61737365 6D626C79 3E0A |>.</assembly>.|
|
||||||
|
; CHECK-NEXT: )
|
|
@ -506,15 +506,14 @@ RCParser::ParseType RCParser::parseUserDefinedResource(IntOrString Type) {
|
||||||
RETURN_IF_ERROR(consumeType(Kind::BlockBegin));
|
RETURN_IF_ERROR(consumeType(Kind::BlockBegin));
|
||||||
std::vector<IntOrString> Data;
|
std::vector<IntOrString> Data;
|
||||||
|
|
||||||
// Consume comma before each consecutive token except the first one.
|
|
||||||
bool ConsumeComma = false;
|
|
||||||
while (!consumeOptionalType(Kind::BlockEnd)) {
|
while (!consumeOptionalType(Kind::BlockEnd)) {
|
||||||
if (ConsumeComma)
|
|
||||||
RETURN_IF_ERROR(consumeType(Kind::Comma));
|
|
||||||
ConsumeComma = true;
|
|
||||||
|
|
||||||
ASSIGN_OR_RETURN(Item, readIntOrString());
|
ASSIGN_OR_RETURN(Item, readIntOrString());
|
||||||
Data.push_back(*Item);
|
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),
|
return std::make_unique<UserDefinedResource>(Type, std::move(Data),
|
||||||
|
|
Loading…
Reference in New Issue