diff options
| author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2026-04-21 10:28:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-21 02:28:06 +0000 |
| commit | 4acbf997891c0c8c8cdc1519b352a557ff250d9c (patch) | |
| tree | a5986256356048883594e042cbc0cb9193c1bd25 | |
| parent | b906cf354b34ab8955d19d8a533b55f564cd8196 (diff) | |
| download | llvm-4acbf997891c0c8c8cdc1519b352a557ff250d9c.tar.gz llvm-4acbf997891c0c8c8cdc1519b352a557ff250d9c.tar.bz2 llvm-4acbf997891c0c8c8cdc1519b352a557ff250d9c.zip | |
[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.
| -rw-r--r-- | clang-tools-extra/clangd/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/GlobalCompilationDatabase.cpp | 3 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/ProjectModules.cpp (renamed from clang-tools-extra/clangd/ScanningProjectModules.cpp) | 5 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/ProjectModules.h | 5 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/ScanningProjectModules.h | 26 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp | 5 |
6 files changed, 13 insertions, 33 deletions
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt index a0e8036038d3..890562dde179 100644 --- a/clang-tools-extra/clangd/CMakeLists.txt +++ b/clang-tools-extra/clangd/CMakeLists.txt @@ -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 diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp index a1d9135111ca..adb771ecbbaa 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -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, diff --git a/clang-tools-extra/clangd/ScanningProjectModules.cpp b/clang-tools-extra/clangd/ProjectModules.cpp index d9863085d382..67b2a3bd9096 100644 --- a/clang-tools-extra/clangd/ScanningProjectModules.cpp +++ b/clang-tools-extra/clangd/ProjectModules.cpp @@ -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); diff --git a/clang-tools-extra/clangd/ProjectModules.h b/clang-tools-extra/clangd/ProjectModules.h index 41812674f12f..057e1b83764b 100644 --- a/clang-tools-extra/clangd/ProjectModules.h +++ b/clang-tools-extra/clangd/ProjectModules.h @@ -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 diff --git a/clang-tools-extra/clangd/ScanningProjectModules.h b/clang-tools-extra/clangd/ScanningProjectModules.h deleted file mode 100644 index 75fc7dbcebce..000000000000 --- a/clang-tools-extra/clangd/ScanningProjectModules.h +++ /dev/null @@ -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 diff --git a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp index 1a5d805d730f..6a4250cb5389 100644 --- a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp +++ b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp @@ -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; } |
