diff --git a/src/indexer.cc b/src/indexer.cc index 6d32077e..bd4da48d 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -364,9 +364,11 @@ try_again: // FIXME: Template type parameters! +#if LLVM_VERSION_MAJOR < 22 // llvmorg-22-init-3166-g91cdd35008e9 case Type::Elaborated: tp = cast(tp)->getNamedType().getTypePtrOrNull(); goto try_again; +#endif default: break; @@ -1266,7 +1268,7 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c clang->setInvocation(std::move(ci)); #endif clang->createDiagnostics( -#if LLVM_VERSION_MAJOR >= 20 +#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22 *fs, #endif &dc, false); @@ -1279,7 +1281,12 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c if (!clang->hasTarget()) return {}; clang->getPreprocessorOpts().RetainRemappedFileBuffers = true; +#if LLVM_VERSION_MAJOR >= 22 + clang->setVirtualFileSystem(fs); + clang->createFileManager(); +#else clang->createFileManager(fs); +#endif clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true)); IndexParam param(*vfs, no_linkage); diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 03e1b004..4db64710 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -345,7 +345,11 @@ void do_initialize(MessageHandler *m, InitializeParam ¶m, ReplyOnce &reply) if (g_config->cache.directory.size()) { SmallString<256> path(g_config->cache.directory); +#if LLVM_VERSION_MAJOR >= 22 + sys::path::make_absolute(project_path, path); +#else sys::fs::make_absolute(project_path, path); +#endif // Use upper case for the Driver letter on Windows. g_config->cache.directory = normalizePath(path.str()); ensureEndsInSlash(g_config->cache.directory); diff --git a/src/sema_manager.cc b/src/sema_manager.cc index 9ae1c132..222d110f 100644 --- a/src/sema_manager.cc +++ b/src/sema_manager.cc @@ -268,7 +268,7 @@ std::unique_ptr buildCompilerInstance(Session &session, std::u clang->setInvocation(std::move(ci)); #endif clang->createDiagnostics( -#if LLVM_VERSION_MAJOR >= 20 +#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22 *fs, #endif &dc, false); @@ -283,7 +283,12 @@ std::unique_ptr buildCompilerInstance(Session &session, std::u // Construct SourceManager with UserFilesAreVolatile: true because otherwise // RequiresNullTerminator: true may cause out-of-bounds read when a file is // mmap'ed but is saved concurrently. +#if LLVM_VERSION_MAJOR >= 22 + clang->setVirtualFileSystem(fs); + clang->createFileManager(); +#else clang->createFileManager(fs); +#endif clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true)); auto &isec = clang->getFrontendOpts().Inputs; if (isec.size()) {