diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-07-04 10:38:29 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-04 15:05:30 +0200 |
| commit | dcff124efb2ea4a834b74ac0974aa2f2fd000b40 (patch) | |
| tree | 8d49a1e0849baa283d09c7227ec9d2311a34258a /vendor/github.com/ianlancetaylor | |
| parent | 4f739670f77d37168a44be2139f4005b748a825d (diff) | |
go.mod: switch to modules for dependency management
Godep is long deprecated and modules is the future.
Updating dependencies with godep is painful and non-transparent.
This will hopefully help to create custom golangci-lint linters.
The change was created with:
go mod init
rm -rf vendor
go mod vendor
Fixes #1247
Diffstat (limited to 'vendor/github.com/ianlancetaylor')
| -rw-r--r-- | vendor/github.com/ianlancetaylor/demangle/c++filt.go | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/vendor/github.com/ianlancetaylor/demangle/c++filt.go b/vendor/github.com/ianlancetaylor/demangle/c++filt.go deleted file mode 100644 index 7ba817c9f..000000000 --- a/vendor/github.com/ianlancetaylor/demangle/c++filt.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// This is a program that works like the GNU c++filt program. -// It's here for testing purposes and as an example. - -package main - -import ( - "bufio" - "flag" - "fmt" - "io" - "os" - "strings" - "unicode" - - "github.com/ianlancetaylor/demangle" -) - -func flagUsage() { - usage(os.Stderr, 2) -} - -func usage(w io.Writer, status int) { - fmt.Fprintf(w, "Usage: %s [options] [mangled names]\n", os.Args[0]) - flag.CommandLine.SetOutput(w) - flag.PrintDefaults() - fmt.Fprintln(w, `Demangled names are displayed to stdout -If a name cannot be demangled it is just echoed to stdout. -If no names are provided on the command line, stdin is read.`) - os.Exit(status) -} - -var stripUnderscore = flag.Bool("_", false, "Ignore first leading underscore") -var noParams = flag.Bool("p", false, "Do not display function argument types") -var noVerbose = flag.Bool("i", false, "Do not show implementation details (if any)") -var help = flag.Bool("h", false, "Display help information") -var debug = flag.Bool("d", false, "Display debugging information for strings on command line") - -// Unimplemented c++filt flags: -// -n (opposite of -_) -// -t (demangle types) -// -s (set demangling style) -// -V (print version information) - -// Characters considered to be part of a symbol. -const symbolChars = "_$." - -func main() { - flag.Usage = func() { usage(os.Stderr, 1) } - flag.Parse() - - if *help { - usage(os.Stdout, 0) - } - - out := bufio.NewWriter(os.Stdout) - - if flag.NArg() > 0 { - for _, f := range flag.Args() { - if *debug { - a, err := demangle.ToAST(f, options()...) - if err != nil { - fmt.Fprintf(os.Stderr, "%s: %v\n", f, err) - } else { - fmt.Fprintf(out, "%#v\n", a) - } - } else { - doDemangle(out, f) - } - out.WriteByte('\n') - } - if err := out.Flush(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(2) - } - return - } - - scanner := bufio.NewScanner(bufio.NewReader(os.Stdin)) - for scanner.Scan() { - line := scanner.Text() - start := -1 - for i, c := range line { - if unicode.IsLetter(c) || unicode.IsNumber(c) || strings.ContainsRune(symbolChars, c) { - if start < 0 { - start = i - } - } else { - if start >= 0 { - doDemangle(out, line[start:i]) - } - out.WriteRune(c) - start = -1 - } - } - if start >= 0 { - doDemangle(out, line[start:]) - start = -1 - } - out.WriteByte('\n') - if err := out.Flush(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(2) - } - } -} - -// Demangle a string just as the GNU c++filt program does. -func doDemangle(out *bufio.Writer, name string) { - skip := 0 - if name[0] == '.' || name[0] == '$' { - skip++ - } - if *stripUnderscore && name[skip] == '_' { - skip++ - } - result := demangle.Filter(name[skip:], options()...) - if result == name[skip:] { - out.WriteString(name) - } else { - if name[0] == '.' { - out.WriteByte('.') - } - out.WriteString(result) - } -} - -// options returns the demangling options to use based on the command -// line flags. -func options() []demangle.Option { - var options []demangle.Option - if *noParams { - options = append(options, demangle.NoParams) - } - if !*noVerbose { - options = append(options, demangle.Verbose) - } - return options -} |
