[lld] r284396 - Rename skip(StringRef) -> consume(StringRef).
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 09:01:54 PDT 2016
Author: ruiu
Date: Mon Oct 17 11:01:53 2016
New Revision: 284396
URL: http://llvm.org/viewvc/llvm-project?rev=284396&view=rev
Log:
Rename skip(StringRef) -> consume(StringRef).
skip() and skip(StringRef) were overloaded functions that
have different semantics. This patch rename one of the functions
to avoid function overloading.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/ELF/ScriptParser.h
lld/trunk/ELF/SymbolListFile.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=284396&r1=284395&r2=284396&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Oct 17 11:01:53 2016
@@ -955,7 +955,7 @@ void ScriptParser::readVersionScript() {
}
void ScriptParser::readVersionScriptCommand() {
- if (skip("{")) {
+ if (consume("{")) {
readVersionDeclaration("");
return;
}
@@ -1050,7 +1050,7 @@ void ScriptParser::readAsNeeded() {
expect("(");
bool Orig = Config->AsNeeded;
Config->AsNeeded = true;
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
addFile(unquote(next()));
Config->AsNeeded = Orig;
}
@@ -1066,13 +1066,13 @@ void ScriptParser::readEntry() {
void ScriptParser::readExtern() {
expect("(");
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
Config->Undefined.push_back(next());
}
void ScriptParser::readGroup() {
expect("(");
- while (!Error && !skip(")")) {
+ while (!Error && !consume(")")) {
StringRef Tok = next();
if (Tok == "AS_NEEDED")
readAsNeeded();
@@ -1129,7 +1129,7 @@ void ScriptParser::readOutputFormat() {
void ScriptParser::readPhdrs() {
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
Opt.PhdrsCommands.push_back(
{Tok, PT_NULL, false, false, UINT_MAX, nullptr});
@@ -1169,7 +1169,7 @@ void ScriptParser::readSearchDir() {
void ScriptParser::readSections() {
Opt.HasSections = true;
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
BaseCommand *Cmd = readProvideOrAssignment(Tok, true);
if (!Cmd) {
@@ -1194,19 +1194,19 @@ static int precedence(StringRef Op) {
Regex ScriptParser::readFilePatterns() {
std::vector<StringRef> V;
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
V.push_back(next());
return compileGlobPatterns(V);
}
SortSectionPolicy ScriptParser::readSortKind() {
- if (skip("SORT") || skip("SORT_BY_NAME"))
+ if (consume("SORT") || consume("SORT_BY_NAME"))
return SortSectionPolicy::Name;
- if (skip("SORT_BY_ALIGNMENT"))
+ if (consume("SORT_BY_ALIGNMENT"))
return SortSectionPolicy::Alignment;
- if (skip("SORT_BY_INIT_PRIORITY"))
+ if (consume("SORT_BY_INIT_PRIORITY"))
return SortSectionPolicy::Priority;
- if (skip("SORT_NONE"))
+ if (consume("SORT_NONE"))
return SortSectionPolicy::None;
return SortSectionPolicy::Default;
}
@@ -1222,7 +1222,7 @@ std::vector<SectionPattern> ScriptParser
std::vector<SectionPattern> Ret;
while (!Error && peek() != ")") {
Regex ExcludeFileRe;
- if (skip("EXCLUDE_FILE")) {
+ if (consume("EXCLUDE_FILE")) {
expect("(");
ExcludeFileRe = readFilePatterns();
}
@@ -1249,7 +1249,7 @@ InputSectionDescription *
ScriptParser::readInputSectionRules(StringRef FilePattern) {
auto *Cmd = new InputSectionDescription(FilePattern);
expect("(");
- while (!HasError && !skip(")")) {
+ while (!HasError && !consume(")")) {
SortSectionPolicy Outer = readSortKind();
SortSectionPolicy Inner = SortSectionPolicy::Default;
std::vector<SectionPattern> V;
@@ -1336,21 +1336,21 @@ ScriptParser::readOutputSectionDescripti
expect(":");
- if (skip("AT"))
+ if (consume("AT"))
Cmd->LMAExpr = readParenExpr();
- if (skip("ALIGN"))
+ if (consume("ALIGN"))
Cmd->AlignExpr = readParenExpr();
- if (skip("SUBALIGN"))
+ if (consume("SUBALIGN"))
Cmd->SubalignExpr = readParenExpr();
// Parse constraints.
- if (skip("ONLY_IF_RO"))
+ if (consume("ONLY_IF_RO"))
Cmd->Constraint = ConstraintKind::ReadOnly;
- if (skip("ONLY_IF_RW"))
+ if (consume("ONLY_IF_RW"))
Cmd->Constraint = ConstraintKind::ReadWrite;
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
if (SymbolAssignment *Assignment = readProvideOrAssignment(Tok, false))
Cmd->Commands.emplace_back(Assignment);
@@ -1367,7 +1367,7 @@ ScriptParser::readOutputSectionDescripti
}
Cmd->Phdrs = readOutputSectionPhdrs();
- if (skip("="))
+ if (consume("="))
Cmd->Filler = readOutputSectionFiller(next());
else if (peek().startswith("="))
Cmd->Filler = readOutputSectionFiller(next().drop_front());
@@ -1430,7 +1430,7 @@ SymbolAssignment *ScriptParser::readAssi
bool IsAbsolute = false;
Expr E;
assert(Op == "=" || Op == "+=");
- if (skip("ABSOLUTE")) {
+ if (consume("ABSOLUTE")) {
E = readParenExpr();
IsAbsolute = true;
} else {
@@ -1737,9 +1737,9 @@ void ScriptParser::readVersionDeclaratio
size_t VersionId = Config->VersionDefinitions.size() + 2;
Config->VersionDefinitions.push_back({VerStr, VersionId});
- if (skip("global:") || peek() != "local:")
+ if (consume("global:") || peek() != "local:")
readGlobal(VerStr);
- if (skip("local:"))
+ if (consume("local:"))
readLocal();
expect("}");
@@ -1782,7 +1782,7 @@ void ScriptParser::readGlobal(StringRef
Globals = &Config->VersionDefinitions.back().Globals;
for (;;) {
- if (skip("extern"))
+ if (consume("extern"))
readExtern(Globals);
StringRef Cur = peek();
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=284396&r1=284395&r2=284396&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Mon Oct 17 11:01:53 2016
@@ -137,7 +137,7 @@ StringRef ScriptParserBase::peek() {
return Tok;
}
-bool ScriptParserBase::skip(StringRef Tok) {
+bool ScriptParserBase::consume(StringRef Tok) {
if (Error)
return false;
if (atEOF()) {
Modified: lld/trunk/ELF/ScriptParser.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.h?rev=284396&r1=284395&r2=284396&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.h (original)
+++ lld/trunk/ELF/ScriptParser.h Mon Oct 17 11:01:53 2016
@@ -30,7 +30,7 @@ protected:
StringRef next();
StringRef peek();
void skip();
- bool skip(StringRef Tok);
+ bool consume(StringRef Tok);
void expect(StringRef Expect);
size_t getPos();
Modified: lld/trunk/ELF/SymbolListFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolListFile.cpp?rev=284396&r1=284395&r2=284396&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolListFile.cpp (original)
+++ lld/trunk/ELF/SymbolListFile.cpp Mon Oct 17 11:01:53 2016
@@ -46,7 +46,7 @@ void DynamicListParser::run() {
while (!Error) {
Config->DynamicList.push_back(unquote(next()));
expect(";");
- if (skip("}"))
+ if (consume("}"))
break;
}
expect(";");
More information about the llvm-commits
mailing list