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

Method FileNotFound

generator/preprocessorcallback.cpp:248–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248bool PreprocessorCallback::FileNotFound(llvm::StringRef FileName, llvm::SmallVectorImpl<char> &RecoveryPath)
249{
250 if (!recoverIncludePath)
251 return false;
252 clang::SourceLocation currentLoc = static_cast<clang::Lexer *>(PP.getCurrentLexer())->getSourceLocation();
253 auto &SM = annotator.getSourceMgr();
254 const clang::FileEntry* entry = SM.getFileEntryForID(SM.getFileID(currentLoc));
255 if (!entry || llvm::StringRef(entry->getName()).empty())
256 return false;
257 std::string recovery = annotator.projectManager.includeRecovery(FileName, entry->getName());
258 if (recovery.empty() || !llvm::StringRef(recovery).endswith(FileName))
259 return false;
260 RecoveryPath.clear();
261 RecoveryPath.append(recovery.begin(), recovery.begin() + recovery.size() - FileName.size());
262 currentLoc.dump(SM);
263 llvm::errs() << " WARNING: File not found '" << FileName << "'. Recovering using "
264 << llvm::StringRef(RecoveryPath.data(), RecoveryPath.size()) << "\n";
265
266 return true;
267}
268
269
270void PreprocessorCallback::InclusionDirective(clang::SourceLocation HashLoc, const clang::Token& IncludeTok,

Callers

nothing calls this directly

Calls 2

includeRecoveryMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected