COFF: Fix lexer for the module-definition file.

Previously it would hang if there's a stray punctuation (e.g. ?).

llvm-svn: 240697
This commit is contained in:
Rui Ueyama 2015-06-25 21:06:00 +00:00
parent 5b74593e16
commit 5817ebb0c8
2 changed files with 14 additions and 3 deletions

View File

@ -82,9 +82,7 @@ public:
return Token(Identifier, S);
}
default: {
size_t End = Buf.find_first_not_of(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789_.*~+!@#$%^&*()/");
size_t End = Buf.find_first_of("=,\r\n \t\v");
StringRef Word = Buf.substr(0, End);
Kind K = llvm::StringSwitch<Kind>(Word)
.Case("BASE", KwBase)

View File

@ -0,0 +1,13 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
# RUN: echo -e "LIBRARY foo\nEXPORTS ? @" > %t.def
# RUN: not lld -flavor link2 /def:%t.def %t.obj
# RUN: echo -e "LIBRARY foo\nHEAP abc" > %t.def
# RUN: not lld -flavor link2 /def:%t.def %t.obj
# RUN: echo -e "LIBRARY foo\nSTACK abc" > %t.def
# RUN: not lld -flavor link2 /def:%t.def %t.obj
# RUN: echo -e "foo" > %t.def
# RUN: not lld -flavor link2 /def:%t.def %t.obj