aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-mangle.h
diff options
context:
space:
mode:
authorCohenArthur <arthur.cohen@epita.fr>2021-08-24 21:57:54 +0200
committerCohenArthur <arthur.cohen@epita.fr>2021-09-05 20:52:55 +0200
commit04ea1955ee6a70390a171328c537ed121eb05078 (patch)
tree84da324a046eacdce472f647445256fc9f4a1cff /gcc/rust/backend/rust-mangle.h
parent91507076503d57982218c726a712c48adc7a4e1d (diff)
downloadgcc-04ea1955ee6a70390a171328c537ed121eb05078.zip
gcc-04ea1955ee6a70390a171328c537ed121eb05078.tar.gz
gcc-04ea1955ee6a70390a171328c537ed121eb05078.tar.bz2
mangling: Add option to choose mangling version
Diffstat (limited to 'gcc/rust/backend/rust-mangle.h')
-rw-r--r--gcc/rust/backend/rust-mangle.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/rust/backend/rust-mangle.h b/gcc/rust/backend/rust-mangle.h
index 8ed5ab6..1087446 100644
--- a/gcc/rust/backend/rust-mangle.h
+++ b/gcc/rust/backend/rust-mangle.h
@@ -26,23 +26,33 @@ class Mangler
public:
enum MangleVersion
{
- LEGACY,
+ LEGACY = 0,
V0,
};
- Mangler (MangleVersion version) : version (version) {}
-
// this needs to support Legacy and V0 see github #429 or #305
- std::string mangle_item (const TyTy::BaseType *ty, const Resolver::CanonicalPath &path,
+ std::string mangle_item (const TyTy::BaseType *ty,
+ const Resolver::CanonicalPath &path,
const std::string &crate_name) const;
std::string mangle_impl_item (const TyTy::BaseType *self,
const TyTy::BaseType *ty,
const std::string &name,
- const std::string &crate_name) const;
+ const std::string &crate_name) const;
+
+ static bool choose_mangling (std::string arg)
+ {
+ if (arg == "legacy")
+ version = MangleVersion::LEGACY;
+ else if (arg == "v0")
+ version = MangleVersion::V0;
+ else
+ return false;
+
+ return true;
+ }
-private:
- enum MangleVersion version;
+ static enum MangleVersion version;
};
} // namespace Compile
} // namespace Rust