clang 24.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#include "llvm/Support/VirtualFileSystemFwd.h"
22
23namespace clang {
25namespace driver {
26class Compilation;
27} // namespace driver
28} // namespace clang
29
31
32/// Emits diagnostics for arguments incompatible with -fmodules-driver.
33void diagnoseModulesDriverArgs(llvm::opt::DerivedArgList &DAL,
34 DiagnosticsEngine &Diags);
35
36/// The parsed Standard library module manifest.
38 struct Module {
40 std::vector<std::string> SystemIncludeDirs;
41 };
42
43 bool IsStdlib = false;
44 std::string LogicalName;
45 std::string SourcePath;
46 std::optional<LocalArguments> LocalArgs;
47 };
48
49 std::vector<Module> Modules;
50};
51
52/// Reads the Standard library module manifest at \p ManifestPath.
53///
54/// Assumes that all file paths specified in the manifest are relative to
55/// \p ManifestPath and converts them to absolute.
56///
57/// \returns The parsed manifest on success; otherwise, a \c llvm::FileError
58/// or \c llvm::json::ParseError.
60readStdModuleManifest(llvm::StringRef ManifestPath, llvm::vfs::FileSystem &VFS);
61
62/// Constructs compilation inputs for each module listed in the provided
63/// Standard library module manifest.
64///
65/// \param ManifestEntries All entries of the Standard library module manifest.
66/// \param C The Compilation being built.
67/// \param Inputs The input list to which the new module inputs are appended.
70 InputList &Inputs);
71
72/// Scans the compilation inputs for module dependencies and adjusts the
73/// compilation to build and supply those modules as required.
74///
75/// \param C The Compilation being built.
76/// \param ManifestEntries All entries of the Standard library module manifest.
79
80} // namespace clang::driver::modules
81
82#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:46
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.
void diagnoseModulesDriverArgs(llvm::opt::DerivedArgList &DAL, DiagnosticsEngine &Diags)
Emits diagnostics for arguments incompatible with -fmodules-driver.
llvm::SmallVector< InputTy, 16 > InputList
A list of inputs and their types for the given arguments.
Definition Types.h:136
Top level wrappers for InstallAPI frontend operations.
std::optional< LocalArguments > LocalArgs
The parsed Standard library module manifest.