瀏覽代碼

fix: shorten function names like cpp::namespace::Class::method()::::operator() (#494)

Maggie Nolan 5 年之前
父節點
當前提交
5e965273ee
No account linked to committer's email address
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1
    1
      internal/graph/graph.go
  2. 4
    0
      internal/graph/graph_test.go

+ 1
- 1
internal/graph/graph.go 查看文件

@@ -30,7 +30,7 @@ import (
30 30
 var (
31 31
 	javaRegExp = regexp.MustCompile(`^(?:[a-z]\w*\.)*([A-Z][\w\$]*\.(?:<init>|[a-z][\w\$]*(?:\$\d+)?))(?:(?:\()|$)`)
32 32
 	goRegExp   = regexp.MustCompile(`^(?:[\w\-\.]+\/)+(.+)`)
33
-	cppRegExp  = regexp.MustCompile(`^(?:(?:\(anonymous namespace\)::)(\w+$))|(?:(?:\(anonymous namespace\)::)?(?:[_a-zA-Z]\w*\::|)*(_*[A-Z]\w*::~?[_a-zA-Z]\w*)$)`)
33
+	cppRegExp  = regexp.MustCompile(`^(?:(?:\(anonymous namespace\)::)(\w+$))|(?:(?:\(anonymous namespace\)::)?(?:[_a-zA-Z]\w*\::|)*(_*[A-Z]\w*::~?[_a-zA-Z]\w*))`)
34 34
 )
35 35
 
36 36
 // Graph summarizes a performance profile into a format that is

+ 4
- 0
internal/graph/graph_test.go 查看文件

@@ -467,6 +467,10 @@ func TestShortenFunctionName(t *testing.T) {
467 467
 			"(anonymous namespace)::foo",
468 468
 			"foo",
469 469
 		},
470
+		{
471
+			"cpp::namespace::Class::method()::$_100::operator()",
472
+			"Class::method",
473
+		},
470 474
 		{
471 475
 			"foo_bar::Foo::bar",
472 476
 			"Foo::bar",