clang 23.0.0git
ModulesDriver.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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/// \file
10/// This file defines functionality to support driver managed builds for
11/// compilations which use Clang modules or standard C++20 named modules.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_DRIVER_MODULESDRIVER_H
16#define LLVM_CLANG_DRIVER_MODULESDRIVER_H
17
18#include "clang/Basic/LLVM.h"
19#include "clang/Driver/Types.h"
20#include "llvm/Support/Error.h"
21
22namespace llvm::vfs {
23class FileSystem;
24} // namespace llvm::vfs
25
26namespace clang {
28namespace driver {
29class Compilation;
30} // namespace driver
31} // namespace clang
32
34
35/// The parsed Standard library module manifest.
37 struct Module {
39 std::vector<std::string> SystemIncludeDirs;
40 };
41
42 bool IsStdlib = false;
43 std::string LogicalName;
44 std::string SourcePath;
45 std::optional<LocalArguments> LocalArgs;
46 };
47
48 std::vector<Module> Modules;
49};
50
51/// Reads the Standard library module manifest at \p ManifestPath.
52///
53/// Assumes that all file paths specified in the manifest are relative to
54/// \p ManifestPath and converts them to absolute.
55///
56/// \returns The parsed manifest on success; otherwise, a \c llvm::FileError
57/// or \c llvm::json::ParseError.
59readStdModuleManifest(llvm::StringRef ManifestPath, llvm::vfs::FileSystem &VFS);
60
61/// Constructs compilation inputs for each module listed in the provided
62/// Standard library module manifest.
63///
64/// \param ManifestEntries All entries of the Standard library module manifest.
65/// \param C The Compilation being built.
66/// \param Inputs The input list to which the new module inputs are appended.
69 InputList &Inputs);
70
71/// Scans the compilation inputs for module dependencies and adjusts the
72/// compilation to build and supply those modules as required.
73///
74/// \param C The Compilation being built.
75/// \param ManifestEntries All entries of the Standard library module manifest.
78
79} // namespace clang::driver::modules
80
81#endif // LLVM_CLANG_DRIVER_MODULESDRIVER_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:232
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:45
void buildStdModuleManifestInputs(ArrayRef< StdModuleManifest::Module > ManifestEntries, Compilation &C, InputList &Inputs)
Constructs compilation inputs for each module listed in the provided Standard library module manifest...
void runModulesDriver(Compilation &C, ArrayRef< StdModuleManifest::Module > ManifestEntries)
Scans the compilation inputs for module dependencies and adjusts the compilation to build and supply ...
llvm::Expected< StdModuleManifest > readStdModuleManifest(llvm::StringRef ManifestPath, llvm::vfs::FileSystem &VFS)
Reads the Standard library module manifest at ManifestPath.
llvm::SmallVector< InputTy, 16 > InputList
A list of inputs and their types for the given arguments.
Definition Types.h:136
The JSON file list parser is used to communicate input to InstallAPI.
std::optional< LocalArguments > LocalArgs
The parsed Standard library module manifest.