[lld] r321453 - Simplify script lexer.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 26 02:13:10 PST 2017
Author: ruiu
Date: Tue Dec 26 02:13:10 2017
New Revision: 321453
URL: http://llvm.org/viewvc/llvm-project?rev=321453&view=rev
Log:
Simplify script lexer.
Differential Revision: https://reviews.llvm.org/D41577
Modified:
lld/trunk/ELF/ScriptLexer.cpp
lld/trunk/ELF/ScriptParser.cpp
Modified: lld/trunk/ELF/ScriptLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptLexer.cpp?rev=321453&r1=321452&r2=321453&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptLexer.cpp (original)
+++ lld/trunk/ELF/ScriptLexer.cpp Tue Dec 26 02:13:10 2017
@@ -115,11 +115,19 @@ void ScriptLexer::tokenize(MemoryBufferR
continue;
}
+ // ">foo" is parsed to ">" and "foo", but ">>" is parsed to ">>".
+ if (S.startswith("<<") || S.startswith("<=") || S.startswith(">>") ||
+ S.startswith(">=")) {
+ Vec.push_back(S.substr(0, 2));
+ S = S.substr(2);
+ continue;
+ }
+
// Unquoted token. This is more relaxed than tokens in C-like language,
// so that you can write "file-name.cpp" as one bare token, for example.
size_t Pos = S.find_first_not_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789_.$/\\~=+[]*?-!<>^:");
+ "0123456789_.$/\\~=+[]*?-!^:");
// A character that cannot start a word (which is usually a
// punctuation) forms a single character token.
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=321453&r1=321452&r2=321453&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Tue Dec 26 02:13:10 2017
@@ -707,8 +707,6 @@ OutputSection *ScriptParser::readOutputS
if (consume(">"))
Cmd->MemoryRegionName = next();
- else if (peek().startswith(">"))
- Cmd->MemoryRegionName = next().drop_front();
Cmd->Phdrs = readOutputSectionPhdrs();
More information about the llvm-commits
mailing list