Fix function shortening for complex cases, like:
authorVincent Tondellier <tonton+hg@team1664.org>
Wed, 30 Dec 2015 19:57:32 +0100
changeset 90 6f091abdf5fb
parent 89 d84db31dd51c
child 91 10a62da240f4
Fix function shortening for complex cases, like: std::basic_ostream<A, B>& operator<< <A, B >(std::basic_ostream<A, B>&, T const&)
lib/CrashTest/Plugin/CrashSignatureExtractor/C_Cpp.pm
lib/CrashTest/Plugin/StackFilter/HideArgs.pm
--- a/lib/CrashTest/Plugin/CrashSignatureExtractor/C_Cpp.pm	Tue Dec 29 00:15:38 2015 +0100
+++ b/lib/CrashTest/Plugin/CrashSignatureExtractor/C_Cpp.pm	Wed Dec 30 19:57:32 2015 +0100
@@ -58,7 +58,10 @@
     my $short_signature = "";
     my $text = $signature;
     do {
-        my ($str, $next, $prefix) = extract_bracketed($text, '<(', '[^<(]*');
+        # the complex prefix is here to match normal function names (the last '[^<\(]*' part)
+        # but also the complex case of unbalanced <> like in:
+        # std::basic_ostream<A, B>& operator<< <A, B >(std::basic_ostream<A, B>&, T const&)
+        my ($str, $next, $prefix) = extract_bracketed($text, '<(', qr/([^<\(]*operator[<>]{1,2})?[^<\(]*/);
         if($str) {
             $short_signature .= $prefix;
             $text = $next;
--- a/lib/CrashTest/Plugin/StackFilter/HideArgs.pm	Tue Dec 29 00:15:38 2015 +0100
+++ b/lib/CrashTest/Plugin/StackFilter/HideArgs.pm	Wed Dec 30 19:57:32 2015 +0100
@@ -44,7 +44,10 @@
     my $short_signature = "";
     my $text = $signature;
     do {
-        my ($str, $next, $prefix) = extract_bracketed($text, '<(', '[^<(]*');
+        # the complex prefix is here to match normal function names (the last '[^<\(]*' part)
+        # but also the complex case of unbalanced <> like in:
+        # std::basic_ostream<A, B>& operator<< <A, B >(std::basic_ostream<A, B>&, T const&)
+        my ($str, $next, $prefix) = extract_bracketed($text, '<(', qr/([^<\(]*operator[<>]{1,2})?[^<\(]*/);
         if($str) {
             $short_signature .= $prefix . substr($str, 0, 1) . substr($str, -1, 1);
             $text = $next;