| 1 | //===- CodegenNameGenerator.h - Codegen name generation -------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Determines the name that the symbol will get for code generation. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H |
| 14 | #define LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H |
| 15 | |
| 16 | #include "clang/Basic/LLVM.h" |
| 17 | #include <memory> |
| 18 | #include <string> |
| 19 | #include <vector> |
| 20 | |
| 21 | namespace clang { |
| 22 | class ASTContext; |
| 23 | class Decl; |
| 24 | |
| 25 | namespace index { |
| 26 | |
| 27 | class CodegenNameGenerator { |
| 28 | public: |
| 29 | explicit CodegenNameGenerator(ASTContext &Ctx); |
| 30 | ~CodegenNameGenerator(); |
| 31 | |
| 32 | /// \returns true on failure to produce a name for the given decl, false on |
| 33 | /// success. |
| 34 | bool writeName(const Decl *D, raw_ostream &OS); |
| 35 | |
| 36 | /// Version of \c writeName function that returns a string. |
| 37 | std::string getName(const Decl *D); |
| 38 | |
| 39 | /// This can return multiple mangled names when applicable, e.g. for C++ |
| 40 | /// constructors/destructors. |
| 41 | std::vector<std::string> getAllManglings(const Decl *D); |
| 42 | |
| 43 | private: |
| 44 | struct Implementation; |
| 45 | std::unique_ptr<Implementation> Impl; |
| 46 | }; |
| 47 | |
| 48 | } // namespace index |
| 49 | } // namespace clang |
| 50 | |
| 51 | #endif // LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H |
| 52 |