Skip to content

Commit 052fa21

Browse files
committed
fix #14352
1 parent 6148b3d commit 052fa21

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/preprocessor.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,11 +1072,19 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList)
10721072
break;
10731073
}
10741074

1075-
const simplecpp::Token * const tok4 = tok3->next;
10761075
tok->setstr("asm");
10771076
const_cast<simplecpp::Token *>(tok2)->setstr("(");
10781077
const_cast<simplecpp::Token *>(tok3)->setstr(")");
1079-
const_cast<simplecpp::Token *>(tok4)->setstr(";");
1078+
1079+
simplecpp::Token * tok4;
1080+
if (tok3->next) {
1081+
tok4 = tok3->next;
1082+
tok4->setstr(";");
1083+
} else {
1084+
tok4 = new simplecpp::Token(";", tok3->location);
1085+
const_cast<simplecpp::Token *>(tok3)->next = tok4;
1086+
}
1087+
10801088
while (tok4->next != endasm)
10811089
tokenList.deleteToken(tok4->next);
10821090
}

0 commit comments

Comments
 (0)