15#include "llvm/ADT/ScopeExit.h"
16#include "llvm/TargetParser/Host.h"
25 DependencyConsumerForwarder(std::unique_ptr<DependencyOutputOptions> Opts,
26 StringRef WorkingDirectory, DependencyConsumer &C)
27 : DependencyFileGenerator(*Opts), WorkingDirectory(WorkingDirectory),
28 Opts(std::move(Opts)), C(C) {}
30 void finishedMainFile(DiagnosticsEngine &Diags)
override {
31 C.handleDependencyOutputOpts(*Opts);
32 llvm::SmallString<256> CanonPath;
33 for (
const auto &
File : getDependencies()) {
35 llvm::sys::path::remove_dots(CanonPath,
true);
36 llvm::sys::path::make_absolute(WorkingDirectory, CanonPath);
37 C.handleFileDependency(CanonPath);
42 StringRef WorkingDirectory;
43 std::unique_ptr<DependencyOutputOptions> Opts;
44 DependencyConsumer &C;
51 if (LangOpts.Modules) {
54 Diags->
Report(diag::warn_pch_vfsoverlay_mismatch);
56 if (VFSOverlays.empty()) {
57 Diags->
Report(diag::note_pch_vfsoverlay_empty) <<
Type;
59 std::string Files = llvm::join(VFSOverlays,
"\n");
60 Diags->
Report(diag::note_pch_vfsoverlay_files) <<
Type << Files;
78 PrebuiltModuleListener(PrebuiltModuleFilesT &PrebuiltModuleFiles,
79 llvm::SmallVector<std::string> &NewModuleFiles,
81 const HeaderSearchOptions &HSOpts,
82 const LangOptions &LangOpts, DiagnosticsEngine &Diags,
83 const ArrayRef<StringRef> StableDirs)
84 : PrebuiltModuleFiles(PrebuiltModuleFiles),
85 NewModuleFiles(NewModuleFiles),
86 PrebuiltModulesASTMap(PrebuiltModulesASTMap), ExistingHSOpts(HSOpts),
87 ExistingLangOpts(LangOpts), Diags(Diags), StableDirs(StableDirs) {}
89 bool needsImportVisitation()
const override {
return true; }
90 bool needsInputFileVisitation()
override {
return true; }
91 bool needsSystemInputFileVisitation()
override {
return true; }
95 void visitImport(StringRef ModuleName, StringRef Filename)
override {
96 if (PrebuiltModuleFiles.insert({ModuleName.str(), Filename.str()}).second)
97 NewModuleFiles.push_back(Filename.str());
99 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(Filename);
100 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
101 if (PrebuiltMapEntry.second)
104 if (
auto It = PrebuiltModulesASTMap.find(CurrentFile);
105 It != PrebuiltModulesASTMap.end() && CurrentFile != Filename)
112 bool visitInputFileAsRequested(StringRef FilenameAsRequested,
113 StringRef Filename,
bool isSystem,
114 bool isOverridden, time_t StoredTime,
115 bool isExplicitModule)
override {
116 if (StableDirs.empty())
118 auto PrebuiltEntryIt = PrebuiltModulesASTMap.find(CurrentFile);
119 if ((PrebuiltEntryIt == PrebuiltModulesASTMap.end()) ||
120 (!PrebuiltEntryIt->second.isInStableDir()))
123 PrebuiltEntryIt->second.setInStableDir(
125 return PrebuiltEntryIt->second.isInStableDir();
129 void visitModuleFile(StringRef Filename,
133 auto PrebuiltEntryIt = PrebuiltModulesASTMap.find(CurrentFile);
134 if ((PrebuiltEntryIt != PrebuiltModulesASTMap.end()) &&
135 !PrebuiltEntryIt->second.isInStableDir())
136 PrebuiltEntryIt->second.updateDependentsNotInStableDirs(
137 PrebuiltModulesASTMap);
138 CurrentFile = Filename;
143 bool ReadHeaderSearchOptions(
const HeaderSearchOptions &HSOpts,
144 StringRef ModuleFilename,
145 StringRef SpecificModuleCachePath,
146 bool Complain)
override {
148 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(CurrentFile);
149 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
150 if (PrebuiltMapEntry.second)
160 bool ReadHeaderSearchPaths(
const HeaderSearchOptions &HSOpts,
161 bool Complain)
override {
163 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(CurrentFile);
164 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
165 if (PrebuiltMapEntry.second)
171 return checkHeaderSearchPaths(
172 HSOpts, ExistingHSOpts, Complain ? &Diags :
nullptr, ExistingLangOpts);
176 PrebuiltModuleFilesT &PrebuiltModuleFiles;
177 llvm::SmallVector<std::string> &NewModuleFiles;
179 const HeaderSearchOptions &ExistingHSOpts;
180 const LangOptions &ExistingLangOpts;
181 DiagnosticsEngine &Diags;
182 std::string CurrentFile;
183 const ArrayRef<StringRef> StableDirs;
188static bool visitPrebuiltModule(StringRef PrebuiltModuleFilename,
190 PrebuiltModuleFilesT &ModuleFiles,
197 PrebuiltModuleListener Listener(ModuleFiles, Worklist, PrebuiltModulesASTMap,
201 Listener.visitModuleFile(PrebuiltModuleFilename,
210 while (!Worklist.empty()) {
223static std::string makeObjFileName(StringRef
FileName) {
225 llvm::sys::path::replace_extension(ObjFileName,
"o");
226 return std::string(ObjFileName);
231deduceDepTarget(
const std::string &OutputFile,
233 if (OutputFile !=
"-")
236 if (InputFiles.empty() || !InputFiles.front().isFile())
237 return "clang-scan-deps\\ dependency";
239 return makeObjFileName(InputFiles.front().getFile());
252static std::optional<StringRef> getSimpleMacroName(StringRef
Macro) {
253 StringRef Name =
Macro.split(
"=").first.ltrim(
" \t");
256 auto FinishName = [&]() -> std::optional<StringRef> {
257 StringRef SimpleName = Name.slice(0, I);
258 if (SimpleName.empty())
263 for (; I != Name.size(); ++I) {
272 if (llvm::isAlnum(Name[I]))
281 using MacroOpt = std::pair<StringRef, std::size_t>;
282 std::vector<MacroOpt> SimpleNames;
283 SimpleNames.reserve(PPOpts.
Macros.size());
284 std::size_t Index = 0;
285 for (
const auto &M : PPOpts.
Macros) {
286 auto SName = getSimpleMacroName(M.first);
290 SimpleNames.emplace_back(*SName, Index);
294 llvm::stable_sort(SimpleNames, llvm::less_first());
296 auto NewEnd = std::unique(
297 SimpleNames.rbegin(), SimpleNames.rend(),
298 [](
const MacroOpt &A,
const MacroOpt &B) { return A.first == B.first; });
299 SimpleNames.erase(SimpleNames.begin(), NewEnd.base());
302 decltype(PPOpts.
Macros) NewMacros;
303 NewMacros.reserve(SimpleNames.size());
304 for (std::size_t I = 0, E = SimpleNames.size(); I != E; ++I) {
305 std::size_t OriginalIndex = SimpleNames[I].second;
307 NewMacros.push_back(std::move(PPOpts.
Macros[OriginalIndex]));
309 std::swap(PPOpts.
Macros, NewMacros);
313 DependencyScanningWorkerFilesystem *DepFS;
316 ScanningDependencyDirectivesGetter(FileManager &FileMgr) : DepFS(
nullptr) {
318 auto *
DFS = llvm::dyn_cast<DependencyScanningWorkerFilesystem>(&FS);
320 assert(!DepFS &&
"Found multiple scanning VFSs");
324 assert(DepFS &&
"Did not find scanning VFS");
327 std::unique_ptr<DependencyDirectivesGetter>
328 cloneFor(FileManager &FileMgr)
override {
329 return std::make_unique<ScanningDependencyDirectivesGetter>(FileMgr);
332 std::optional<ArrayRef<dependency_directives_scan::Directive>>
333 operator()(FileEntryRef
File)
override {
334 return DepFS->getDirectiveTokens(
File.getName());
341 DiagOpts.ShowCarets =
false;
352 return llvm::StringSwitch<bool>(Warning)
353 .Cases({
"pch-vfs-diff",
"error=pch-vfs-diff"},
false)
354 .StartsWith(
"no-error=",
false)
360std::unique_ptr<DiagnosticOptions>
362 std::vector<const char *> CLI;
363 for (
const std::string &Arg : CommandLine)
364 CLI.push_back(Arg.c_str());
366 sanitizeDiagOpts(*DiagOpts);
373 std::vector<const char *> CCommandLine(CommandLine.size(),
nullptr);
374 llvm::transform(CommandLine, CCommandLine.begin(),
375 [](
const std::string &Str) { return Str.c_str(); });
382std::unique_ptr<CompilerInvocation>
385 llvm::opt::ArgStringList Argv;
386 for (
const std::string &Str :
ArrayRef(CommandLine).drop_front())
387 Argv.push_back(Str.c_str());
389 auto Invocation = std::make_unique<CompilerInvocation>();
410 DepFS->resetBypassedPathPrefix();
415 if (!ModulesCachePath.empty())
416 DepFS->setBypassedPathPrefix(ModulesCachePath);
419 std::make_unique<ScanningDependencyDirectivesGetter>(
425static std::shared_ptr<CompilerInvocation>
428 auto ScanInvocation = std::make_shared<CompilerInvocation>(Invocation);
430 sanitizeDiagOpts(ScanInvocation->getDiagnosticOpts());
432 ScanInvocation->getPreprocessorOpts().AllowPCHWithDifferentModulesCachePath =
435 if (ScanInvocation->getHeaderSearchOpts().ModulesValidateOncePerBuildSession)
436 ScanInvocation->getHeaderSearchOpts().BuildSessionTimestamp =
439 ScanInvocation->getFrontendOpts().DisableFree =
false;
440 ScanInvocation->getFrontendOpts().GenerateGlobalModuleIndex =
false;
441 ScanInvocation->getFrontendOpts().UseGlobalModuleIndex =
false;
442 ScanInvocation->getFrontendOpts().GenReducedBMI =
false;
443 ScanInvocation->getFrontendOpts().ModuleOutputPath.clear();
446 ScanInvocation->getFrontendOpts().ModulesShareFileManager =
true;
447 ScanInvocation->getHeaderSearchOpts().ModuleFormat =
"raw";
448 ScanInvocation->getHeaderSearchOpts().ModulesIncludeVFSUsage =
456 ScanInvocation->getHeaderSearchOpts().ModulesStrictContextHash =
true;
457 ScanInvocation->getHeaderSearchOpts().ModulesSerializeOnlyPreprocessor =
true;
458 ScanInvocation->getHeaderSearchOpts().ModulesSkipDiagnosticOptions =
true;
459 ScanInvocation->getHeaderSearchOpts().ModulesSkipHeaderSearchPaths =
true;
460 ScanInvocation->getHeaderSearchOpts().ModulesSkipPragmaDiagnosticMappings =
462 ScanInvocation->getHeaderSearchOpts().ModulesForceValidateUserHeaders =
false;
465 ScanInvocation->getPreprocessorOpts().ModulesCheckRelocated =
false;
469 ScanInvocation->getDependencyOutputOpts() = {};
471 return ScanInvocation;
474llvm::SmallVector<StringRef>
481 if (!Sysroot.empty() && (llvm::sys::path::root_directory(Sysroot) != Sysroot))
486std::optional<PrebuiltModulesAttrsMap>
496 if (visitPrebuiltModule(
499 PrebuiltModulesASTMap, ScanInstance.
getDiagnostics(), StableDirs))
502 return PrebuiltModulesASTMap;
507static std::unique_ptr<DependencyOutputOptions>
509 auto Opts = std::make_unique<DependencyOutputOptions>(
513 if (Opts->Targets.empty())
516 Opts->IncludeSystemHeaders =
true;
521std::shared_ptr<ModuleDepCollector>
524 std::unique_ptr<DependencyOutputOptions> DepOutputOpts,
530 std::shared_ptr<ModuleDepCollector> MDC;
534 std::make_shared<DependencyConsumerForwarder>(
535 std::move(DepOutputOpts), WorkingDirectory, Consumer));
539 MDC = std::make_shared<ModuleDepCollector>(
540 Service, std::move(DepOutputOpts), ScanInstance, Consumer, Controller,
541 Inv, std::move(PrebuiltModulesASTMap), StableDirs);
550 std::string Executable,
551 std::unique_ptr<CompilerInvocation> OriginalInvocation,
553 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
558 canonicalizeDefines(OriginalInvocation->getPreprocessorOpts());
566 MDC->applyDiscoveredDependencies(*OriginalInvocation);
567 Consumer.handleBuildCommand(
568 {Executable, OriginalInvocation->getCC1CommandLine()});
575 auto ScanInvocation =
578 ScanInstanceStorage.emplace(std::move(ScanInvocation),
579 std::move(PCHContainerOps), std::move(ModCache));
582 assert(!DiagConsumerFinished &&
"attempt to reuse finished consumer");
587 auto MaybePrebuiltModulesASTMap =
589 if (!MaybePrebuiltModulesASTMap)
595 ScanInstance, std::move(DepOutputOpts), WorkingDirectory, Consumer,
596 Service, *OriginalInvocation, Controller, *MaybePrebuiltModulesASTMap,
599 std::unique_ptr<FrontendAction> Action;
602 Action = std::make_unique<PreprocessOnlyAction>();
604 Action = std::make_unique<ReadPCHAndPreprocessAction>();
612 DiagConsumerFinished =
true;
616 MDC->applyDiscoveredDependencies(*OriginalInvocation);
617 Consumer.handleBuildCommand(
618 {Executable, OriginalInvocation->getCC1CommandLine()});
625 std::unique_ptr<DiagnosticsEngineWithDiagOpts> DiagEngineWithDiagOpts,
627 assert(DiagEngineWithDiagOpts &&
"Valid diagnostics engine required!");
628 DiagEngineWithCmdAndOpts = std::move(DiagEngineWithDiagOpts);
629 DiagConsumer = DiagEngineWithCmdAndOpts->DiagEngine->getClient();
632 assert(OverlayFS &&
"OverlayFS required!");
633 bool SawDepFS =
false;
634 OverlayFS->visit([&](llvm::vfs::FileSystem &
VFS) {
635 SawDepFS |= &
VFS == Worker.DepFS.get();
637 assert(SawDepFS &&
"OverlayFS not based on DepFS");
641 CommandLine, *DiagEngineWithCmdAndOpts->DiagEngine);
642 if (!OriginalInvocation) {
643 DiagEngineWithCmdAndOpts->DiagEngine->Report(
644 diag::err_fe_expected_compiler_job)
645 << llvm::join(CommandLine,
" ");
650 canonicalizeDefines(OriginalInvocation->getPreprocessorOpts());
653 std::shared_ptr<ModuleCache> ModCache =
655 CIPtr = std::make_unique<CompilerInstance>(
657 Worker.PCHContainerOps, std::move(ModCache));
661 CI, OverlayFS, DiagEngineWithCmdAndOpts->DiagEngine->getClient(),
662 Worker.Service, Worker.DepFS);
665 auto MaybePrebuiltModulesASTMap =
667 if (!MaybePrebuiltModulesASTMap)
670 PrebuiltModuleASTMap = std::move(*MaybePrebuiltModulesASTMap);
686 assert(CIPtr &&
"CIPtr must be initialized before calling this method");
691 llvm::scope_exit CleanUp([&]() {
700 CI, std::make_unique<DependencyOutputOptions>(*OutputOpts), CWD, Consumer,
705 *OriginalInvocation, Controller, PrebuiltModuleASTMap, StableDirs);
710 std::unique_ptr<FrontendAction> Action =
711 std::make_unique<PreprocessOnlyAction>();
713 bool ActionBeginSucceeded = Action->BeginSourceFile(CI, *InputFile);
714 assert(ActionBeginSucceeded &&
"Action BeginSourceFile must succeed");
715 (void)ActionBeginSucceeded;
720 FileID MainFileID =
SM.getMainFileID();
728 assert(!PPFailed &&
"Preprocess must be able to enter the main file.");
730 CB = MDC->getPPCallbacks();
735 MDC->attachToPreprocessor(PP);
736 CB = MDC->getPPCallbacks();
742 FileType, PrevFID, IDLocation);
748 Path.emplace_back(IDLocation,
ModuleID);
751 assert(CB &&
"Must have PPCallbacks after module loading");
762 MDC->applyDiscoveredDependencies(ModuleInvocation);
770 DiagConsumer->finish();
static std::unique_ptr< DependencyOutputOptions > createDependencyOutputOptions(const CompilerInvocation &Invocation)
Creates dependency output options to be reported to the dependency consumer, deducing missing informa...
static std::shared_ptr< CompilerInvocation > createScanCompilerInvocation(const CompilerInvocation &Invocation, const DependencyScanningService &Service)
Creates a CompilerInvocation suitable for the dependency scanner.
Abstract interface for callback invocations by the ASTReader.
@ ARR_OutOfDate
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
void clearDependencyCollectors()
void createDiagnostics(DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one ...
const PCHContainerReader & getPCHContainerReader() const
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) override
Attempt to load the given module.
void createFileManager()
Create the file manager and replace any existing one with it.
FileManager & getFileManager() const
Return the current file manager to the caller.
ModuleCache & getModuleCache() const
void addDependencyCollector(std::shared_ptr< DependencyCollector > Listener)
Preprocessor & getPreprocessor() const
Return the current preprocessor.
void createVirtualFileSystem(IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS=llvm::vfs::getRealFileSystem(), DiagnosticConsumer *DC=nullptr)
Create a virtual file system instance based on the invocation.
FrontendOptions & getFrontendOpts()
HeaderSearchOptions & getHeaderSearchOpts()
void createSourceManager()
Create the source manager and replace any existing one with it.
PreprocessorOptions & getPreprocessorOpts()
bool ExecuteAction(FrontendAction &Act)
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
LangOptions & getLangOpts()
void setDependencyDirectivesGetter(std::unique_ptr< DependencyDirectivesGetter > Getter)
std::vector< std::string > getCC1CommandLine() const
Generate cc1-compatible command line arguments from this instance, wrapping the result as a std::vect...
Helper class for holding the data necessary to invoke the compiler.
static bool CreateFromArgs(CompilerInvocation &Res, ArrayRef< const char * > CommandLineArgs, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Create a compiler invocation from a list of input options.
DependencyOutputOptions & getDependencyOutputOpts()
FrontendOptions & getFrontendOpts()
Functor that returns the dependency directives for a given file.
Builds a dependency file when attached to a Preprocessor (for includes) and ASTReader (for module imp...
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Options for controlling the compiler diagnostics engine.
std::vector< std::string > Warnings
The list of -W... options used to alter the diagnostic mappings, with the prefixes removed.
std::string DiagnosticSerializationFile
The file to serialize diagnostics to (non-appending).
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
bool hasErrorOccurred() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
llvm::vfs::FileSystem & getVirtualFileSystem() const
std::string OutputFile
The output file, if any.
SmallVector< FrontendInputFile, 0 > Inputs
The input files and their types.
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void setBuildingModule(bool BuildingModuleFlag)
Flag indicating whether this instance is building a module.
@ Hidden
All of the names in this module are hidden.
This interface provides a way to observe the actions of the preprocessor as it does its thing.
virtual void EndOfMainFile()
Callback invoked when the end of the main file is reached.
virtual void LexedFileChanged(FileID FID, LexedFileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID, SourceLocation Loc)
Callback invoked whenever the Lexer moves to a different file for lexing.
virtual void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported)
Callback invoked whenever there was an explicit module-import syntax.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
std::vector< std::pair< std::string, bool > > Macros
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
bool EnterSourceFile(FileID FID, ConstSearchDirIterator Dir, SourceLocation Loc, bool IsFirstIncludeOfFile=true)
Add a source file to the top of the include stack and start lexing tokens from it instead of the curr...
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
SourceManager & getSourceManager() const
Encodes a location in the source.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
The base class of the type hierarchy.
bool initialize(std::unique_ptr< DiagnosticsEngineWithDiagOpts > DiagEngineWithDiagOpts, IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > OverlayFS)
bool computeDependencies(StringRef ModuleName, DependencyConsumer &Consumer, DependencyActionController &Controller)
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
virtual void handleBuildCommand(Command Cmd)
bool runInvocation(std::string Executable, std::unique_ptr< CompilerInvocation > Invocation, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, std::shared_ptr< PCHContainerOperations > PCHContainerOps, DiagnosticConsumer *DiagConsumer)
The dependency scanning service contains shared configuration and state that is used by the individua...
std::time_t getBuildSessionTimestamp() const
ScanningOptimizations getOptimizeArgs() const
ScanningMode getMode() const
ScanningOutputFormat getFormat() const
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.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
SmallVector< StringRef > getInitialStableDirs(const CompilerInstance &ScanInstance)
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.
@ Macros
Canonicalize -D and -U options.
void initializeScanCompilerInstance(CompilerInstance &ScanInstance, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, DiagnosticConsumer *DiagConsumer, DependencyScanningService &Service, IntrusiveRefCntPtr< DependencyScanningWorkerFilesystem > DepFS)
llvm::StringMap< PrebuiltModuleASTAttrs > PrebuiltModulesAttrsMap
Attributes loaded from AST files of prebuilt modules collected prior to ModuleDepCollector creation.
std::unique_ptr< CompilerInvocation > createCompilerInvocation(ArrayRef< std::string > CommandLine, DiagnosticsEngine &Diags)
std::optional< PrebuiltModulesAttrsMap > computePrebuiltModulesASTMap(CompilerInstance &ScanInstance, SmallVector< StringRef > &StableDirs)
std::shared_ptr< ModuleCache > makeInProcessModuleCache(ModuleCacheEntries &Entries)
std::shared_ptr< ModuleDepCollector > initializeScanInstanceDependencyCollector(CompilerInstance &ScanInstance, std::unique_ptr< DependencyOutputOptions > DepOutputOpts, StringRef WorkingDirectory, DependencyConsumer &Consumer, DependencyScanningService &Service, CompilerInvocation &Inv, DependencyActionController &Controller, PrebuiltModulesAttrsMap PrebuiltModulesASTMap, llvm::SmallVector< StringRef > &StableDirs)
Create the dependency collector that will collect the produced dependencies.
std::unique_ptr< DiagnosticOptions > createDiagOptions(ArrayRef< std::string > CommandLine)
bool isPathInStableDir(const ArrayRef< StringRef > Directories, const StringRef Input)
Determine if Input can be resolved within a stable directory.
@ Make
This is the Makefile compatible dep format.
@ Full
This outputs the full clang module dependency graph suitable for use for explicitly building modules.
@ P1689
This outputs the dependency graph for standard c++ modules in P1689R5 format.
@ DependencyDirectivesScan
This mode is used to compute the dependencies by running the preprocessor with special kind of lexing...
ModuleKind
Specifies the kind of module that has been loaded.
@ MK_ExplicitModule
File is an explicitly-loaded module.
The JSON file list parser is used to communicate input to InstallAPI.
std::unique_ptr< DiagnosticOptions > CreateAndPopulateDiagOpts(ArrayRef< const char * > Argv)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ Result
The result type of a method or function.
void normalizeModuleCachePath(FileManager &FileMgr, StringRef Path, SmallVectorImpl< char > &NormalizedPath)
int __ovld __cnfn any(char)
Returns 1 if the most significant bit in any component of x is set; otherwise returns 0.
IntrusiveRefCntPtr< DiagnosticsEngine > DiagEngine
DiagnosticsEngineWithDiagOpts(ArrayRef< std::string > CommandLine, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, DiagnosticConsumer &DC)
std::unique_ptr< DiagnosticOptions > DiagOpts
This is used to identify a specific module.