diff --git a/src/indexer.cc b/src/indexer.cc index 644c0ccb..d5fe7da2 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1096,10 +1096,18 @@ public: } void InclusionDirective(SourceLocation hashLoc, const Token &tok, StringRef included, bool isAngled, - CharSourceRange filenameRange, const FileEntry *file, + CharSourceRange filenameRange, +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + llvm::Optional fileRef, +#else + const FileEntry *file, +#endif StringRef searchPath, StringRef relativePath, const Module *imported, SrcMgr::CharacteristicKind fileType) override { +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + const FileEntry *file = fileRef ? &fileRef->getFileEntry() : nullptr; +#endif if (!file) return; auto spell = fromCharSourceRange(sm, param.ctx->getLangOpts(), diff --git a/src/sema_manager.cc b/src/sema_manager.cc index dbe57672..a7b6f8ca 100644 --- a/src/sema_manager.cc +++ b/src/sema_manager.cc @@ -178,11 +178,19 @@ public: : sm(sm), out(out) {} void InclusionDirective(SourceLocation hashLoc, const Token &includeTok, StringRef fileName, bool isAngled, - CharSourceRange filenameRange, const FileEntry *file, + CharSourceRange filenameRange, +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + llvm::Optional fileRef, +#else + const FileEntry *file, +#endif StringRef searchPath, StringRef relativePath, const clang::Module *imported, SrcMgr::CharacteristicKind fileKind) override { (void)sm; +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + const FileEntry *file = fileRef ? &fileRef->getFileEntry() : nullptr; +#endif if (file && seen.insert(file).second) out.emplace_back(pathFromFileEntry(*file), file->getModificationTime()); }