Changeset b067d9b for src/SymTab/Mangler.h
- Timestamp:
- Oct 29, 2019, 4:01:24 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 773db65, 9421f3d8
- Parents:
- 7951100 (diff), 8364209 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.h
r7951100 rb067d9b 21 21 #include <utility> // for pair 22 22 23 #include "AST/Bitfield.hpp" 24 #include "AST/Fwd.hpp" 23 25 #include "SynTree/SynTree.h" // for Types 24 26 #include "SynTree/Visitor.h" // for Visitor, maybeAccept 27 28 // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling 29 // The CFA name mangling scheme is based closely on the itanium C++ name mangling scheme, with the following key differences: 30 // * Variable names are also mangled to include type information, not just functions 31 // * CFA does not have template expansion, so the rules for function specialization do not apply. 32 // * CFA instead has to handle type parameters and assertion parameters. 33 // * Currently name compression is not implemented. 34 35 namespace ResolvExpr { 36 class TypeEnvironment; 37 } 25 38 26 39 namespace SymTab { 27 40 namespace Mangler { 28 41 /// Mangle syntax tree object; primary interface to clients 29 std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );42 std::string mangle( const BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true ); 30 43 31 44 /// Mangle a type name; secondary interface 32 std::string mangleType( Type* ty );45 std::string mangleType( const Type * ty ); 33 46 /// Mangle ignoring generic type parameters 34 std::string mangleConcrete( Type* ty ); 47 std::string mangleConcrete( const Type * ty ); 48 49 namespace Encoding { 50 extern const std::string manglePrefix; 51 extern const std::string basicTypes[]; 52 extern const std::map<int, std::string> qualifiers; 53 54 extern const std::string void_t; 55 extern const std::string zero; 56 extern const std::string one; 57 58 extern const std::string function; 59 extern const std::string tuple; 60 extern const std::string pointer; 61 extern const std::string array; 62 extern const std::string qualifiedTypeStart; 63 extern const std::string qualifiedTypeEnd; 64 65 extern const std::string forall; 66 extern const std::string typeVariables[]; 67 68 extern const std::string struct_t; 69 extern const std::string union_t; 70 extern const std::string enum_t; 71 extern const std::string type; 72 73 extern const std::string autogen; 74 extern const std::string intrinsic; 75 }; 35 76 } // Mangler 36 77 } // SymTab 78 79 namespace Mangle { 80 /// Bitflags for mangle modes 81 enum { 82 NoOverrideable = 1 << 0, 83 Type = 1 << 1, 84 NoGenericParams = 1 << 2 85 }; 86 87 /// Bitflag type for mangler modes 88 struct mangle_flags { 89 union { 90 unsigned int val; 91 struct { 92 bool no_overrideable : 1; 93 bool type : 1; 94 bool no_generic_params : 1; 95 }; 96 }; 97 98 constexpr mangle_flags( unsigned int val ) : val(val) {} 99 }; 100 101 using Mode = bitfield<mangle_flags>; 102 103 static inline Mode typeMode() { return NoOverrideable | Type; } 104 105 /// Mangle declaration name 106 std::string mangle( const ast::Node * decl, Mode mode = {} ); 107 108 namespace Encoding { 109 using namespace SymTab::Mangler::Encoding; 110 }; 111 } 112 113 extern "C" { 114 char * cforall_demangle(const char *, int); 115 } 37 116 38 117 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.