findclasslist.pl: do match subclasses in private headers too

I noticed that the QtCore version file had several entries for
13QObjectPrivate, which turns out to be for all the nested structs
inside. That's not harmful for QObjectPrivate, since that is itself a
private, but would be a problem for a nested struct of a public class.
I'm sure those exist.

Pick-to: 6.4
Change-Id: Ic6547f8247454b47baa8fffd170ea79360aaa615
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
bb10
Thiago Macieira 2022-08-25 14:46:03 -03:00
parent 5d903a64ac
commit ee3894946a
1 changed files with 7 additions and 3 deletions

View File

@ -8,10 +8,10 @@ my $syntax = "findclasslist.pl\n" .
# Match a struct or class declaration at the top-level, but not a forward
# declaration
my $classmatch = qr/^(?:struct|class)(?:\s+Q_\w*_EXPORT)?\s+(\w+)(\s*;$)?/;
my $classmatch = qr/^(?:struct|class)(?:\s+Q_\w*_EXPORT)?\s+([\w:]+)(\s*;$)?/;
# Match an exported namespace
my $nsmatch = qr/^namespace\s+Q_\w+_EXPORT\s+(\w+)/;
my $nsmatch = qr/^namespace\s+Q_\w+_EXPORT\s+([\w:]+)/;
$\ = $/;
while (<STDIN>) {
@ -35,7 +35,11 @@ while (<STDIN>) {
next unless $line =~ $nsmatch or $line =~ $classmatch;
next if $2 ne ""; # forward declaration
printf " *%d%s*;\n", length $1, $1;
# split the namespace-qualified or nested class identifiers
my $sym = ($1 =~ s/:$//r); # remove trailing :
my @sym = split /::/, $sym;
@sym = map { sprintf "%d%s", length $_, $_; } @sym;
printf " *%s*;\n", join("", @sym);
$comment = 0;
}
close HDR;