findclasslist.pl: match unexported classes too
Unexported structs do mark private API too. This change necessitated fixing the negative-lookahead, because otherwise we'd match a line like: class QVariant; With $1 = "QVarian" and the "t" stood for the negative lookahead. Pick-to: 6.4 Change-Id: Ic6547f8247454b47baa8fffd170bba2c68c29dbc Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>bb10
parent
734e0a2fbe
commit
5d903a64ac
|
|
@ -6,6 +6,13 @@ use strict;
|
|||
my $syntax = "findclasslist.pl\n" .
|
||||
"Replaces each \@FILE:filename\@ in stdin with the classes found in that file\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*;$)?/;
|
||||
|
||||
# Match an exported namespace
|
||||
my $nsmatch = qr/^namespace\s+Q_\w+_EXPORT\s+(\w+)/;
|
||||
|
||||
$\ = $/;
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
|
|
@ -24,9 +31,10 @@ while (<STDIN>) {
|
|||
next if $1 eq "ignore" or $1 eq "ignore-next";
|
||||
}
|
||||
|
||||
# Match a struct or class declaration, but not a forward declaration
|
||||
$line =~ /^(?:struct|class|namespace) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next;
|
||||
print $comment if $comment;
|
||||
$line =~ s,\s*(//.*)?$,,; # remove // comments and trailing space
|
||||
next unless $line =~ $nsmatch or $line =~ $classmatch;
|
||||
next if $2 ne ""; # forward declaration
|
||||
|
||||
printf " *%d%s*;\n", length $1, $1;
|
||||
$comment = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue