doxygen
clangparser.h
1 #ifndef CLANGPARSER_H
2 #define CLANGPARSER_H
3 
4 #include "containers.h"
5 #include "types.h"
6 #include <memory>
7 #include <string>
8 
10 class FileDef;
11 class ClangParser;
12 class Definition;
13 
14 namespace clang { namespace tooling {
15  class CompilationDatabase;
16 } }
17 
22 {
23  public:
24  ClangTUParser(const ClangParser &parser,const FileDef *fd);
25  virtual ~ClangTUParser();
26 
30  void parse();
31 
35  void switchToFile(const FileDef *fd);
36 
38  StringVector filesInSameTU() const;
39 
43  std::string lookup(uint line,const char *symbol);
44 
49  void writeSources(CodeOutputInterface &ol,const FileDef *fd);
50 
51  private:
52  void detectFunctionBody(const char *s);
53  void writeLineNumber(CodeOutputInterface &ol,const FileDef *fd,uint line,bool writeLineAnchor);
54  void codifyLines(CodeOutputInterface &ol,const FileDef *fd,const char *text,
55  uint &line,uint &column,const char *fontClass=0);
56  void writeMultiLineCodeLink(CodeOutputInterface &ol,
57  const FileDef *fd,uint &line,uint &column,
58  const Definition *d, const char *text);
59  void linkIdentifier(CodeOutputInterface &ol,const FileDef *fd,
60  uint &line,uint &column,
61  const char *text,int tokenIndex);
62  void linkMacro(CodeOutputInterface &ol,const FileDef *fd,
63  uint &line,uint &column,
64  const char *text);
65  void linkInclude(CodeOutputInterface &ol,const FileDef *fd,
66  uint &line,uint &column,
67  const char *text);
68  ClangTUParser(const ClangTUParser &) = delete;
69  ClangTUParser &operator=(const ClangTUParser &) = delete;
70  class Private;
71  std::unique_ptr<Private> p;
72 };
73 
76 {
77  friend class ClangTUParser;
78  public:
80  static ClangParser *instance();
81  std::unique_ptr<ClangTUParser> createTUParser(const FileDef *fd) const;
82 
83  private:
84  const clang::tooling::CompilationDatabase *database() const;
85  class Private;
86  std::unique_ptr<Private> p;
87  ClangParser();
88  virtual ~ClangParser();
89  static ClangParser *s_instance;
90 };
91 
92 #endif
This file contains a number of basic enums and types.
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
Definition: clangparser.cpp:911
A model of a file symbol.
Definition: filedef.h:72
Definition: clangparser.h:14
Wrapper for to let libclang assisted parsing.
Definition: clangparser.h:75
Definition: clangparser.cpp:936
Output interface for code parser.
Definition: outputgen.h:59
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition: clangparser.h:21