forked from OSchip/llvm-project
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
This commit is contained in:
parent
9b18f50f79
commit
617e2f98a0
|
@ -56,7 +56,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addFile(StringRef Path);
|
void addFile(StringRef Path);
|
||||||
OutputSection *checkSection(OutputSection *Cmd, StringRef Loccation);
|
|
||||||
|
|
||||||
void readAsNeeded();
|
void readAsNeeded();
|
||||||
void readEntry();
|
void readEntry();
|
||||||
|
@ -908,11 +907,9 @@ StringRef ScriptParser::readParenLiteral() {
|
||||||
return Tok;
|
return Tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputSection *ScriptParser::checkSection(OutputSection *Cmd,
|
static void checkIfExists(OutputSection *Cmd, StringRef Location) {
|
||||||
StringRef Location) {
|
|
||||||
if (Cmd->Location.empty() && Script->ErrorOnMissingSection)
|
if (Cmd->Location.empty() && Script->ErrorOnMissingSection)
|
||||||
error(Location + ": undefined section " + Cmd->Name);
|
error(Location + ": undefined section " + Cmd->Name);
|
||||||
return Cmd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr ScriptParser::readPrimary() {
|
Expr ScriptParser::readPrimary() {
|
||||||
|
@ -949,7 +946,8 @@ Expr ScriptParser::readPrimary() {
|
||||||
StringRef Name = readParenLiteral();
|
StringRef Name = readParenLiteral();
|
||||||
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
||||||
return [=]() -> ExprValue {
|
return [=]() -> ExprValue {
|
||||||
return {checkSection(Cmd, Location), 0, Location};
|
checkIfExists(Cmd, Location);
|
||||||
|
return {Cmd, 0, Location};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Tok == "ALIGN") {
|
if (Tok == "ALIGN") {
|
||||||
|
@ -971,7 +969,10 @@ Expr ScriptParser::readPrimary() {
|
||||||
if (Tok == "ALIGNOF") {
|
if (Tok == "ALIGNOF") {
|
||||||
StringRef Name = readParenLiteral();
|
StringRef Name = readParenLiteral();
|
||||||
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
||||||
return [=] { return checkSection(Cmd, Location)->Alignment; };
|
return [=] {
|
||||||
|
checkIfExists(Cmd, Location);
|
||||||
|
return Cmd->Alignment;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (Tok == "ASSERT")
|
if (Tok == "ASSERT")
|
||||||
return readAssertExpr();
|
return readAssertExpr();
|
||||||
|
@ -1018,7 +1019,10 @@ Expr ScriptParser::readPrimary() {
|
||||||
if (Tok == "LOADADDR") {
|
if (Tok == "LOADADDR") {
|
||||||
StringRef Name = readParenLiteral();
|
StringRef Name = readParenLiteral();
|
||||||
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
|
||||||
return [=] { return checkSection(Cmd, Location)->getLMA(); };
|
return [=] {
|
||||||
|
checkIfExists(Cmd, Location);
|
||||||
|
return Cmd->getLMA();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (Tok == "ORIGIN") {
|
if (Tok == "ORIGIN") {
|
||||||
StringRef Name = readParenLiteral();
|
StringRef Name = readParenLiteral();
|
||||||
|
|
Loading…
Reference in New Issue