summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-10-08 02:27:02 +0000
committerRui Ueyama <ruiu@google.com>2017-10-08 02:27:02 +0000
commit617e2f98a0b276577f3dfcb323a6ef1242cd590e (patch)
tree92c3ab9ca4b78628fb34168668e0efac7b330546 /lld/ELF/ScriptParser.cpp
parent9b18f50f7985f3dc0741c5ac10f4539d430d8b67 (diff)
downloadbcm5719-llvm-617e2f98a0b276577f3dfcb323a6ef1242cd590e.tar.gz
bcm5719-llvm-617e2f98a0b276577f3dfcb323a6ef1242cd590e.zip
Make ScriptParser::checkSection a non-member function.
This patch also make its return type to `void` because it always returns a given value as-is. llvm-svn: 315165
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index a024e5375f3..acd8b87fd74 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -56,7 +56,6 @@ public:
private:
void addFile(StringRef Path);
- OutputSection *checkSection(OutputSection *Cmd, StringRef Loccation);
void readAsNeeded();
void readEntry();
@@ -908,11 +907,9 @@ StringRef ScriptParser::readParenLiteral() {
return Tok;
}
-OutputSection *ScriptParser::checkSection(OutputSection *Cmd,
- StringRef Location) {
+static void checkIfExists(OutputSection *Cmd, StringRef Location) {
if (Cmd->Location.empty() && Script->ErrorOnMissingSection)
error(Location + ": undefined section " + Cmd->Name);
- return Cmd;
}
Expr ScriptParser::readPrimary() {
@@ -949,7 +946,8 @@ Expr ScriptParser::readPrimary() {
StringRef Name = readParenLiteral();
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
return [=]() -> ExprValue {
- return {checkSection(Cmd, Location), 0, Location};
+ checkIfExists(Cmd, Location);
+ return {Cmd, 0, Location};
};
}
if (Tok == "ALIGN") {
@@ -971,7 +969,10 @@ Expr ScriptParser::readPrimary() {
if (Tok == "ALIGNOF") {
StringRef Name = readParenLiteral();
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
- return [=] { return checkSection(Cmd, Location)->Alignment; };
+ return [=] {
+ checkIfExists(Cmd, Location);
+ return Cmd->Alignment;
+ };
}
if (Tok == "ASSERT")
return readAssertExpr();
@@ -1018,7 +1019,10 @@ Expr ScriptParser::readPrimary() {
if (Tok == "LOADADDR") {
StringRef Name = readParenLiteral();
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
- return [=] { return checkSection(Cmd, Location)->getLMA(); };
+ return [=] {
+ checkIfExists(Cmd, Location);
+ return Cmd->getLMA();
+ };
}
if (Tok == "ORIGIN") {
StringRef Name = readParenLiteral();
OpenPOWER on IntegriCloud