clang-tools 20.0.0git
ProjectModules.h
Go to the documentation of this file.
1//===------------------ ProjectModules.h -------------------------*- C++-*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROJECTMODULES_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROJECTMODULES_H
11
12#include "support/Path.h"
14
15#include <memory>
16
17namespace clang {
18namespace clangd {
19
20/// An interface to query the modules information in the project.
21/// Users should get instances of `ProjectModules` from
22/// `GlobalCompilationDatabase::getProjectModules(PathRef)`.
23///
24/// Currently, the modules information includes:
25/// - Given a source file, what are the required modules.
26/// - Given a module name and a required source file, what is
27/// the corresponding source file.
28///
29/// Note that there can be multiple source files declaring the same module
30/// in a valid project. Although the language specification requires that
31/// every module unit's name must be unique in valid program, there can be
32/// multiple program in a project. And it is technically valid if these program
33/// doesn't interfere with each other.
34///
35/// A module name should be in the format:
36/// `<primary-module-name>[:partition-name]`. So module names covers partitions.
38public:
39 virtual std::vector<std::string> getRequiredModules(PathRef File) = 0;
40 virtual PathRef
41 getSourceForModuleName(llvm::StringRef ModuleName,
42 PathRef RequiredSrcFile = PathRef()) = 0;
43
44 virtual ~ProjectModules() = default;
45};
46
47} // namespace clangd
48} // namespace clang
49
50#endif
An interface to query the modules information in the project.
virtual PathRef getSourceForModuleName(llvm::StringRef ModuleName, PathRef RequiredSrcFile=PathRef())=0
virtual ~ProjectModules()=default
virtual std::vector< std::string > getRequiredModules(PathRef File)=0
llvm::StringRef PathRef
A typedef to represent a ref to file path.
Definition: Path.h:29
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//