Merge pull request #3009 from xTachyon/bettercpp

Serialized ATN const array generates horrible machine code fix
This commit is contained in:
Terence Parr 2021-03-03 18:05:14 -08:00 committed by GitHub
commit 0f8bddcbc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -289,3 +289,4 @@ YYYY/MM/DD, github id, Full name, email
2021/02/21, namasikanam, Xingyu Xie, namasikanam@gmail.com
2021/02/27, khmarbaise, Karl Heinz Marbaise, github@soebes.com
2021/03/02, hackeris
2021/03/03, xTachyon, Damian Andrei, xTachyon@users.noreply.github.com

View File

@ -422,8 +422,7 @@ static std::vector\<uint16_t> _serializedATN;
// Constructs the serialized ATN and writes init code for static member vars.
SerializedATN(model) ::= <<
<if (rest(model.segments))>
<model.segments: {segment | static uint16_t serializedATNSegment<i0>[] = {
<model.segments: {segment | static const uint16_t serializedATNSegment<i0>[] = {
<segment; wrap={<\n> }>
\};}; separator="\n">
@ -431,13 +430,6 @@ SerializedATN(model) ::= <<
serializedATNSegment<i0> + sizeof(serializedATNSegment<i0>) / sizeof(serializedATNSegment<i0>[0]));
}>
<else>
<! only one segment, can be inlined !>
_serializedATN = {
<model.serialized; wrap = {<\n>}>
};
<endif>
atn::ATNDeserializer deserializer;
_atn = deserializer.deserialize(_serializedATN);