annotate gcc/go/gofrontend/go-encode-id.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // go-encode-id.h -- Go identifier encoding utilities -*- C++ -*-
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 // Copyright 2016 The Go Authors. All rights reserved.
kono
parents:
diff changeset
4 // Use of this source code is governed by a BSD-style
kono
parents:
diff changeset
5 // license that can be found in the LICENSE file.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 #ifndef GO_ENCODE_ID_H
kono
parents:
diff changeset
8 #define GO_ENCODE_ID_H
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 #include "backend.h"
kono
parents:
diff changeset
11
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
12 // Given an identifier that will appear in assembly code, this helper
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
13 // returns TRUE if the identifier needs special encoding to be used as
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
14 // an ASM name, FALSE if the name is OK as is.
111
kono
parents:
diff changeset
15 extern bool
kono
parents:
diff changeset
16 go_id_needs_encoding(const std::string& str);
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 // Encodes the specified identifier for ASM name safety, returning a
kono
parents:
diff changeset
19 // string with the encoded value.
kono
parents:
diff changeset
20 extern std::string
kono
parents:
diff changeset
21 go_encode_id(const std::string &id);
kono
parents:
diff changeset
22
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
23 // Decodes an encoded ID, returning the original string handed off to
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
24 // go_encode_id().
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
25 extern std::string
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
26 go_decode_id(const std::string &id);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
27
111
kono
parents:
diff changeset
28 // Returns the empty string if the specified name needs encoding,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 // otherwise invokes go_encode_id on the name and returns the result.
111
kono
parents:
diff changeset
30 extern std::string
kono
parents:
diff changeset
31 go_selectively_encode_id(const std::string &id);
kono
parents:
diff changeset
32
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 // Encodes a struct tag that appears in a type literal encoding.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
34 extern std::string
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 go_mangle_struct_tag(const std::string& tag);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
36
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
37 // Encode a package path. A package path can contain any arbitrary
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
38 // character, including '.'. go_encode_id expects that any '.' will
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
39 // be inserted by name mangling in a controlled manner. So first
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
40 // translate any '.' using the same .x encoding as used by
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
41 // go_mangle_struct_tag.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
42 extern std::string
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
43 go_mangle_pkgpath(const std::string& pkgpath);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
44
111
kono
parents:
diff changeset
45 #endif // !defined(GO_ENCODE_ID_H)