diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-16 13:29:48 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-16 13:29:48 +0000 |
commit | cf1d4987b989fd15d3506505917bc9c11379247e (patch) | |
tree | e29b58b32e41d74748ca6b734a4de006c6af2e05 /lld/ELF/ScriptParser.cpp | |
parent | c9179fd2c263e1e61f90da11914ed7e020008d8e (diff) | |
download | bcm5719-llvm-cf1d4987b989fd15d3506505917bc9c11379247e.tar.gz bcm5719-llvm-cf1d4987b989fd15d3506505917bc9c11379247e.zip |
Add support for # comments.
llvm-svn: 272892
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 937b8a12e2f..4d8787b5edd 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -85,7 +85,7 @@ std::vector<StringRef> ScriptParserBase::tokenize(StringRef S) { } } -// Skip leading whitespace characters or /**/-style comments. +// Skip leading whitespace characters or comments. StringRef ScriptParserBase::skipSpace(StringRef S) { for (;;) { if (S.startswith("/*")) { @@ -97,6 +97,13 @@ StringRef ScriptParserBase::skipSpace(StringRef S) { S = S.substr(E + 2); continue; } + if (S.startswith("#")) { + size_t E = S.find('\n', 1); + if (E == StringRef::npos) + E = S.size() - 1; + S = S.substr(E + 1); + continue; + } size_t Size = S.size(); S = S.ltrim(); if (S.size() == Size) |