1 //===------------------------- NameMangleAPI.h ---------------------------===//
2 //
3 //                              SPIR Tools
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===---------------------------------------------------------------------===//
9 /*
10  * Contributed by: Intel Corporation.
11  */
12 #ifndef __NAME_MANGLE_API_H__
13 #define __NAME_MANGLE_API_H__
14 
15 #include "FunctionDescriptor.h"
16 #include <string>
17 
18 namespace SPIR {
19   struct NameMangler {
20 
21     /// @brief Constructor.
22     /// @param SPIRversion spir version to mangle according to.
23     NameMangler(SPIRversion);
24 
25     /// @brief Converts the given function descriptor to string that represents
26     ///        the function's prototype.
27     ///        The mangling algorithm is based on Itanium mangling algorithm
28     ///        (http://sourcery.mentor.com/public/cxx-abi/abi.html#mangling), with
29     ///        SPIR extensions.
30     /// @param FunctionDescriptor function to be mangled.
31     /// @param std::string the mangled name if the mangling succeeds,
32     ///        the error otherwise.
33     /// @return MangleError enum representing the status - success or the error.
34     MangleError mangle(const FunctionDescriptor&, std::string &);
35   private:
36     SPIRversion m_spir_version;
37   };
38 } // End SPIR namespace
39 
40 #endif //__NAME_MANGLE_API_H__
41