source: src/SymTab/Mangler.h @ b54ad9c

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since b54ad9c was 0e73845, checked in by Rob Schluntz <rschlunt@…>, 6 years ago

Fix name mangling for type variables and forall lists

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[0dd3a2f]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[25bd9074]7// Mangler.h --
[0dd3a2f]8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 21:44:03 2015
[6b0b624]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Jul 22 09:45:30 2017
13// Update Count     : 15
[0dd3a2f]14//
15
[6b0b624]16#pragma once
[51b7345]17
[30f9072]18#include <map>                // for map, map<>::value_compare
19#include <sstream>            // for ostringstream
20#include <string>             // for string
21#include <utility>            // for pair
22
23#include "SynTree/SynTree.h"  // for Types
24#include "SynTree/Visitor.h"  // for Visitor, maybeAccept
[51b7345]25
[642bc83]26// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
27// The CFA name mangling scheme is based closely on the itanium C++ name mangling scheme, with the following key differences:
28// * Variable names are also mangled to include type information, not just functions
29// * CFA does not have template expansion, so the rules for function specialization do not apply.
30// * CFA instead has to handle type parameters and assertion parameters.
31// * Currently name compression is not implemented.
32
[51b7345]33namespace SymTab {
[d7d9a60]34        namespace Mangler {
[69911c11]35                /// Mangle syntax tree object; primary interface to clients
[d7d9a60]36                std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );
37
[69911c11]38                /// Mangle a type name; secondary interface
[d7d9a60]39                std::string mangleType( Type* ty );
[e35f30a]40                /// Mangle ignoring generic type parameters
[d7d9a60]41                std::string mangleConcrete( Type* ty );
[d1e0979]42
[642bc83]43                namespace Encoding {
44                        extern const std::string manglePrefix;
45                        extern const std::string basicTypes[];
46                        extern const std::map<int, std::string> qualifiers;
47
[7804e2a]48                        extern const std::string void_t;
[642bc83]49                        extern const std::string zero;
50                        extern const std::string one;
51
52                        extern const std::string function;
53                        extern const std::string tuple;
54                        extern const std::string pointer;
55                        extern const std::string array;
56                        extern const std::string qualifiedTypeStart;
57                        extern const std::string qualifiedTypeEnd;
58
[0e73845]59                        extern const std::string forall;
60                        extern const std::string typeVariables[];
61
[7804e2a]62                        extern const std::string struct_t;
63                        extern const std::string union_t;
64                        extern const std::string enum_t;
[d8cb7df]65                        extern const std::string type;
[7804e2a]66
[642bc83]67                        extern const std::string autogen;
68                        extern const std::string intrinsic;
69                };
[d7d9a60]70        } // Mangler
[ea3eb06]71} // SymTab
72
[d1e0979]73extern "C" {
[90cac45]74        char * cforall_demangle(const char *, int);
[d1e0979]75}
76
[0dd3a2f]77// Local Variables: //
78// tab-width: 4 //
79// mode: c++ //
80// compile-command: "make install" //
81// End: //
Note: See TracBrowser for help on using the repository browser.