1 // This file is part of GCC.
2
3 // GCC is free software; you can redistribute it and/or modify it under
4 // the terms of the GNU General Public License as published by the Free
5 // Software Foundation; either version 3, or (at your option) any later
6 // version.
7
8 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
9 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 // for more details.
12
13 // You should have received a copy of the GNU General Public License
14 // along with GCC; see the file COPYING3. If not see
15 // <http://www.gnu.org/licenses/>.
16
17 #ifndef RUST_MANGLE_H
18 #define RUST_MANGLE_H
19
20 #include "rust-system.h"
21 #include "rust-tyty.h"
22
23 namespace Rust {
24 namespace Compile {
25
26 class Mangler
27 {
28 public:
29 enum MangleVersion
30 {
31 // Values defined in rust/lang.opt
32 LEGACY = 0,
33 V0 = 1,
34 };
35
36 // this needs to support Legacy and V0 see github #429 or #305
37 std::string mangle_item (const TyTy::BaseType *ty,
38 const Resolver::CanonicalPath &path) const;
39
40 static void set_mangling (int frust_mangling_value)
41 {
42 version = static_cast<MangleVersion> (frust_mangling_value);
43 }
44
45 private:
46 static enum MangleVersion version;
47 };
48
49 } // namespace Compile
50 } // namespace Rust
51
52 #endif // RUST_MANGLE_H