File: go-encode-id.h

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (32 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// go-encode-id.h -- Go identifier encoding utilities  -*- C++ -*-

// Copyright 2016 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.

#ifndef GO_ENCODE_ID_H
#define GO_ENCODE_ID_H

#include "backend.h"

// Given an identifier that will appear in assembly code, this helper
// returns TRUE if the identifier needs special encoding to be used as
// an ASM name, FALSE if the name is OK as is.
extern bool
go_id_needs_encoding(const std::string& str);

// Encodes the specified identifier for ASM name safety, returning a
// string with the encoded value.
extern std::string
go_encode_id(const std::string &id);

// Returns the empty string if the specified name needs encoding,
// otherwise invokes go_encode_id on the name and returns the result.
extern std::string
go_selectively_encode_id(const std::string &id);

// Encodes a struct tag that appears in a type literal encoding.
extern std::string
go_mangle_struct_tag(const std::string& tag);

#endif // !defined(GO_ENCODE_ID_H)