source: src/SymTab/Mangler.h @ ff5caaf

aaron-thesisarm-ehcleanup-dtorsdeferred_resnjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexer
Last change on this file since ff5caaf was ff5caaf, checked in by Aaron Moss <a3moss@…>, 3 years ago

Add environment-based-replacement mode to Mangler

  • Property mode set to 100644
File size: 2.8 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
[ff5caaf]33namespace ResolvExpr {
34        class TypeEnvironment;
35}
36
[51b7345]37namespace SymTab {
[d7d9a60]38        namespace Mangler {
[69911c11]39                /// Mangle syntax tree object; primary interface to clients
[d7d9a60]40                std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );
41
[69911c11]42                /// Mangle a type name; secondary interface
[d7d9a60]43                std::string mangleType( Type* ty );
[e35f30a]44                /// Mangle ignoring generic type parameters
[d7d9a60]45                std::string mangleConcrete( Type* ty );
[ff5caaf]46                /// Mangle for assertion key
47                std::string mangleAssnKey( DeclarationWithType* decl, 
48                        const ResolvExpr::TypeEnvironment& env );
[d1e0979]49
[642bc83]50                namespace Encoding {
51                        extern const std::string manglePrefix;
52                        extern const std::string basicTypes[];
53                        extern const std::map<int, std::string> qualifiers;
54
[7804e2a]55                        extern const std::string void_t;
[642bc83]56                        extern const std::string zero;
57                        extern const std::string one;
58
59                        extern const std::string function;
60                        extern const std::string tuple;
61                        extern const std::string pointer;
62                        extern const std::string array;
63                        extern const std::string qualifiedTypeStart;
64                        extern const std::string qualifiedTypeEnd;
65
[0e73845]66                        extern const std::string forall;
67                        extern const std::string typeVariables[];
68
[7804e2a]69                        extern const std::string struct_t;
70                        extern const std::string union_t;
71                        extern const std::string enum_t;
[d8cb7df]72                        extern const std::string type;
[7804e2a]73
[642bc83]74                        extern const std::string autogen;
75                        extern const std::string intrinsic;
76                };
[d7d9a60]77        } // Mangler
[ea3eb06]78} // SymTab
79
[d1e0979]80extern "C" {
[90cac45]81        char * cforall_demangle(const char *, int);
[d1e0979]82}
83
[0dd3a2f]84// Local Variables: //
85// tab-width: 4 //
86// mode: c++ //
87// compile-command: "make install" //
88// End: //
Note: See TracBrowser for help on using the repository browser.