[lld] r299521 - Make readAssert() to return an AssertCommand object.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 22:50:29 PDT 2017
Author: ruiu
Date: Wed Apr 5 00:50:28 2017
New Revision: 299521
URL: http://llvm.org/viewvc/llvm-project?rev=299521&view=rev
Log:
Make readAssert() to return an AssertCommand object.
Modified:
lld/trunk/ELF/ScriptParser.cpp
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=299521&r1=299520&r2=299521&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Wed Apr 5 00:50:28 2017
@@ -85,7 +85,8 @@ private:
SymbolAssignment *readProvideHidden(bool Provide, bool Hidden);
SymbolAssignment *readProvideOrAssignment(StringRef Tok);
void readSort();
- Expr readAssert();
+ AssertCommand *readAssert();
+ Expr readAssertExpr();
uint64_t readMemoryAssignment(StringRef, StringRef, StringRef);
std::pair<uint32_t, uint32_t> readMemoryAttributes();
@@ -206,7 +207,7 @@ void ScriptParser::readLinkerScript() {
continue;
if (Tok == "ASSERT") {
- Script->Opt.Commands.push_back(make<AssertCommand>(readAssert()));
+ Script->Opt.Commands.push_back(readAssert());
} else if (Tok == "ENTRY") {
readEntry();
} else if (Tok == "EXTERN") {
@@ -396,7 +397,7 @@ void ScriptParser::readSections() {
BaseCommand *Cmd = readProvideOrAssignment(Tok);
if (!Cmd) {
if (Tok == "ASSERT")
- Cmd = make<AssertCommand>(readAssert());
+ Cmd = readAssert();
else
Cmd = readOutputSectionDescription(Tok);
}
@@ -527,7 +528,11 @@ void ScriptParser::readSort() {
expect(")");
}
-Expr ScriptParser::readAssert() {
+AssertCommand *ScriptParser::readAssert() {
+ return make<AssertCommand>(readAssertExpr());
+}
+
+Expr ScriptParser::readAssertExpr() {
expect("(");
Expr E = readExpr();
expect(",");
@@ -588,7 +593,7 @@ ScriptParser::readOutputSectionDescripti
} else if (BytesDataCommand *Data = readBytesDataCommand(Tok)) {
Cmd->Commands.push_back(Data);
} else if (Tok == "ASSERT") {
- Cmd->Commands.push_back(make<AssertCommand>(readAssert()));
+ Cmd->Commands.push_back(readAssert());
expect(";");
} else if (Tok == "CONSTRUCTORS") {
// CONSTRUCTORS is a keyword to make the linker recognize C++ ctors/dtors
@@ -855,7 +860,7 @@ Expr ScriptParser::readPrimary() {
return [=] { return Script->getOutputSection(Location, Name)->Alignment; };
}
if (Tok == "ASSERT")
- return readAssert();
+ return readAssertExpr();
if (Tok == "CONSTANT") {
StringRef Name = readParenLiteral();
return [=] { return getConstant(Name); };
More information about the llvm-commits
mailing list