Преглед изворни кода

Remove demangle package

Instead of including it the demangle package with pprof,
point to its own repo.
Raul Silvera пре 9 година
родитељ
комит
83a31e5c37

+ 1
- 1
internal/binutils/disasm.go Прегледај датотеку

@@ -21,7 +21,7 @@ import (
21 21
 	"strconv"
22 22
 
23 23
 	"github.com/google/pprof/internal/plugin"
24
-	"github.com/google/pprof/third_party/golang/demangle"
24
+	"github.com/ianlancetaylor/demangle"
25 25
 )
26 26
 
27 27
 var (

+ 1
- 1
internal/symbolizer/symbolizer.go Прегледај датотеку

@@ -28,7 +28,7 @@ import (
28 28
 	"github.com/google/pprof/internal/plugin"
29 29
 	"github.com/google/pprof/internal/symbolz"
30 30
 	"github.com/google/pprof/profile"
31
-	"github.com/google/pprof/third_party/golang/demangle"
31
+	"github.com/ianlancetaylor/demangle"
32 32
 )
33 33
 
34 34
 // Symbolizer implements the plugin.Symbolize interface.

+ 0
- 27
third_party/golang/demangle/LICENSE Прегледај датотеку

@@ -1,27 +0,0 @@
1
-Copyright (c) 2015 The Go Authors. All rights reserved.
2
-
3
-Redistribution and use in source and binary forms, with or without
4
-modification, are permitted provided that the following conditions are
5
-met:
6
-
7
-   * Redistributions of source code must retain the above copyright
8
-notice, this list of conditions and the following disclaimer.
9
-   * Redistributions in binary form must reproduce the above
10
-copyright notice, this list of conditions and the following disclaimer
11
-in the documentation and/or other materials provided with the
12
-distribution.
13
-   * Neither the name of Google Inc. nor the names of its
14
-contributors may be used to endorse or promote products derived from
15
-this software without specific prior written permission.
16
-
17
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0
- 3
third_party/golang/demangle/README.md Прегледај датотеку

@@ -1,3 +0,0 @@
1
-# github.com/ianlancetaylor/demangle
2
-
3
-A Go package that can be used to demangle C++ symbol names.

+ 0
- 2642
third_party/golang/demangle/ast.go
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 42
third_party/golang/demangle/ast_test.go Прегледај датотеку

@@ -1,42 +0,0 @@
1
-// Copyright 2015 The Go Authors. All rights reserved.
2
-// Use of this source code is governed by a BSD-style
3
-// license that can be found in the LICENSE file.
4
-
5
-package demangle
6
-
7
-import (
8
-	"fmt"
9
-	"testing"
10
-)
11
-
12
-func TestASTToString(t *testing.T) {
13
-	var tests = []struct {
14
-		input     AST
15
-		want      string
16
-		formatted string
17
-	}{
18
-		{
19
-			&Qualified{Scope: &Name{Name: "s"}, Name: &Name{Name: "C"}},
20
-			"s::C",
21
-			`Qualified:
22
-  Scope: s
23
-  Name: C`,
24
-		},
25
-		{
26
-			&Typed{Name: &Name{Name: "v"}, Type: &BuiltinType{"int"}},
27
-			"int v",
28
-			`Typed:
29
-  Name: v
30
-  Type: BuiltinType: int`,
31
-		},
32
-	}
33
-
34
-	for i, test := range tests {
35
-		if got := ASTToString(test.input); got != test.want {
36
-			t.Errorf("ASTToString of test %d == %s, want %s", i, test.input, test.want)
37
-		}
38
-		if got := fmt.Sprintf("%#v", test.input); got != test.formatted {
39
-			t.Errorf("Formatted test %d == %s, want %s", i, got, test.formatted)
40
-		}
41
-	}
42
-}

+ 0
- 144
third_party/golang/demangle/c++filt.go Прегледај датотеку

@@ -1,144 +0,0 @@
1
-// Copyright 2015 The Go Authors. All rights reserved.
2
-// Use of this source code is governed by a BSD-style
3
-// license that can be found in the LICENSE file.
4
-
5
-// +build ignore
6
-
7
-// This is a program that works like the GNU c++filt program.
8
-// It's here for testing purposes and as an example.
9
-
10
-package main
11
-
12
-import (
13
-	"bufio"
14
-	"flag"
15
-	"fmt"
16
-	"io"
17
-	"os"
18
-	"strings"
19
-	"unicode"
20
-
21
-	"github.com/ianlancetaylor/demangle"
22
-)
23
-
24
-func flagUsage() {
25
-	usage(os.Stderr, 2)
26
-}
27
-
28
-func usage(w io.Writer, status int) {
29
-	fmt.Fprintf(w, "Usage: %s [options] [mangled names]\n", os.Args[0])
30
-	flag.CommandLine.SetOutput(w)
31
-	flag.PrintDefaults()
32
-	fmt.Fprintln(w, `Demangled names are displayed to stdout
33
-If a name cannot be demangled it is just echoed to stdout.
34
-If no names are provided on the command line, stdin is read.`)
35
-	os.Exit(status)
36
-}
37
-
38
-var stripUnderscore = flag.Bool("_", false, "Ignore first leading underscore")
39
-var noParams = flag.Bool("p", false, "Do not display function argument types")
40
-var noVerbose = flag.Bool("i", false, "Do not show implementation details (if any)")
41
-var help = flag.Bool("h", false, "Display help information")
42
-var debug = flag.Bool("d", false, "Display debugging information for strings on command line")
43
-
44
-// Unimplemented c++filt flags:
45
-// -n (opposite of -_)
46
-// -t (demangle types)
47
-// -s (set demangling style)
48
-// -V (print version information)
49
-
50
-// Characters considered to be part of a symbol.
51
-const symbolChars = "_$."
52
-
53
-func main() {
54
-	flag.Usage = func() { usage(os.Stderr, 1) }
55
-	flag.Parse()
56
-
57
-	if *help {
58
-		usage(os.Stdout, 0)
59
-	}
60
-
61
-	out := bufio.NewWriter(os.Stdout)
62
-
63
-	if flag.NArg() > 0 {
64
-		for _, f := range flag.Args() {
65
-			if *debug {
66
-				a, err := demangle.ToAST(f, options()...)
67
-				if err != nil {
68
-					fmt.Fprintf(os.Stderr, "%s: %v\n", f, err)
69
-				} else {
70
-					fmt.Fprintf(out, "%#v\n", a)
71
-				}
72
-			} else {
73
-				doDemangle(out, f)
74
-			}
75
-			out.WriteByte('\n')
76
-		}
77
-		if err := out.Flush(); err != nil {
78
-			fmt.Fprintln(os.Stderr, err)
79
-			os.Exit(2)
80
-		}
81
-		return
82
-	}
83
-
84
-	scanner := bufio.NewScanner(bufio.NewReader(os.Stdin))
85
-	for scanner.Scan() {
86
-		line := scanner.Text()
87
-		start := -1
88
-		for i, c := range line {
89
-			if unicode.IsLetter(c) || unicode.IsNumber(c) || strings.ContainsRune(symbolChars, c) {
90
-				if start < 0 {
91
-					start = i
92
-				}
93
-			} else {
94
-				if start >= 0 {
95
-					doDemangle(out, line[start:i])
96
-				}
97
-				out.WriteRune(c)
98
-				start = -1
99
-			}
100
-		}
101
-		if start >= 0 {
102
-			doDemangle(out, line[start:])
103
-			start = -1
104
-		}
105
-		out.WriteByte('\n')
106
-		if err := out.Flush(); err != nil {
107
-			fmt.Fprintln(os.Stderr, err)
108
-			os.Exit(2)
109
-		}
110
-	}
111
-}
112
-
113
-// Demangle a string just as the GNU c++filt program does.
114
-func doDemangle(out *bufio.Writer, name string) {
115
-	skip := 0
116
-	if name[0] == '.' || name[0] == '$' {
117
-		skip++
118
-	}
119
-	if *stripUnderscore && name[skip] == '_' {
120
-		skip++
121
-	}
122
-	result := demangle.Filter(name[skip:], options()...)
123
-	if result == name[skip:] {
124
-		out.WriteString(name)
125
-	} else {
126
-		if name[0] == '.' {
127
-			out.WriteByte('.')
128
-		}
129
-		out.WriteString(result)
130
-	}
131
-}
132
-
133
-// options returns the demangling options to use based on the command
134
-// line flags.
135
-func options() []demangle.Option {
136
-	var options []demangle.Option
137
-	if *noParams {
138
-		options = append(options, demangle.NoParams)
139
-	}
140
-	if !*noVerbose {
141
-		options = append(options, demangle.Verbose)
142
-	}
143
-	return options
144
-}

+ 0
- 2327
third_party/golang/demangle/demangle.go
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 292
third_party/golang/demangle/demangle_test.go Прегледај датотеку

@@ -1,292 +0,0 @@
1
-// Copyright 2015 The Go Authors. All rights reserved.
2
-// Use of this source code is governed by a BSD-style
3
-// license that can be found in the LICENSE file.
4
-
5
-package demangle
6
-
7
-import (
8
-	"strconv"
9
-	"strings"
10
-	"testing"
11
-)
12
-
13
-// Check test cases discovered after the code passed the tests in
14
-// demangle-expected (which are tested by TestExpected).  Some of this
15
-// are cases where we differ from the standard demangler, some we are
16
-// the same but we weren't initially.
17
-func TestDemangler(t *testing.T) {
18
-	var tests = []struct {
19
-		input                string
20
-		want                 string
21
-		wantNoParams         string
22
-		wantNoTemplateParams string
23
-		wantMinimal          string
24
-	}{
25
-		{
26
-			"_ZNSaIcEC1ERKS_",
27
-			"std::allocator<char>::allocator(std::allocator<char> const&)",
28
-			"std::allocator<char>::allocator",
29
-			"std::allocator::allocator(std::allocator const&)",
30
-			"std::allocator::allocator",
31
-		},
32
-		{
33
-			"_ZN9__gnu_cxx13stdio_filebufIcSt11char_traitsIcEEC1EP8_IO_FILESt13_Ios_Openmodem",
34
-			"__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >::stdio_filebuf(_IO_FILE*, std::_Ios_Openmode, unsigned long)",
35
-			"__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >::stdio_filebuf",
36
-			"__gnu_cxx::stdio_filebuf::stdio_filebuf(_IO_FILE*, std::_Ios_Openmode, unsigned long)",
37
-			"__gnu_cxx::stdio_filebuf::stdio_filebuf",
38
-		},
39
-		{
40
-			"_ZN1n1CcvNS_1DIT_EEI1EEEv",
41
-			"n::C::operator n::D<E><E>()",
42
-			"n::C::operator n::D<E><E>",
43
-			"n::C::operator n::D()",
44
-			"n::C::operator n::D",
45
-		},
46
-		{
47
-			"_Z1CIvPN1D1E1FIdJEEEdEPN1GILb0ET_T0_T1_E1HEPFS6_S7_S8_EN1H1I1JIS7_E1KENSG_IS8_E1KE",
48
-			"G<false, void, D::E::F<double>*, double>::H* C<void, D::E::F<double>*, double>(void (*)(D::E::F<double>*, double), H::I::J<D::E::F<double>*>::K, H::I::J<double>::K)",
49
-			"C<void, D::E::F<double>*, double>",
50
-			"G::H* C(void (*)(D::E::F*, double), H::I::J::K, H::I::J::K)",
51
-			"C",
52
-		},
53
-		{
54
-			"_ZZNK1CI1DIcSt1EIcESaIcEEJEE1FEvE1F",
55
-			"C<D<char, std::E<char>, std::allocator<char> > >::F() const::F",
56
-			"C<D<char, std::E<char>, std::allocator<char> > >::F() const::F",
57
-			"C::F() const::F",
58
-			"C::F() const::F",
59
-		},
60
-		{
61
-			"_ZN1CI1DSt1EIK1FN1G1HEEE1I1JIJRKS6_EEEvDpOT_",
62
-			"void C<D, std::E<F const, G::H> >::I::J<std::E<F const, G::H> const&>(std::E<F const, G::H> const&)",
63
-			"C<D, std::E<F const, G::H> >::I::J<std::E<F const, G::H> const&>",
64
-			"void C::I::J(std::E const&)",
65
-			"C::I::J",
66
-		},
67
-		{
68
-			"_ZN1C1D1E1FIJEEEvi1GDpT_",
69
-			"void C::D::E::F<>(int, G)",
70
-			"C::D::E::F<>",
71
-			"void C::D::E::F(int, G)",
72
-			"C::D::E::F",
73
-		},
74
-		{
75
-			"_ZN1CILj50ELb1EE1DEv",
76
-			"C<50u, true>::D()",
77
-			"C<50u, true>::D",
78
-			"C::D()",
79
-			"C::D",
80
-		},
81
-		{
82
-			"_ZN1CUt_C2Ev",
83
-			"C::{unnamed type#1}::{unnamed type#1}()",
84
-			"C::{unnamed type#1}::{unnamed type#1}",
85
-			"C::{unnamed type#1}::{unnamed type#1}()",
86
-			"C::{unnamed type#1}::{unnamed type#1}",
87
-		},
88
-		{
89
-			"_ZN1C12_GLOBAL__N_11DINS_1EEEEN1F1GIDTadcldtcvT__E1HEEEERKS5_NS_1I1JE",
90
-			"F::G<decltype (&((((C::E)()).H)()))> C::(anonymous namespace)::D<C::E>(C::E const&, C::I::J)",
91
-			"C::(anonymous namespace)::D<C::E>",
92
-			"F::G C::(anonymous namespace)::D(C::E const&, C::I::J)",
93
-			"C::(anonymous namespace)::D",
94
-		},
95
-		{
96
-			"_ZN1CI1DE1EIJiRiRPKcRA1_S4_S8_bS6_S3_RjRPKN1F1GERPKN1H1IEEEEvDpOT_",
97
-			"void C<D>::E<int, int&, char const*&, char const (&) [1], char const (&) [1], bool, char const*&, int&, unsigned int&, F::G const*&, H::I const*&>(int&&, int&, char const*&, char const (&) [1], char const (&) [1], bool&&, char const*&, int&, unsigned int&, F::G const*&, H::I const*&)",
98
-			"C<D>::E<int, int&, char const*&, char const (&) [1], char const (&) [1], bool, char const*&, int&, unsigned int&, F::G const*&, H::I const*&>",
99
-			"void C::E(int&&, int&, char const*&, char const (&) [1], char const (&) [1], bool&&, char const*&, int&, unsigned int&, F::G const*&, H::I const*&)",
100
-			"C::E",
101
-		},
102
-		{
103
-			"_ZN1C12_GLOBAL__N_11DIFbPKNS_1EEEEEvPNS_1FERKT_",
104
-			"void C::(anonymous namespace)::D<bool (C::E const*)>(C::F*, bool (&)(C::E const*) const)",
105
-			"C::(anonymous namespace)::D<bool (C::E const*)>",
106
-			"void C::(anonymous namespace)::D(C::F*, bool (&)(C::E const*) const)",
107
-			"C::(anonymous namespace)::D",
108
-		},
109
-		{
110
-			"_ZN1C1D1EIJRFviSt1FIFvRKN1G1H1IEEERKSt6vectorINS_1JESaISB_EEERiS9_EvEENS0_1K1LIJDpNSt1MIT_E1NEEEEDpOSM_",
111
-			"C::D::K::L<std::M<void (&)(int, std::F<void (G::H::I const&)>, std::vector<C::J, std::allocator<C::J> > const&)>::N, std::M<int&>::N, std::M<std::F<void (G::H::I const&)> >::N> C::D::E<void (&)(int, std::F<void (G::H::I const&)>, std::vector<C::J, std::allocator<C::J> > const&), int&, std::F<void (G::H::I const&)>, void>(void (&)(int, std::F<void (G::H::I const&)>, std::vector<C::J, std::allocator<C::J> > const&), int&, std::F<void (G::H::I const&)>&&)",
112
-			"C::D::E<void (&)(int, std::F<void (G::H::I const&)>, std::vector<C::J, std::allocator<C::J> > const&), int&, std::F<void (G::H::I const&)>, void>",
113
-			"C::D::K::L C::D::E(void (&)(int, std::F, std::vector const&), int&, std::F&&)",
114
-			"C::D::E",
115
-		},
116
-		{
117
-			"_ZN1C1D1E1FcvNS_1GIT_EEI1HEEv",
118
-			"C::D::E::F::operator C::G<H><H>()",
119
-			"C::D::E::F::operator C::G<H><H>",
120
-			"C::D::E::F::operator C::G()",
121
-			"C::D::E::F::operator C::G",
122
-		},
123
-		{
124
-			"_ZN9__gnu_cxx17__normal_iteratorIPK1EIN1F1G1HEESt6vectorIS5_SaIS5_EEEC2IPS5_EERKNS0_IT_NS_11__enable_ifIXsr3std10__are_sameISE_SD_EE7__valueESA_E1IEEE",
125
-			"__gnu_cxx::__normal_iterator<E<F::G::H> const*, std::vector<E<F::G::H>, std::allocator<E<F::G::H> > > >::__normal_iterator<E<F::G::H>*>(__gnu_cxx::__normal_iterator<E<F::G::H>*, __gnu_cxx::__enable_if<std::__are_same<E<F::G::H>*, E<F::G::H>*>::__value, std::vector<E<F::G::H>, std::allocator<E<F::G::H> > > >::I> const&)",
126
-			"__gnu_cxx::__normal_iterator<E<F::G::H> const*, std::vector<E<F::G::H>, std::allocator<E<F::G::H> > > >::__normal_iterator<E<F::G::H>*>",
127
-			"__gnu_cxx::__normal_iterator::__normal_iterator(__gnu_cxx::__normal_iterator const&)",
128
-			"__gnu_cxx::__normal_iterator::__normal_iterator",
129
-		},
130
-		{
131
-			"_ZNKSt1CIM1DKFjvEEclIJEvEEjPKS0_DpOT_",
132
-			"unsigned int std::C<unsigned int (D::*)() const>::operator()<void>(D const*) const",
133
-			"std::C<unsigned int (D::*)() const>::operator()<void>",
134
-			"unsigned int std::C::operator()(D const*) const",
135
-			"std::C::operator()",
136
-		},
137
-		{
138
-			"_ZNSt10_HashtableI12basic_stringIcSt11char_traitsIcESaIcEESt4pairIKS4_N1C1D1EEESaISA_ENSt8__detail10_Select1stESt8equal_toIS4_ESt4hashIS4_ENSC_18_Mod_range_hashingENSC_20_Default_ranged_hashENSC_20_Prime_rehash_policyENSC_17_Hashtable_traitsILb1ELb0ELb1EEEE9_M_assignIZNSN_C1ERKSN_EUlPKNSC_10_Hash_nodeISA_Lb1EEEE_EEvSQ_RKT_",
139
-			"void std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign<std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, true> const*)#1}>(std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&, std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, true> const*)#1} const&)",
140
-			"std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign<std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, std::allocator<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E> >, std::__detail::_Select1st, std::equal_to<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<basic_string<char, std::char_traits<char>, std::allocator<char> > const, C::D::E>, true> const*)#1}>",
141
-			"void std::_Hashtable::_M_assign(std::_Hashtable const&, std::_Hashtable::_Hashtable(std::_Hashtable const&)::{lambda(std::__detail::_Hash_node const*)#1} const&)",
142
-			"std::_Hashtable::_M_assign",
143
-		},
144
-		{
145
-			"_ZSt3maxIVdERKT_S3_S3_",
146
-			"double const volatile& std::max<double volatile>(double const volatile&, double const volatile&)",
147
-			"std::max<double volatile>",
148
-			"double const volatile& std::max(double const volatile&, double const volatile&)",
149
-			"std::max",
150
-		},
151
-		{
152
-			"_ZZN1C1D1E1F1G1HEvENUlvE_C2EOS4_",
153
-			"C::D::E::F::G::H()::{lambda()#1}::{lambda()#1}({lambda()#1}&&)",
154
-			"C::D::E::F::G::H()::{lambda()#1}::{lambda()#1}",
155
-			"C::D::E::F::G::H()::{lambda()#1}::{lambda()#1}({lambda()#1}&&)",
156
-			"C::D::E::F::G::H()::{lambda()#1}::{lambda()#1}",
157
-		},
158
-		{
159
-			"_ZThn8_NK1C1D1EEv",
160
-			"non-virtual thunk to C::D::E() const",
161
-			"non-virtual thunk to C::D::E() const",
162
-			"non-virtual thunk to C::D::E() const",
163
-			"non-virtual thunk to C::D::E() const",
164
-		},
165
-		{
166
-			"_ZTv0_n96_NK1C1D1E1FEv",
167
-			"virtual thunk to C::D::E::F() const",
168
-			"virtual thunk to C::D::E::F() const",
169
-			"virtual thunk to C::D::E::F() const",
170
-			"virtual thunk to C::D::E::F() const",
171
-		},
172
-		{
173
-			"_ZTCSt9strstream16_So",
174
-			"construction vtable for std::ostream-in-std::strstream",
175
-			"construction vtable for std::ostream-in-std::strstream",
176
-			"construction vtable for std::ostream-in-std::strstream",
177
-			"construction vtable for std::ostream-in-std::strstream",
178
-		},
179
-		{
180
-			"_ZGVZZN1C1D1EEvENK3$_0clEvE1F",
181
-			"guard variable for C::D::E()::$_0::operator()() const::F",
182
-			"guard variable for C::D::E()::$_0::operator()() const::F",
183
-			"guard variable for C::D::E()::$_0::operator()() const::F",
184
-			"guard variable for C::D::E()::$_0::operator()() const::F",
185
-		},
186
-		{
187
-			"_Z1fICiEvT_",
188
-			"void f<int _Complex>(int _Complex)",
189
-			"f<int _Complex>",
190
-			"void f(int _Complex)",
191
-			"f",
192
-		},
193
-		{
194
-			"_GLOBAL__D__Z2fnv",
195
-			"global destructors keyed to fn()",
196
-			"global destructors keyed to fn()",
197
-			"global destructors keyed to fn()",
198
-			"global destructors keyed to fn()",
199
-		},
200
-		{
201
-			"_Z1fIXadL_Z1hvEEEvv",
202
-			"void f<&h>()",
203
-			"f<&h>",
204
-			"void f()",
205
-			"f",
206
-		},
207
-		{
208
-			"_Z1CIP1DEiRK1EPT_N1F1GIS5_Xaasr1HIS5_E1IntsrSA_1JEE1KE",
209
-			"int C<D*>(E const&, D**, F::G<D*, H<D*>::I&&(!H<D*>::J)>::K)",
210
-			"C<D*>",
211
-			"int C(E const&, D**, F::G::K)",
212
-			"C",
213
-		},
214
-	}
215
-
216
-	for _, test := range tests {
217
-		if got, err := ToString(test.input); err != nil {
218
-			t.Errorf("demangling %s: unexpected error %v", test.input, err)
219
-		} else if got != test.want {
220
-			t.Errorf("demangling %s: got %s, want %s", test.input, got, test.want)
221
-		}
222
-
223
-		if got, err := ToString(test.input, NoParams); err != nil {
224
-			t.Errorf("demangling NoParams  %s: unexpected error %v", test.input, err)
225
-		} else if got != test.wantNoParams {
226
-			t.Errorf("demangling NoParams %s: got %s, want %s", test.input, got, test.wantNoParams)
227
-		}
228
-
229
-		if got, err := ToString(test.input, NoTemplateParams); err != nil {
230
-			t.Errorf("demangling NoTemplateParams %s: unexpected error %v", test.input, err)
231
-		} else if got != test.wantNoTemplateParams {
232
-			t.Errorf("demangling NoTemplateParams %s: got %s, want %s", test.input, got, test.wantNoTemplateParams)
233
-		}
234
-
235
-		if got, err := ToString(test.input, NoParams, NoTemplateParams); err != nil {
236
-			t.Errorf("demangling NoTemplateParams %s: unexpected error %v", test.input, err)
237
-		} else if got != test.wantMinimal {
238
-			t.Errorf("demangling Minimal %s: got %s, want %s", test.input, got, test.wantMinimal)
239
-		}
240
-
241
-		// Test Filter also.
242
-		if got := Filter(test.input); got != test.want {
243
-			t.Errorf("Filter(%s) == %s, want %s", test.input, got, test.want)
244
-		}
245
-	}
246
-}
247
-
248
-// Test for some failure cases.
249
-func TestFailure(t *testing.T) {
250
-	var tests = []struct {
251
-		input string
252
-		error string
253
-		off   int
254
-	}{
255
-		{
256
-			"_Z1FE",
257
-			"unparsed characters at end of mangled name",
258
-			4,
259
-		},
260
-		{
261
-			"_Z1FQ",
262
-			"unrecognized type code",
263
-			4,
264
-		},
265
-	}
266
-
267
-	for _, test := range tests {
268
-		got, err := ToString(test.input)
269
-		if err == nil {
270
-			t.Errorf("unexpected success for %s: %s", test.input, got)
271
-		} else if !strings.Contains(err.Error(), test.error) {
272
-			t.Errorf("unexpected error for %s: %v", test.input, err)
273
-		} else {
274
-			s := err.Error()
275
-			i := strings.LastIndex(s, " at ")
276
-			if i < 0 {
277
-				t.Errorf("missing offset in error for %s: %v", test.input, err)
278
-			} else {
279
-				off, oerr := strconv.Atoi(s[i+4:])
280
-				if oerr != nil {
281
-					t.Errorf("can't parse offset (%s) for %s: %v", s[i+4:], test.input, err)
282
-				} else if off != test.off {
283
-					t.Errorf("unexpected offset for %s: got %d, want %d", test.input, off, test.off)
284
-				}
285
-			}
286
-		}
287
-
288
-		if got := Filter(test.input); got != test.input {
289
-			t.Errorf("Filter(%s) == %s, want %s", test.input, got, test.input)
290
-		}
291
-	}
292
-}

+ 0
- 182
third_party/golang/demangle/expected_test.go Прегледај датотеку

@@ -1,182 +0,0 @@
1
-// Copyright 2015 The Go Authors. All rights reserved.
2
-// Use of this source code is governed by a BSD-style
3
-// license that can be found in the LICENSE file.
4
-
5
-package demangle
6
-
7
-import (
8
-	"bufio"
9
-	"flag"
10
-	"fmt"
11
-	"os"
12
-	"strings"
13
-	"testing"
14
-)
15
-
16
-var verbose = flag.Bool("verbose", false, "print each demangle-expected symbol")
17
-
18
-const filename = "testdata/demangle-expected"
19
-
20
-// A list of exceptions from demangle-expected that we do not handle
21
-// the same as the standard demangler.  We keep a list of exceptions
22
-// so that we can use an exact copy of the file.  These exceptions are
23
-// all based on different handling of a substitution that refers to a
24
-// template parameter.  The standard demangler seems to have a bug in
25
-// which template it uses when a reference or rvalue-reference refers
26
-// to a substitution that resolves to a template parameter.
27
-var exceptions = map[string]bool{
28
-	"_ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_section_processorObjIZ15get_body_parserIZZN14mime_processor21make_section_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUlmE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16remove_referenceISW_E4typeE": true,
29
-	"_ZN3mdr16in_cached_threadIRZNK4cudr6GPUSet17parallel_for_eachIZN5tns3d20shape_representation7compute7GPUImpl7executeERKNS_1AINS_7ptr_refIKjEELl3ELl3ENS_8c_strideILl1ELl0EEEEERKNS8_INS9_IjEELl4ELl1ESD_EEEUliRKNS1_7ContextERNS7_5StateEE_JSt6vectorISO_SaISO_EEEEEvOT_DpRT0_EUlSP_E_JSt17reference_wrapperISO_EEEENS_12ScopedFutureIDTclfp_spcl7forwardISW_Efp0_EEEEESV_DpOSW_":                                                        true,
30
-	"_ZNSt9_Any_data9_M_accessIPZN3sel8Selector6SetObjI3FooJPKcMS4_FviEEEEvRT_DpT0_EUlvE_EESA_v":                                                                                                                   true,
31
-	"_ZNSt9_Any_data9_M_accessIPZN13ThreadManager7newTaskIRSt5_BindIFSt7_Mem_fnIM5DiaryFivEEPS5_EEIEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEEOSF_DpOSG_EUlvE_EERSF_v":                                            true,
32
-	"_ZNSt9_Any_data9_M_accessIPZN6cereal18polymorphic_detail15getInputBindingINS1_16JSONInputArchiveEEENS1_6detail15InputBindingMapIT_E11SerializersERS7_jEUlPvRSt10unique_ptrIvNS5_12EmptyDeleterIvEEEE0_EESA_v": true,
33
-	"_ZNSt9_Any_data9_M_accessIPZ4postISt8functionIFvvEEEvOT_EUlvE_EERS5_v":                                                                                                                                        true,
34
-}
35
-
36
-// For simplicity, this test reads an exact copy of
37
-// libiberty/testsuite/demangle-expected from GCC.  See that file for
38
-// the syntax.  We ignore all tests that are not --format=gnu-v3 or
39
-// --format=auto with a string starting with _Z.
40
-func TestExpected(t *testing.T) {
41
-	f, err := os.Open(filename)
42
-	if err != nil {
43
-		t.Fatal(err)
44
-	}
45
-	scanner := bufio.NewScanner(f)
46
-	lineno := 1
47
-	for {
48
-		format, got := getOptLine(t, scanner, &lineno)
49
-		if !got {
50
-			break
51
-		}
52
-		report := lineno
53
-		input := getLine(t, scanner, &lineno)
54
-		expect := getLine(t, scanner, &lineno)
55
-
56
-		testNoParams := false
57
-		skip := false
58
-		if len(format) > 0 && format[0] == '-' {
59
-			for _, arg := range strings.Fields(format) {
60
-				switch arg {
61
-				case "--format=gnu-v3":
62
-				case "--format=auto":
63
-					if !strings.HasPrefix(input, "_Z") {
64
-						skip = true
65
-					}
66
-				case "--no-params":
67
-					testNoParams = true
68
-				case "--ret-postfix", "--ret-drop":
69
-					skip = true
70
-				case "--is-v3-ctor", "--is-v3-dtor":
71
-					skip = true
72
-				default:
73
-					if !strings.HasPrefix(arg, "--format=") {
74
-						t.Errorf("%s:%d: unrecognized argument %s", filename, report, arg)
75
-					}
76
-					skip = true
77
-				}
78
-			}
79
-		}
80
-
81
-		// The libiberty testsuite passes DMGL_TYPES to
82
-		// demangle type names, but that doesn't seem useful
83
-		// and we don't support it.
84
-		if !strings.HasPrefix(input, "_Z") && !strings.HasPrefix(input, "_GLOBAL_") {
85
-			skip = true
86
-		}
87
-
88
-		var expectNoParams string
89
-		if testNoParams {
90
-			expectNoParams = getLine(t, scanner, &lineno)
91
-		}
92
-
93
-		if skip {
94
-			continue
95
-		}
96
-
97
-		oneTest(t, report, input, expect, true)
98
-		if testNoParams {
99
-			oneTest(t, report, input, expectNoParams, false)
100
-		}
101
-	}
102
-	if err := scanner.Err(); err != nil {
103
-		t.Error(err)
104
-	}
105
-}
106
-
107
-// oneTest tests one entry from demangle-expected.
108
-func oneTest(t *testing.T, report int, input, expect string, params bool) {
109
-	if *verbose {
110
-		fmt.Println(input)
111
-	}
112
-
113
-	exception := exceptions[input]
114
-
115
-	var s string
116
-	var err error
117
-	if params {
118
-		s, err = ToString(input)
119
-	} else {
120
-		s, err = ToString(input, NoParams)
121
-	}
122
-	if err != nil {
123
-		if exception {
124
-			t.Logf("%s:%d: ignore expected difference: got %q, expected %q", filename, report, err, expect)
125
-			return
126
-		}
127
-
128
-		if err != ErrNotMangledName {
129
-			if input == expect {
130
-				return
131
-			}
132
-			t.Errorf("%s:%d: %v", filename, report, err)
133
-			return
134
-		}
135
-		s = input
136
-	}
137
-
138
-	if s != expect {
139
-		if exception {
140
-			t.Logf("%s:%d: ignore expected difference: got %q, expected %q", filename, report, s, expect)
141
-		} else {
142
-			var a AST
143
-			if params {
144
-				a, err = ToAST(input)
145
-			} else {
146
-				a, err = ToAST(input, NoParams)
147
-			}
148
-			if err != nil {
149
-				t.Logf("ToAST error: %v", err)
150
-			} else {
151
-				t.Logf("\n%#v", a)
152
-			}
153
-			t.Errorf("%s:%d: params: %t: got %q, expected %q", filename, report, params, s, expect)
154
-		}
155
-	} else if exception && params {
156
-		t.Errorf("%s:%d: unexpected success (input listed in exceptions)", filename, report)
157
-	}
158
-}
159
-
160
-// getLine reads a line from demangle-expected.
161
-func getLine(t *testing.T, scanner *bufio.Scanner, lineno *int) string {
162
-	s, got := getOptLine(t, scanner, lineno)
163
-	if !got {
164
-		t.Fatalf("%s:%d: unexpected EOF", filename, *lineno)
165
-	}
166
-	return s
167
-}
168
-
169
-// getOptLine reads an optional line from demangle-expected, returning
170
-// false at EOF.  It skips comment lines and updates *lineno.
171
-func getOptLine(t *testing.T, scanner *bufio.Scanner, lineno *int) (string, bool) {
172
-	for {
173
-		if !scanner.Scan() {
174
-			return "", false
175
-		}
176
-		*lineno++
177
-		line := scanner.Text()
178
-		if !strings.HasPrefix(line, "#") {
179
-			return line, true
180
-		}
181
-	}
182
-}

+ 0
- 4400
third_party/golang/demangle/testdata/demangle-expected
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку