Changes in src/SymTab/Mangler.h [6f096d2:d7d9a60]
- File:
-
- 1 edited
-
src/SymTab/Mangler.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.h
r6f096d2 rd7d9a60 21 21 #include <utility> // for pair 22 22 23 #include "AST/Bitfield.hpp"24 #include "AST/Fwd.hpp"25 23 #include "SynTree/SynTree.h" // for Types 26 24 #include "SynTree/Visitor.h" // for Visitor, maybeAccept 27 28 // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling29 // 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 functions31 // * 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 }38 25 39 26 namespace SymTab { 40 27 namespace Mangler { 41 28 /// Mangle syntax tree object; primary interface to clients 42 std::string mangle( constBaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );29 std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true ); 43 30 44 31 /// Mangle a type name; secondary interface 45 std::string mangleType( const Type* ty );32 std::string mangleType( Type* ty ); 46 33 /// Mangle ignoring generic type parameters 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 }; 34 std::string mangleConcrete( Type* ty ); 76 35 } // Mangler 77 36 } // SymTab 78 79 namespace Mangle {80 /// Bitflags for mangle modes81 enum {82 NoOverrideable = 1 << 0,83 Type = 1 << 1,84 NoGenericParams = 1 << 285 };86 87 /// Bitflag type for mangler modes88 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 name106 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 }116 37 117 38 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.