MCPcopy Create free account
hub / github.com/KDAB/codebrowser / htmlNameForFile

Method htmlNameForFile

generator/annotator.cpp:188–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186
187
188std::string Annotator::htmlNameForFile(clang::FileID id)
189{
190 {
191 auto it = cache.find(id);
192 if (it != cache.end()) {
193 return it->second.second;
194 }
195 }
196
197 const clang::FileEntry* entry = getSourceMgr().getFileEntryForID(id);
198 if (!entry || llvm::StringRef(entry->getName()).empty()) {
199 cache[id] = {false, {} };
200 return {};
201 }
202 llvm::SmallString<256> filename;
203 canonicalize(entry->getName(), filename);
204
205 ProjectInfo *project = projectManager.projectForFile(filename);
206 if (project) {
207 bool should_process = projectManager.shouldProcess(filename, project);
208 project_cache[id] = project;
209 std::string fn = project->name % "/" % filename.substr(project->source_path.size());
210 cache[id] = { should_process , fn};
211 return fn;
212 }
213
214 cache[id] = {false, {} };
215 return {};
216}
217
218static char normalizeForfnIndex(char c) {
219 if (c >= 'A' && c <= 'Z')

Callers

nothing calls this directly

Calls 4

canonicalizeFunction · 0.85
projectForFileMethod · 0.80
shouldProcessMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected