[NFC] [clangd] [C++20] [Modules] Rename and move scanningProjectModules (#193128)

I am going to add more stuff to ProjectModules and the current structure
and the file name scanningProjectModules may be confusing.

This NFC patch changes that.
This commit is contained in:
Chuanqi Xu 2026-04-21 10:28:06 +08:00 committed by GitHub
parent b906cf354b
commit 4acbf99789
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 33 deletions

View file

@ -98,12 +98,12 @@ add_clang_library(clangDaemon STATIC
JSONTransport.cpp
ModulesBuilder.cpp
PathMapping.cpp
ProjectModules.cpp
Protocol.cpp
Quality.cpp
ParsedAST.cpp
Preamble.cpp
RIFF.cpp
ScanningProjectModules.cpp
Selection.cpp
SemanticHighlighting.cpp
SemanticSelection.cpp

View file

@ -10,7 +10,6 @@
#include "Config.h"
#include "FS.h"
#include "ProjectModules.h"
#include "ScanningProjectModules.h"
#include "SourceCode.h"
#include "support/Logger.h"
#include "support/Path.h"
@ -772,7 +771,7 @@ DirectoryBasedGlobalCompilationDatabase::getProjectModules(PathRef File) const {
if (!Res)
return {};
return scanningProjectModules(Res->CDB, Opts.TFS);
return clang::clangd::getProjectModules(Res->CDB, Opts.TFS);
}
OverlayCDB::OverlayCDB(const GlobalCompilationDatabase *Base,

View file

@ -1,4 +1,5 @@
//===------------------ ProjectModules.h -------------------------*- C++-*-===//
//===------------------ ProjectModules.cpp -------------------------*-
//C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -231,7 +232,7 @@ private:
CommandMangler Mangler;
};
std::unique_ptr<ProjectModules> scanningProjectModules(
std::unique_ptr<ProjectModules> getProjectModules(
std::shared_ptr<const clang::tooling::CompilationDatabase> CDB,
const ThreadsafeFS &TFS) {
return std::make_unique<ScanningAllProjectModules>(CDB, TFS);

View file

@ -51,6 +51,11 @@ public:
virtual ~ProjectModules() = default;
};
/// Providing modules information for the project by scanning every file.
std::unique_ptr<ProjectModules> getProjectModules(
std::shared_ptr<const clang::tooling::CompilationDatabase> CDB,
const ThreadsafeFS &TFS);
} // namespace clangd
} // namespace clang

View file

@ -1,26 +0,0 @@
//===------------ ScanningProjectModules.h -----------------------*- C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SCANNINGPROJECTMODULES_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SCANNINGPROJECTMODULES_H
#include "ProjectModules.h"
#include "clang/Tooling/CompilationDatabase.h"
namespace clang {
namespace clangd {
/// Providing modules information for the project by scanning every file.
std::unique_ptr<ProjectModules> scanningProjectModules(
std::shared_ptr<const clang::tooling::CompilationDatabase> CDB,
const ThreadsafeFS &TFS);
} // namespace clangd
} // namespace clang
#endif

View file

@ -15,7 +15,7 @@
#include "CodeComplete.h"
#include "Compiler.h"
#include "ModulesBuilder.h"
#include "ScanningProjectModules.h"
#include "ProjectModules.h"
#include "TestTU.h"
#include "support/Path.h"
#include "support/ThreadsafeFS.h"
@ -73,7 +73,8 @@ public:
std::unique_ptr<ProjectModules> getProjectModules(PathRef) const override {
return std::make_unique<GlobalScanningCounterProjectModules>(
scanningProjectModules(MockedCDBPtr, TFS), GlobalScanningCount);
clang::clangd::getProjectModules(MockedCDBPtr, TFS),
GlobalScanningCount);
}
unsigned getGlobalScanningCount() const { return GlobalScanningCount; }