[lld] r240697 - COFF: Fix lexer for the module-definition file.
Rui Ueyama
ruiu at google.com
Thu Jun 25 14:06:01 PDT 2015
Author: ruiu
Date: Thu Jun 25 16:06:00 2015
New Revision: 240697
URL: http://llvm.org/viewvc/llvm-project?rev=240697&view=rev
Log:
COFF: Fix lexer for the module-definition file.
Previously it would hang if there's a stray punctuation (e.g. ?).
Added:
lld/trunk/test/COFF/defparser.test
Modified:
lld/trunk/COFF/ModuleDef.cpp
Modified: lld/trunk/COFF/ModuleDef.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ModuleDef.cpp?rev=240697&r1=240696&r2=240697&view=diff
==============================================================================
--- lld/trunk/COFF/ModuleDef.cpp (original)
+++ lld/trunk/COFF/ModuleDef.cpp Thu Jun 25 16:06:00 2015
@@ -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)
Added: lld/trunk/test/COFF/defparser.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/defparser.test?rev=240697&view=auto
==============================================================================
--- lld/trunk/test/COFF/defparser.test (added)
+++ lld/trunk/test/COFF/defparser.test Thu Jun 25 16:06:00 2015
@@ -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
More information about the llvm-commits
mailing list