diff --git a/llvm/test/tools/llvm-rc/Inputs/resname-string.rc b/llvm/test/tools/llvm-rc/Inputs/resname-string.rc new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-rc/Inputs/resname-string.rc @@ -0,0 +1,2 @@ +stringname RCDATA { "foo" } +name-with-dashes/and/slashes RCDATA { "foo" } diff --git a/llvm/test/tools/llvm-rc/Inputs/tokens.rc b/llvm/test/tools/llvm-rc/Inputs/tokens.rc --- a/llvm/test/tools/llvm-rc/Inputs/tokens.rc +++ b/llvm/test/tools/llvm-rc/Inputs/tokens.rc @@ -1,5 +1,6 @@ 1 + 2 - 3214L & 0x120894 032173 2|&~+(-7){0xabcdef 0xABCDEFl} Begin End He11o LLVM +identifier-with-dashes "RC string test.",L"Another RC string test.'&{",42,100 diff --git a/llvm/test/tools/llvm-rc/resname-string.test b/llvm/test/tools/llvm-rc/resname-string.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-rc/resname-string.test @@ -0,0 +1,5 @@ +; RUN: llvm-rc -no-preprocess /FO %t.res -- %p/Inputs/resname-string.rc +; RUN: llvm-readobj %t.res | FileCheck %s + +; CHECK: Resource name (string): STRINGNAME +; CHECK: Resource name (string): NAME-WITH-DASHES/AND/SLASHES diff --git a/llvm/test/tools/llvm-rc/tokenizer.test b/llvm/test/tools/llvm-rc/tokenizer.test --- a/llvm/test/tools/llvm-rc/tokenizer.test +++ b/llvm/test/tools/llvm-rc/tokenizer.test @@ -27,6 +27,7 @@ ; CHECK-NEXT: BlockEnd: End ; CHECK-NEXT: Identifier: He11o ; CHECK-NEXT: Identifier: LLVM +; CHECK-NEXT: Identifier: identifier-with-dashes ; CHECK-NEXT: String: "RC string test." ; CHECK-NEXT: Comma: , ; CHECK-NEXT: String: L"Another RC string test.'&{" diff --git a/llvm/tools/llvm-rc/ResourceScriptToken.cpp b/llvm/tools/llvm-rc/ResourceScriptToken.cpp --- a/llvm/tools/llvm-rc/ResourceScriptToken.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptToken.cpp @@ -288,7 +288,7 @@ assert(!streamEof()); const char CurChar = Data[Pos]; return std::isalnum(CurChar) || CurChar == '_' || CurChar == '.' || - CurChar == '/' || CurChar == '\\'; + CurChar == '/' || CurChar == '\\' || CurChar == '-'; } bool Tokenizer::canStartInt() const {