-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ELF] Updated some while conditions with till #100893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lld-elf Author: Hongyu Chen (yugier) ChangesThis change is based on commit for a cleaner API usage. Thanks to @MaskRay ! Full diff: https://github.com/llvm/llvm-project/pull/100893.diff 1 Files Affected:
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index a79a0b34892fc..b80db28764fd3 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -957,13 +957,15 @@ OutputDesc *ScriptParser::readOverlaySectionDescription() {
OutputDesc *osd = script->createOutputSection(next(), getCurrentLocation());
osd->osec.inOverlay = true;
expect("{");
- while (!errorCount() && !consume("}")) {
+ while (auto tok = till("}")) {
uint64_t withFlags = 0;
uint64_t withoutFlags = 0;
- if (consume("INPUT_SECTION_FLAGS"))
+ if (tok == "INPUT_SECTION_FLAGS") {
std::tie(withFlags, withoutFlags) = readInputSectionFlags();
+ tok = till("");
+ }
osd->osec.commands.push_back(
- readInputSectionRules(next(), withFlags, withoutFlags));
+ readInputSectionRules(tok, withFlags, withoutFlags));
}
osd->osec.phdrs = readOutputSectionPhdrs();
return osd;
@@ -1090,7 +1092,7 @@ SymbolAssignment *ScriptParser::readProvideHidden(bool provide, bool hidden) {
StringRef name = next(), eq = peek();
if (eq != "=") {
setError("= expected, but got " + next());
- while (!atEOF() && next() != ")")
+ while (till(")"))
;
return nullptr;
}
@@ -1731,15 +1733,11 @@ ScriptParser::readSymbols() {
SmallVector<SymbolVersion, 0> globals;
SmallVector<SymbolVersion, 0> *v = &globals;
- while (!errorCount()) {
- if (consume("}"))
- break;
-
- if (consume("extern")) {
+ while (auto tok = till("}")) {
+ if (tok == "extern") {
SmallVector<SymbolVersion, 0> ext = readVersionExtern();
v->insert(v->end(), ext.begin(), ext.end());
} else {
- StringRef tok = next();
if (tok == "local:" || (tok == "local" && consume(":"))) {
v = &locals;
continue;
|
@llvm/pr-subscribers-lld Author: Hongyu Chen (yugier) ChangesThis change is based on commit for a cleaner API usage. Thanks to @MaskRay ! Full diff: https://github.com/llvm/llvm-project/pull/100893.diff 1 Files Affected:
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index a79a0b34892fc..b80db28764fd3 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -957,13 +957,15 @@ OutputDesc *ScriptParser::readOverlaySectionDescription() {
OutputDesc *osd = script->createOutputSection(next(), getCurrentLocation());
osd->osec.inOverlay = true;
expect("{");
- while (!errorCount() && !consume("}")) {
+ while (auto tok = till("}")) {
uint64_t withFlags = 0;
uint64_t withoutFlags = 0;
- if (consume("INPUT_SECTION_FLAGS"))
+ if (tok == "INPUT_SECTION_FLAGS") {
std::tie(withFlags, withoutFlags) = readInputSectionFlags();
+ tok = till("");
+ }
osd->osec.commands.push_back(
- readInputSectionRules(next(), withFlags, withoutFlags));
+ readInputSectionRules(tok, withFlags, withoutFlags));
}
osd->osec.phdrs = readOutputSectionPhdrs();
return osd;
@@ -1090,7 +1092,7 @@ SymbolAssignment *ScriptParser::readProvideHidden(bool provide, bool hidden) {
StringRef name = next(), eq = peek();
if (eq != "=") {
setError("= expected, but got " + next());
- while (!atEOF() && next() != ")")
+ while (till(")"))
;
return nullptr;
}
@@ -1731,15 +1733,11 @@ ScriptParser::readSymbols() {
SmallVector<SymbolVersion, 0> globals;
SmallVector<SymbolVersion, 0> *v = &globals;
- while (!errorCount()) {
- if (consume("}"))
- break;
-
- if (consume("extern")) {
+ while (auto tok = till("}")) {
+ if (tok == "extern") {
SmallVector<SymbolVersion, 0> ext = readVersionExtern();
v->insert(v->end(), ext.begin(), ext.end());
} else {
- StringRef tok = next();
if (tok == "local:" || (tok == "local" && consume(":"))) {
v = &locals;
continue;
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/2205 Here is the relevant piece of the build log for the reference:
|
This change is based on commit for a cleaner API usage. Thanks to @MaskRay !