diff --git a/src/collectors/definitions.cpp b/src/collectors/definitions.cpp index 5dfb45a..a651e5f 100644 --- a/src/collectors/definitions.cpp +++ b/src/collectors/definitions.cpp @@ -25,15 +25,19 @@ class DefinitionsDataAppender : public MatchFinder::MatchCallback { clang::SourceManager *sm = r.SourceManager; const clang::FileID fid = sm->getFileID(e->getLocation()); - const clang::FileEntry *entry = sm->getFileEntryForID(fid); #if LLVM_VERSION_MAJOR >= 15 - if (!entry) { + const llvm::Optional entry = sm->getFileEntryRefForID(fid); + if (!entry.has_value()) { + return; + } + const types::FileUID fuid = entry.value().getUID(); #else + const clang::FileEntry *entry = sm->getFileEntryForID(fid); if (!(entry && entry->isValid())) { -#endif return; } const types::FileUID fuid = entry->getUID(); +#endif data->defs.insert( std::pair(fuid, e));