@@ -957,13 +957,15 @@ OutputDesc *ScriptParser::readOverlaySectionDescription() {
957
957
OutputDesc *osd = script->createOutputSection (next (), getCurrentLocation ());
958
958
osd->osec .inOverlay = true ;
959
959
expect (" {" );
960
- while (! errorCount () && ! consume (" }" )) {
960
+ while (auto tok = till (" }" )) {
961
961
uint64_t withFlags = 0 ;
962
962
uint64_t withoutFlags = 0 ;
963
- if (consume ( " INPUT_SECTION_FLAGS" ))
963
+ if (tok == " INPUT_SECTION_FLAGS" ) {
964
964
std::tie (withFlags, withoutFlags) = readInputSectionFlags ();
965
+ tok = till (" " );
966
+ }
965
967
osd->osec .commands .push_back (
966
- readInputSectionRules (next () , withFlags, withoutFlags));
968
+ readInputSectionRules (tok , withFlags, withoutFlags));
967
969
}
968
970
osd->osec .phdrs = readOutputSectionPhdrs ();
969
971
return osd;
@@ -1090,7 +1092,7 @@ SymbolAssignment *ScriptParser::readProvideHidden(bool provide, bool hidden) {
1090
1092
StringRef name = next (), eq = peek ();
1091
1093
if (eq != " =" ) {
1092
1094
setError (" = expected, but got " + next ());
1093
- while (! atEOF () && next () != " )" )
1095
+ while (till ( " )" ) )
1094
1096
;
1095
1097
return nullptr ;
1096
1098
}
@@ -1731,15 +1733,11 @@ ScriptParser::readSymbols() {
1731
1733
SmallVector<SymbolVersion, 0 > globals;
1732
1734
SmallVector<SymbolVersion, 0 > *v = &globals;
1733
1735
1734
- while (!errorCount ()) {
1735
- if (consume (" }" ))
1736
- break ;
1737
-
1738
- if (consume (" extern" )) {
1736
+ while (auto tok = till (" }" )) {
1737
+ if (tok == " extern" ) {
1739
1738
SmallVector<SymbolVersion, 0 > ext = readVersionExtern ();
1740
1739
v->insert (v->end (), ext.begin (), ext.end ());
1741
1740
} else {
1742
- StringRef tok = next ();
1743
1741
if (tok == " local:" || (tok == " local" && consume (" :" ))) {
1744
1742
v = &locals;
1745
1743
continue ;
0 commit comments