• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- CodegenNameGenerator.h - Codegen name generation -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Determines the name that the symbol will get for code generation.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H
15 #define LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H
16 
17 #include "clang/Basic/LLVM.h"
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 namespace clang {
23   class ASTContext;
24   class Decl;
25 
26 namespace index {
27 
28 class CodegenNameGenerator {
29 public:
30   explicit CodegenNameGenerator(ASTContext &Ctx);
31   ~CodegenNameGenerator();
32 
33   /// \returns true on failure to produce a name for the given decl, false on
34   /// success.
35   bool writeName(const Decl *D, raw_ostream &OS);
36 
37   /// Version of \c writeName function that returns a string.
38   std::string getName(const Decl *D);
39 
40   /// This can return multiple mangled names when applicable, e.g. for C++
41   /// constructors/destructors.
42   std::vector<std::string> getAllManglings(const Decl *D);
43 
44 private:
45   struct Implementation;
46   std::unique_ptr<Implementation> Impl;
47 };
48 
49 } // namespace index
50 } // namespace clang
51 
52 #endif // LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H
53