9#ifndef LLVM_CLANG_DEPENDENCYSCANNING_MODULEDEPCOLLECTOR_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_MODULEDEPCOLLECTOR_H
22#include "llvm/ADT/DenseMap.h"
23#include "llvm/ADT/Hashing.h"
24#include "llvm/ADT/StringSet.h"
25#include "llvm/Support/raw_ostream.h"
28#include <unordered_map>
53 const llvm::StringSet<> &
getVFS()
const {
return VFSMap; }
74 llvm::StringSet<> VFSMap;
75 bool IsInStableDirs =
true;
76 std::set<StringRef> ModuleFileDependents;
84 std::unique_ptr<DependencyOutputOptions> Opts,
105 class ModuleDepCollectorPP;
120 std::string MainFile;
123 std::vector<std::string> FileDeps;
125 llvm::MapVector<serialization::ModuleFile *, std::unique_ptr<ModuleDeps>>
129 llvm::DenseMap<ModuleID, ModuleDeps *> ModuleDepsByID;
131 llvm::MapVector<serialization::ModuleFile *, PrebuiltModuleDep>
132 DirectPrebuiltModularDeps;
134 llvm::SetVector<serialization::ModuleFile *> DirectModularDeps;
138 llvm::StringSet<> VisibleModules;
141 std::unique_ptr<DependencyOutputOptions> Opts;
148 std::optional<P1689ModuleInfo> ProvidedStdCXXModule;
149 std::vector<P1689ModuleInfo> RequiredStdCXXModules;
156 void handleImport(
const Module *Imported);
169 void addVisibleModules();
172 void addFileDep(StringRef Path);
174 void addFileDep(
ModuleDeps &MD, StringRef Path);
183 llvm::DenseSet<const FileEntry *>
214 const StringRef Input);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::Module class, which describes a module in the source code.
Defines the PPCallbacks interface.
Defines the SourceManager interface.
Reads an AST files chain containing the contents of a translation unit.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Helper class for holding the data necessary to invoke the compiler.
Same as CompilerInvocation, but with copy-on-write optimization.
An interface for collecting the dependencies of a compilation.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Describes a module or submodule.
This interface provides a way to observe the actions of the preprocessor as it does its thing.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
The dependency scanning service contains shared configuration and state that is used by the individua...
void run(DependencyConsumer &Consumer)
Processes the accumulated dependency information and reports it to the Consumer.
ModuleDepCollector(DependencyScanningService &Service, std::unique_ptr< DependencyOutputOptions > Opts, CompilerInstance &ScanInstance, DependencyActionController &Controller, CompilerInvocation OriginalCI, const PrebuiltModulesAttrsMap PrebuiltModulesASTMap, const ArrayRef< StringRef > StableDirs)
void applyDiscoveredDependencies(CompilerInvocation &CI)
Apply any changes implied by the discovered dependencies to the given invocation, (e....
PPCallbacks * getPPCallbacks()
void attachToPreprocessor(Preprocessor &PP) override
void attachToASTReader(ASTReader &R) override
void updateDependentsNotInStableDirs(PrebuiltModulesAttrsMap &PrebuiltModulesMap)
When a module is discovered to not be in stable directories, traverse & update all modules that depen...
void setVFS(llvm::StringSet<> &&VFS)
Update the VFSMap to the one discovered from serializing the AST file.
bool isInStableDir() const
Read-only access to whether the module is made up of dependencies in stable directories.
void addDependent(StringRef ModuleFile)
Add a direct dependent module file, so it can be updated if the current module is from stable directo...
void setInStableDir(bool V=false)
Update whether the prebuilt module resolves entirely in a stable directories.
const llvm::StringSet & getVFS() const
Read-only access to vfs map files.
Information about a module that has been loaded by the ASTReader.
bool areOptionsInStableDir(const ArrayRef< StringRef > Directories, const HeaderSearchOptions &HSOpts)
Determine if options collected from a module's compilation can safely be considered as stable.
@ VFS
Remove unused -ivfsoverlay arguments.
@ ModuleFile
The module file (.pcm). Required.
llvm::StringMap< PrebuiltModuleASTAttrs > PrebuiltModulesAttrsMap
Attributes loaded from AST files of prebuilt modules collected prior to ModuleDepCollector creation.
bool isPathInStableDir(const ArrayRef< StringRef > Directories, const StringRef Input)
Determine if Input can be resolved within a stable directory.
void resetBenignCodeGenOptions(frontend::ActionKind ProgramAction, const LangOptions &LangOpts, CodeGenOptions &CGOpts)
Resets codegen options that don't affect modules/PCH.
The JSON file list parser is used to communicate input to InstallAPI.