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/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 @@ -509,15 +509,13 @@ 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),