[llvm] r331669 - [llvm-rc] Allow optional commas between the string table index and value

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 13:27:29 PDT 2018


Author: mstorsjo
Date: Mon May  7 13:27:28 2018
New Revision: 331669

URL: http://llvm.org/viewvc/llvm-project?rev=331669&view=rev
Log:
[llvm-rc] Allow optional commas between the string table index and value

This form is even used in one of the examples at
https://msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx.

Differential Revision: https://reviews.llvm.org/D46508

Modified:
    llvm/trunk/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc
    llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp

Modified: llvm/trunk/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc?rev=331669&r1=331668&r2=331669&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc (original)
+++ llvm/trunk/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc Mon May  7 13:27:28 2018
@@ -4,9 +4,10 @@ CHARACTERISTICS 0x32 {
   0 "a"
 }
 
+// Commas are optional, so we make sure to test both cases.
 STRINGTABLE {
-  1 "b"
-  16 "bb"
+  1, "b"
+  16, "bb"
 }
 
 STRINGTABLE

Modified: llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp?rev=331669&r1=331668&r2=331669&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp Mon May  7 13:27:28 2018
@@ -573,6 +573,7 @@ RCParser::ParseType RCParser::parseStrin
     // Some examples in documentation suggest that there might be a comma in
     // between, however we strictly adhere to the single statement definition.
     ASSIGN_OR_RETURN(IDResult, readInt());
+    consumeOptionalType(Kind::Comma);
     ASSIGN_OR_RETURN(StrResult, readString());
     Table->addString(*IDResult, *StrResult);
   }




More information about the llvm-commits mailing list