comparison clang-tools-extra/clangd/Headers.h @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children c4bab56944e8
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
112 // in any non-preamble inclusions. 112 // in any non-preamble inclusions.
113 class IncludeStructure { 113 class IncludeStructure {
114 public: 114 public:
115 std::vector<Inclusion> MainFileIncludes; 115 std::vector<Inclusion> MainFileIncludes;
116 116
117 // Return all transitively reachable files.
118 llvm::ArrayRef<std::string> allHeaders() const { return RealPathNames; }
119
117 // Return all transitively reachable files, and their minimum include depth. 120 // Return all transitively reachable files, and their minimum include depth.
118 // All transitive includes (absolute paths), with their minimum include depth. 121 // All transitive includes (absolute paths), with their minimum include depth.
119 // Root --> 0, #included file --> 1, etc. 122 // Root --> 0, #included file --> 1, etc.
120 // Root is clang's name for a file, which may not be absolute. 123 // Root is clang's name for a file, which may not be absolute.
121 // Usually it should be SM.getFileEntryForID(SM.getMainFileID())->getName(). 124 // Usually it should be SM.getFileEntryForID(SM.getMainFileID())->getName().
134 // The paths we want to expose are the RealPathName, so store those too. 137 // The paths we want to expose are the RealPathName, so store those too.
135 std::vector<std::string> RealPathNames; // In file index order. 138 std::vector<std::string> RealPathNames; // In file index order.
136 unsigned fileIndex(llvm::StringRef Name); 139 unsigned fileIndex(llvm::StringRef Name);
137 llvm::StringMap<unsigned> NameToIndex; // Values are file indexes. 140 llvm::StringMap<unsigned> NameToIndex; // Values are file indexes.
138 // Maps a file's index to that of the files it includes. 141 // Maps a file's index to that of the files it includes.
139 llvm::DenseMap<unsigned, SmallVector<unsigned, 8>> IncludeChildren; 142 llvm::DenseMap<unsigned, llvm::SmallVector<unsigned>> IncludeChildren;
140 }; 143 };
141 144
142 /// Returns a PPCallback that visits all inclusions in the main file. 145 /// Returns a PPCallback that visits all inclusions in the main file.
143 std::unique_ptr<PPCallbacks> 146 std::unique_ptr<PPCallbacks>
144 collectIncludeStructureCallback(const SourceManager &SM, IncludeStructure *Out); 147 collectIncludeStructureCallback(const SourceManager &SM, IncludeStructure *Out);