| 63 | } |
| 64 | |
| 65 | class Annotator { |
| 66 | public: |
| 67 | enum DeclType { Declaration, Definition, Use, Use_Read, Use_Write, Use_Address, Use_Call, Use_MemberAccess, Override, Inherit }; |
| 68 | enum TokenType { Ref, Member, Type, Decl, Call, Namespace, Typedef, Enum, EnumDecl, Label }; |
| 69 | private: |
| 70 | enum class Visibility { |
| 71 | Local, // Local to a Function |
| 72 | Static, // If it is only visible to this file |
| 73 | Global // Globaly visible. |
| 74 | }; |
| 75 | |
| 76 | Visibility getVisibility(const clang::NamedDecl *); |
| 77 | |
| 78 | std::map<clang::FileID, std::pair<bool, std::string> > cache; |
| 79 | std::map<clang::FileID, ProjectInfo* > project_cache; |
| 80 | std::map<clang::FileID, Generator> generators; |
| 81 | |
| 82 | std::string htmlNameForFile(clang::FileID id); // keep a cache; |
| 83 | |
| 84 | void addReference(const std::string& ref, clang::SourceRange refLoc, Annotator::TokenType type, |
| 85 | Annotator::DeclType dt, const std::string &typeRef, clang::Decl *decl); |
| 86 | |
| 87 | struct Reference { |
| 88 | DeclType what; |
| 89 | clang::SourceRange loc; |
| 90 | std::string typeOrContext; |
| 91 | }; |
| 92 | std::map<std::string, std::vector<Reference>> references; |
| 93 | std::map<std::string, ssize_t> structure_sizes; |
| 94 | std::map<std::string, ssize_t> field_offsets; |
| 95 | struct SubRef { |
| 96 | std::string ref; |
| 97 | std::string type; |
| 98 | enum Type { None, Function, Member, Static } what = None; |
| 99 | }; |
| 100 | std::map<std::string, std::vector<SubRef>> sub_refs; |
| 101 | std::unordered_map<pathTo_cache_key_t, std::string> pathTo_cache; |
| 102 | CommentHandler commentHandler; |
| 103 | |
| 104 | std::unique_ptr<clang::MangleContext> mangle; |
| 105 | std::unordered_map<void *, std::pair<std::string, std::string> > mangle_cache; // canonical Decl* -> ref, escapred_title |
| 106 | std::pair<std::string, std::string> getReferenceAndTitle(clang::NamedDecl* decl); |
| 107 | // project -> { pretty name, ref } |
| 108 | std::map<std::string, std::string> functionIndex; |
| 109 | |
| 110 | std::unordered_map<unsigned, int> localeNumbers; |
| 111 | |
| 112 | std::map<clang::FileID, std::set<std::string> > interestingDefinitionsInFile; |
| 113 | |
| 114 | std::string args; |
| 115 | clang::SourceManager *sourceManager = nullptr; |
| 116 | const clang::LangOptions *langOption = nullptr; |
| 117 | |
| 118 | void syntaxHighlight(Generator& generator, clang::FileID FID, clang::Sema&); |
| 119 | public: |
| 120 | explicit Annotator(ProjectManager &pm) : projectManager(pm) {} |
| 121 | ~Annotator(); |
| 122 |
nothing calls this directly
no outgoing calls
no test coverage detected