qtprotobufgen: Keep copied .proto comments inside the generated comment


With COPY_COMMENTS, the leading comment of a message or field is
wrapped into a /* */ block in the generated header. A .proto line
comment may contain "*/", which ended that block early and made the
rest of the comment part of the class declaration. The text was also
passed to Printer::Print() as the format string, so "$" started a
variable substitution and mangled the comment.

Neutralize "*/" and "/*" after the lines are aligned: the inserted " *"
prefix can form a terminator with a line starting with "/", and the
opening "/*" can with a comment starting with "*/". Emit "$" as "$$",
the Printer's literal form.

[ChangeLog][QtProtobuf][qtprotobufgen] With COPY_COMMENTS, a .proto
comment containing "*/", "/*" or "$" is now copied verbatim into the
generated comment. Such comments previously ended the generated comment
early or lost text.

Fixes: QTBUG-151088
Pick-to: 6.12 6.11 6.8
Change-Id: Ice55bb92edc62c2b54f4d2db2fad8c7a12bfc4b6
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
commitbb30debec488f22b9839e9dddc3ebb5f42d51e4c
parent6dbc0215391a724e340d86f3ed898ef22629e866
authorDennis Oberst <dennis.oberst@qt.io>
committerDennis Oberst <dennis.oberst@qt.io>
commit timeWed, 14 Oct 2026 09:24:28 +0000