111
|
1 // go-encode-id.h -- Go identifier encoding utilities -*- C++ -*-
|
|
2
|
|
3 // Copyright 2016 The Go Authors. All rights reserved.
|
|
4 // Use of this source code is governed by a BSD-style
|
|
5 // license that can be found in the LICENSE file.
|
|
6
|
|
7 #ifndef GO_ENCODE_ID_H
|
|
8 #define GO_ENCODE_ID_H
|
|
9
|
|
10 #include "backend.h"
|
|
11
|
131
|
12 // Given an identifier that will appear in assembly code, this helper
|
|
13 // returns TRUE if the identifier needs special encoding to be used as
|
|
14 // an ASM name, FALSE if the name is OK as is.
|
111
|
15 extern bool
|
|
16 go_id_needs_encoding(const std::string& str);
|
|
17
|
|
18 // Encodes the specified identifier for ASM name safety, returning a
|
|
19 // string with the encoded value.
|
|
20 extern std::string
|
|
21 go_encode_id(const std::string &id);
|
|
22
|
|
23 // Returns the empty string if the specified name needs encoding,
|
131
|
24 // otherwise invokes go_encode_id on the name and returns the result.
|
111
|
25 extern std::string
|
|
26 go_selectively_encode_id(const std::string &id);
|
|
27
|
131
|
28 // Encodes a struct tag that appears in a type literal encoding.
|
|
29 extern std::string
|
|
30 go_mangle_struct_tag(const std::string& tag);
|
|
31
|
111
|
32 #endif // !defined(GO_ENCODE_ID_H)
|