Changeset b0845f9 for src/SymTab/Mangler.h
- Timestamp:
- Nov 17, 2023, 10:40:21 AM (8 months ago)
- Branches:
- master
- Children:
- 0f6d2884
- Parents:
- e580aa5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.h
re580aa5 rb0845f9 34 34 } 35 35 36 namespace SymTab { 37 namespace Mangler { 38 namespace Encoding { 39 extern const std::string manglePrefix; 40 extern const std::string basicTypes[]; 41 extern const std::map<int, std::string> qualifiers; 36 namespace Mangle { 42 37 43 extern const std::string void_t; 44 extern const std::string zero; 45 extern const std::string one; 38 /// Bitflags for mangle Mode: 39 enum { 40 NoOverrideable = 1 << 0, 41 Type = 1 << 1, 42 NoGenericParams = 1 << 2 43 }; 46 44 47 extern const std::string function; 48 extern const std::string tuple; 49 extern const std::string pointer; 50 extern const std::string array; 51 extern const std::string qualifiedTypeStart; 52 extern const std::string qualifiedTypeEnd; 53 54 extern const std::string forall; 55 extern const std::string typeVariables[]; 56 57 extern const std::string struct_t; 58 extern const std::string union_t; 59 extern const std::string enum_t; 60 extern const std::string type; 61 62 extern const std::string autogen; 63 extern const std::string intrinsic; 45 /// Bitflag type for mangle Mode: 46 struct mangle_flags { 47 union { 48 unsigned int val; 49 struct { 50 bool no_overrideable : 1; 51 bool type : 1; 52 bool no_generic_params : 1; 64 53 }; 65 } // Mangler66 } // SymTab67 68 namespace Mangle {69 /// Bitflags for mangle modes70 enum {71 NoOverrideable = 1 << 0,72 Type = 1 << 1,73 NoGenericParams = 1 << 274 54 }; 75 55 76 /// Bitflag type for mangler modes 77 struct mangle_flags { 78 union { 79 unsigned int val; 80 struct { 81 bool no_overrideable : 1; 82 bool type : 1; 83 bool no_generic_params : 1; 84 }; 85 }; 56 constexpr mangle_flags( unsigned int val ) : val(val) {} 57 }; 86 58 87 constexpr mangle_flags( unsigned int val ) : val(val) {} 88 }; 59 using Mode = bitfield<mangle_flags>; 89 60 90 using Mode = bitfield<mangle_flags>; 61 /// Mangle declaration name. 62 std::string mangle( const ast::Node * decl, Mode mode = {} ); 91 63 92 /// Mangle declaration name. 93 std::string mangle( const ast::Node * decl, Mode mode = {} ); 64 /// Most common mangle configuration for types. 65 static inline std::string mangleType( const ast::Node * type ) { 66 return mangle( type, { NoOverrideable | Type } ); 67 } 94 68 95 /// Most common mangle configuration for types. 96 static inline std::string mangleType( const ast::Node * type ) { 97 return mangle( type, { NoOverrideable | Type } ); 98 } 69 /// The substrings used in name mangling and demangling. 70 namespace Encoding { 71 extern const std::string manglePrefix; 72 extern const std::string basicTypes[]; 73 extern const std::map<int, std::string> qualifiers; 99 74 100 namespace Encoding { 101 using namespace SymTab::Mangler::Encoding; 102 }; 75 extern const std::string void_t; 76 extern const std::string zero; 77 extern const std::string one; 78 79 extern const std::string function; 80 extern const std::string tuple; 81 extern const std::string pointer; 82 extern const std::string array; 83 extern const std::string qualifiedTypeStart; 84 extern const std::string qualifiedTypeEnd; 85 86 extern const std::string forall; 87 extern const std::string typeVariables[]; 88 89 extern const std::string struct_t; 90 extern const std::string union_t; 91 extern const std::string enum_t; 92 extern const std::string type; 93 94 extern const std::string autogen; 95 extern const std::string intrinsic; 96 } 97 103 98 } 104 99
Note: See TracChangeset
for help on using the changeset viewer.