diff --git a/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp --- a/clang-tools-extra/clangd/ClangdUnit.cpp +++ b/clang-tools-extra/clangd/ClangdUnit.cpp @@ -304,6 +304,7 @@ StoreDiags ASTDiags; std::string Content = Buffer->getBuffer(); + std::string Filename = Buffer->getBufferIdentifier(); // Absolute. auto Clang = prepareCompilerInstance(std::move(CI), PreamblePCH, std::move(Buffer), VFS, ASTDiags); @@ -329,7 +330,7 @@ llvm::Optional CTContext; { trace::Span Tracer("ClangTidyInit"); - dlog("ClangTidy configuration for file {0}: {1}", MainInput.getFile(), + dlog("ClangTidy configuration for file {0}: {1}", Filename, tidy::configurationAsText(Opts.ClangTidyOpts)); tidy::ClangTidyCheckFactories CTFactories; for (const auto &E : tidy::ClangTidyModuleRegistry::entries()) @@ -338,7 +339,7 @@ tidy::ClangTidyGlobalOptions(), Opts.ClangTidyOpts)); CTContext->setDiagnosticsEngine(&Clang->getDiagnostics()); CTContext->setASTContext(&Clang->getASTContext()); - CTContext->setCurrentFile(MainInput.getFile()); + CTContext->setCurrentFile(Filename); CTFactories.createChecks(CTContext.getPointer(), CTChecks); ASTDiags.setLevelAdjuster([&CTContext](DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) { @@ -385,15 +386,15 @@ llvm::Optional FixIncludes; auto BuildDir = VFS->getCurrentWorkingDirectory(); if (Opts.SuggestMissingIncludes && Index && !BuildDir.getError()) { - auto Style = getFormatStyleForFile(MainInput.getFile(), Content, VFS.get()); + auto Style = getFormatStyleForFile(Filename, Content, VFS.get()); auto Inserter = std::make_shared( - MainInput.getFile(), Content, Style, BuildDir.get(), + Filename, Content, Style, BuildDir.get(), &Clang->getPreprocessor().getHeaderSearchInfo()); if (Preamble) { for (const auto &Inc : Preamble->Includes.MainFileIncludes) Inserter->addExisting(Inc); } - FixIncludes.emplace(MainInput.getFile(), Inserter, *Index, + FixIncludes.emplace(Filename, Inserter, *Index, /*IndexRequestLimit=*/5); ASTDiags.contributeFixes([&FixIncludes](DiagnosticsEngine::Level DiagLevl, const clang::Diagnostic &Info) { diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h --- a/llvm/include/llvm/Support/Threading.h +++ b/llvm/include/llvm/Support/Threading.h @@ -130,7 +130,7 @@ /// Get the amount of currency to use for tasks requiring significant /// memory or other resources. Currently based on physical cores, if /// available for the host system, otherwise falls back to - /// thread::hardware_concurrency(). + /// llvm::hardware_concurrency(). /// Returns 1 when LLVM is configured with LLVM_ENABLE_THREADS=OFF unsigned heavyweight_hardware_concurrency(); diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -68,7 +68,7 @@ // ADL. int NumPhysical = sys::getHostNumPhysicalCores(); if (NumPhysical == -1) - return std::thread::hardware_concurrency(); + return llvm::hardware_concurrency(); return NumPhysical; }