27#include "llvm/ADT/IntrusiveRefCntPtr.h"
28#include "llvm/Support/Allocator.h"
29#include "llvm/Support/Error.h"
30#include "llvm/Support/MemoryBuffer.h"
31#include "llvm/TargetParser/Host.h"
43 DependencyConsumerForwarder(std::unique_ptr<DependencyOutputOptions> Opts,
44 StringRef WorkingDirectory, DependencyConsumer &C)
45 : DependencyFileGenerator(*Opts), WorkingDirectory(WorkingDirectory),
46 Opts(std::move(Opts)), C(C) {}
48 void finishedMainFile(DiagnosticsEngine &Diags)
override {
49 C.handleDependencyOutputOpts(*Opts);
50 llvm::SmallString<256> CanonPath;
51 for (
const auto &
File : getDependencies()) {
53 llvm::sys::path::remove_dots(CanonPath,
true);
54 llvm::sys::fs::make_absolute(WorkingDirectory, CanonPath);
55 C.handleFileDependency(CanonPath);
60 StringRef WorkingDirectory;
61 std::unique_ptr<DependencyOutputOptions> Opts;
62 DependencyConsumer &C;
69 if (LangOpts.Modules) {
72 Diags->
Report(diag::warn_pch_vfsoverlay_mismatch);
74 if (VFSOverlays.empty()) {
75 Diags->
Report(diag::note_pch_vfsoverlay_empty) <<
Type;
77 std::string Files = llvm::join(VFSOverlays,
"\n");
78 Diags->
Report(diag::note_pch_vfsoverlay_files) <<
Type << Files;
96 PrebuiltModuleListener(PrebuiltModuleFilesT &PrebuiltModuleFiles,
97 llvm::SmallVector<std::string> &NewModuleFiles,
99 const HeaderSearchOptions &HSOpts,
100 const LangOptions &LangOpts, DiagnosticsEngine &Diags,
101 const ArrayRef<StringRef> StableDirs)
102 : PrebuiltModuleFiles(PrebuiltModuleFiles),
103 NewModuleFiles(NewModuleFiles),
104 PrebuiltModulesASTMap(PrebuiltModulesASTMap), ExistingHSOpts(HSOpts),
105 ExistingLangOpts(LangOpts), Diags(Diags), StableDirs(StableDirs) {}
107 bool needsImportVisitation()
const override {
return true; }
108 bool needsInputFileVisitation()
override {
return true; }
109 bool needsSystemInputFileVisitation()
override {
return true; }
113 void visitImport(StringRef ModuleName, StringRef Filename)
override {
114 if (PrebuiltModuleFiles.insert({ModuleName.str(), Filename.str()}).second)
115 NewModuleFiles.push_back(Filename.str());
117 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(Filename);
118 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
119 if (PrebuiltMapEntry.second)
122 if (
auto It = PrebuiltModulesASTMap.find(CurrentFile);
123 It != PrebuiltModulesASTMap.end() && CurrentFile != Filename)
130 bool visitInputFileAsRequested(StringRef FilenameAsRequested,
131 StringRef Filename,
bool isSystem,
133 bool isExplicitModule)
override {
134 if (StableDirs.empty())
136 auto PrebuiltEntryIt = PrebuiltModulesASTMap.find(CurrentFile);
137 if ((PrebuiltEntryIt == PrebuiltModulesASTMap.end()) ||
138 (!PrebuiltEntryIt->second.isInStableDir()))
141 PrebuiltEntryIt->second.setInStableDir(
143 return PrebuiltEntryIt->second.isInStableDir();
147 void visitModuleFile(StringRef Filename,
151 auto PrebuiltEntryIt = PrebuiltModulesASTMap.find(CurrentFile);
152 if ((PrebuiltEntryIt != PrebuiltModulesASTMap.end()) &&
153 !PrebuiltEntryIt->second.isInStableDir())
154 PrebuiltEntryIt->second.updateDependentsNotInStableDirs(
155 PrebuiltModulesASTMap);
156 CurrentFile = Filename;
161 bool ReadHeaderSearchOptions(
const HeaderSearchOptions &HSOpts,
162 StringRef ModuleFilename,
163 StringRef SpecificModuleCachePath,
164 bool Complain)
override {
166 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(CurrentFile);
167 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
168 if (PrebuiltMapEntry.second)
178 bool ReadHeaderSearchPaths(
const HeaderSearchOptions &HSOpts,
179 bool Complain)
override {
181 auto PrebuiltMapEntry = PrebuiltModulesASTMap.try_emplace(CurrentFile);
182 PrebuiltModuleASTAttrs &PrebuiltModule = PrebuiltMapEntry.first->second;
183 if (PrebuiltMapEntry.second)
189 return checkHeaderSearchPaths(
190 HSOpts, ExistingHSOpts, Complain ? &Diags :
nullptr, ExistingLangOpts);
194 PrebuiltModuleFilesT &PrebuiltModuleFiles;
195 llvm::SmallVector<std::string> &NewModuleFiles;
197 const HeaderSearchOptions &ExistingHSOpts;
198 const LangOptions &ExistingLangOpts;
199 DiagnosticsEngine &Diags;
200 std::string CurrentFile;
201 const ArrayRef<StringRef> StableDirs;
206static bool visitPrebuiltModule(StringRef PrebuiltModuleFilename,
208 PrebuiltModuleFilesT &ModuleFiles,
215 PrebuiltModuleListener Listener(ModuleFiles, Worklist, PrebuiltModulesASTMap,
219 Listener.visitModuleFile(PrebuiltModuleFilename,
228 while (!Worklist.empty()) {
241static std::string makeObjFileName(StringRef
FileName) {
243 llvm::sys::path::replace_extension(ObjFileName,
"o");
244 return std::string(ObjFileName);
249deduceDepTarget(
const std::string &OutputFile,
251 if (OutputFile !=
"-")
254 if (InputFiles.empty() || !InputFiles.front().isFile())
255 return "clang-scan-deps\\ dependency";
257 return makeObjFileName(InputFiles.front().getFile());
263 DiagOpts.ShowCarets =
false;
274 return llvm::StringSwitch<bool>(Warning)
275 .Cases(
"pch-vfs-diff",
"error=pch-vfs-diff", false)
276 .StartsWith(
"no-error=", false)
291static std::optional<StringRef> getSimpleMacroName(StringRef
Macro) {
292 StringRef Name =
Macro.split(
"=").first.ltrim(
" \t");
295 auto FinishName = [&]() -> std::optional<StringRef> {
296 StringRef SimpleName = Name.slice(0, I);
297 if (SimpleName.empty())
302 for (; I != Name.size(); ++I) {
311 if (llvm::isAlnum(Name[I]))
320 using MacroOpt = std::pair<StringRef, std::size_t>;
321 std::vector<MacroOpt> SimpleNames;
322 SimpleNames.reserve(PPOpts.
Macros.size());
323 std::size_t Index = 0;
324 for (
const auto &M : PPOpts.
Macros) {
325 auto SName = getSimpleMacroName(M.first);
329 SimpleNames.emplace_back(*SName, Index);
333 llvm::stable_sort(SimpleNames, llvm::less_first());
335 auto NewEnd = std::unique(
336 SimpleNames.rbegin(), SimpleNames.rend(),
337 [](
const MacroOpt &A,
const MacroOpt &B) { return A.first == B.first; });
338 SimpleNames.erase(SimpleNames.begin(), NewEnd.base());
341 decltype(PPOpts.
Macros) NewMacros;
342 NewMacros.reserve(SimpleNames.size());
343 for (std::size_t I = 0, E = SimpleNames.size(); I != E; ++I) {
344 std::size_t OriginalIndex = SimpleNames[I].second;
346 NewMacros.push_back(std::move(PPOpts.
Macros[OriginalIndex]));
348 std::swap(PPOpts.
Macros, NewMacros);
352 DependencyScanningWorkerFilesystem *DepFS;
355 ScanningDependencyDirectivesGetter(FileManager &FileMgr) : DepFS(
nullptr) {
357 auto *
DFS = llvm::dyn_cast<DependencyScanningWorkerFilesystem>(&FS);
359 assert(!DepFS &&
"Found multiple scanning VFSs");
363 assert(DepFS &&
"Did not find scanning VFS");
366 std::unique_ptr<DependencyDirectivesGetter>
367 cloneFor(FileManager &FileMgr)
override {
368 return std::make_unique<ScanningDependencyDirectivesGetter>(FileMgr);
371 std::optional<ArrayRef<dependency_directives_scan::Directive>>
372 operator()(FileEntryRef
File)
override {
373 return DepFS->getDirectiveTokens(
File.getName());
379class DependencyScanningAction {
381 DependencyScanningAction(
382 DependencyScanningService &Service, StringRef WorkingDirectory,
383 DependencyConsumer &Consumer, DependencyActionController &Controller,
384 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS,
385 std::optional<StringRef> ModuleName = std::nullopt)
386 : Service(Service), WorkingDirectory(WorkingDirectory),
387 Consumer(Consumer), Controller(Controller), DepFS(std::move(DepFS)),
388 ModuleName(ModuleName) {}
390 bool runInvocation(std::shared_ptr<CompilerInvocation> Invocation,
391 IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
392 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
393 DiagnosticConsumer *DiagConsumer) {
395 CompilerInvocation OriginalInvocation(*Invocation);
396 if (
any(Service.getOptimizeArgs() & ScanningOptimizations::Macros))
397 canonicalizeDefines(OriginalInvocation.getPreprocessorOpts());
404 setLastCC1Arguments(std::move(OriginalInvocation));
412 ScanInstanceStorage.emplace(std::move(Invocation),
413 std::move(PCHContainerOps), ModCache.get());
414 CompilerInstance &ScanInstance = *ScanInstanceStorage;
419 assert(!DiagConsumerFinished &&
"attempt to reuse finished consumer");
430 Service.getBuildSessionTimestamp();
440 any(Service.getOptimizeArgs() & ScanningOptimizations::VFS);
452 SmallString<256> ModulesCachePath;
456 DepFS->resetBypassedPathPrefix();
457 if (!ModulesCachePath.empty())
458 DepFS->setBypassedPathPrefix(ModulesCachePath);
461 std::make_unique<ScanningDependencyDirectivesGetter>(*FileMgr));
469 llvm::SmallVector<StringRef> StableDirs;
471 if (!Sysroot.empty() &&
472 (llvm::sys::path::root_directory(Sysroot) != Sysroot))
482 if (visitPrebuiltModule(
486 PrebuiltModulesASTMap, ScanInstance.
getDiagnostics(), StableDirs))
496 auto Opts = std::make_unique<DependencyOutputOptions>();
500 if (Opts->Targets.empty())
504 Opts->IncludeSystemHeaders =
true;
506 switch (Service.getFormat()) {
507 case ScanningOutputFormat::Make:
509 std::make_shared<DependencyConsumerForwarder>(
510 std::move(Opts), WorkingDirectory, Consumer));
512 case ScanningOutputFormat::P1689:
513 case ScanningOutputFormat::Full:
514 MDC = std::make_shared<ModuleDepCollector>(
515 Service, std::move(Opts), ScanInstance, Consumer, Controller,
516 OriginalInvocation, std::move(PrebuiltModulesASTMap), StableDirs);
537 std::unique_ptr<FrontendAction> Action;
539 if (Service.getFormat() == ScanningOutputFormat::P1689)
540 Action = std::make_unique<PreprocessOnlyAction>();
542 Action = std::make_unique<GetDependenciesByModuleNameAction>(*ModuleName);
544 Action = std::make_unique<ReadPCHAndPreprocessAction>();
552 DiagConsumerFinished =
true;
555 setLastCC1Arguments(std::move(OriginalInvocation));
560 bool hasScanned()
const {
return Scanned; }
561 bool hasDiagConsumerFinished()
const {
return DiagConsumerFinished; }
566 std::vector<std::string> takeLastCC1Arguments() {
567 std::vector<std::string>
Result;
568 std::swap(
Result, LastCC1Arguments);
573 void setLastCC1Arguments(CompilerInvocation &&CI) {
575 MDC->applyDiscoveredDependencies(CI);
576 LastCC1Arguments = CI.getCC1CommandLine();
579 DependencyScanningService &Service;
580 StringRef WorkingDirectory;
581 DependencyConsumer &Consumer;
582 DependencyActionController &Controller;
583 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS;
584 std::optional<StringRef> ModuleName;
585 std::optional<CompilerInstance> ScanInstanceStorage;
586 std::shared_ptr<ModuleDepCollector> MDC;
587 std::vector<std::string> LastCC1Arguments;
588 bool Scanned =
false;
589 bool DiagConsumerFinished =
false;
598 PCHContainerOps = std::make_shared<PCHContainerOperations>();
600 PCHContainerOps->registerReader(
601 std::make_unique<ObjectFilePCHContainerReader>());
603 PCHContainerOps->registerWriter(std::make_unique<RawPCHContainerWriter>());
605 if (Service.shouldTraceVFS())
606 FS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(std::move(FS));
608 switch (Service.getMode()) {
610 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
611 Service.getSharedCache(), FS);
621static std::unique_ptr<DiagnosticOptions>
623 std::vector<const char *> CLI;
624 for (
const std::string &Arg : CommandLine)
625 CLI.push_back(Arg.c_str());
627 sanitizeDiagOpts(*DiagOpts);
632 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
634 std::optional<llvm::MemoryBufferRef> TUBuffer) {
637 std::string DiagnosticOutput;
638 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
643 DiagPrinter, TUBuffer))
644 return llvm::Error::success();
645 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
646 llvm::inconvertibleErrorCode());
650 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
652 StringRef ModuleName) {
655 std::string DiagnosticOutput;
656 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
661 DiagPrinter, ModuleName))
662 return llvm::Error::success();
663 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
664 llvm::inconvertibleErrorCode());
672 Argv.reserve(ArgStrs.size());
673 for (
const std::string &Arg : ArgStrs)
674 Argv.push_back(Arg.c_str());
676 std::unique_ptr<driver::Driver> Driver = std::make_unique<driver::Driver>(
677 Argv[0], llvm::sys::getDefaultTargetTriple(), Diags,
678 "clang LLVM compiler", FS);
679 Driver->setTitle(
"clang_based_tool");
681 llvm::BumpPtrAllocator Alloc;
687 Diags.
Report(diag::err_drv_expand_response_file)
688 << llvm::toString(std::move(E));
692 const std::unique_ptr<driver::Compilation> Compilation(
697 if (Compilation->containsError())
708 std::vector<std::string> CommandLine, DependencyScanningAction &Action,
710 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
714 std::string Executable = CommandLine[0];
716 llvm::opt::ArgStringList Argv;
717 for (
const std::string &Str :
ArrayRef(CommandLine).drop_front())
718 Argv.push_back(Str.c_str());
720 auto Invocation = std::make_shared<CompilerInvocation>();
726 if (!Action.runInvocation(std::move(Invocation), std::move(FS),
730 std::vector<std::string> Args = Action.takeLastCC1Arguments();
735bool DependencyScanningWorker::scanDependencies(
736 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
738 DiagnosticConsumer &DC, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
739 std::optional<StringRef> ModuleName) {
740 std::vector<const char *> CCommandLine(CommandLine.size(),
nullptr);
741 llvm::transform(CommandLine, CCommandLine.begin(),
742 [](
const std::string &Str) { return Str.c_str(); });
744 sanitizeDiagOpts(*DiagOpts);
748 DependencyScanningAction Action(Service, WorkingDirectory, Consumer,
749 Controller, DepFS, ModuleName);
752 if (CommandLine[1] ==
"-cc1") {
754 PCHContainerOps, *Diags, Consumer);
757 CommandLine, *Diags, FS, [&](
const driver::Command &Cmd) {
768 std::vector<std::string> Argv;
777 PCHContainerOps, *Diags, Consumer);
781 if (
Success && !Action.hasScanned())
782 Diags->
Report(diag::err_fe_expected_compiler_job)
783 << llvm::join(CommandLine,
" ");
786 if (!Action.hasDiagConsumerFinished())
789 return Success && Action.hasScanned();
793 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
797 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
799 std::optional<std::vector<std::string>> ModifiedCommandLine;
807 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
809 llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
810 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
811 auto InputPath = TUBuffer->getBufferIdentifier();
814 llvm::MemoryBuffer::getMemBufferCopy(TUBuffer->getBuffer()));
818 OverlayFS->pushOverlay(InMemoryOverlay);
819 ModifiedFS = OverlayFS;
820 ModifiedCommandLine = CommandLine;
821 ModifiedCommandLine->emplace_back(InputPath);
824 const std::vector<std::string> &FinalCommandLine =
825 ModifiedCommandLine ? *ModifiedCommandLine : CommandLine;
826 auto &FinalFS = ModifiedFS ? ModifiedFS : BaseFS;
828 return scanDependencies(WorkingDirectory, FinalCommandLine, Consumer,
829 Controller, DC, FinalFS, std::nullopt);
833 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
837 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
843 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
844 auto InMemoryFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
845 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
848 llvm::sys::fs::createUniquePath(ModuleName +
"-%%%%%%%%.input", FakeInputPath,
850 InMemoryFS->addFile(FakeInputPath, 0, llvm::MemoryBuffer::getMemBuffer(
""));
853 OverlayFS->pushOverlay(InMemoryOverlay);
854 auto ModifiedCommandLine = CommandLine;
855 ModifiedCommandLine.emplace_back(FakeInputPath);
857 return scanDependencies(WorkingDirectory, ModifiedCommandLine, Consumer,
858 Controller, DC, OverlayFS, ModuleName);
static bool createAndRunToolInvocation(std::vector< std::string > CommandLine, DependencyScanningAction &Action, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, std::shared_ptr< clang::PCHContainerOperations > &PCHContainerOps, DiagnosticsEngine &Diags, DependencyConsumer &Consumer)
static std::unique_ptr< DiagnosticOptions > createDiagOptions(const std::vector< std::string > &CommandLine)
static bool forEachDriverJob(ArrayRef< std::string > ArgStrs, DiagnosticsEngine &Diags, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, llvm::function_ref< bool(const driver::Command &Cmd)> Callback)
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 createSourceManager(FileManager &FileMgr)
Create the source manager and replace any existing one with it.
FileManager * createFileManager(IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr)
Create the file manager and replace any existing one with it.
const PCHContainerReader & getPCHContainerReader() const
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
void createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one ...
FileManager & getFileManager() const
Return the current file manager to the caller.
ModuleCache & getModuleCache() const
void addDependencyCollector(std::shared_ptr< DependencyCollector > Listener)
FrontendOptions & getFrontendOpts()
bool hasDiagnostics() const
HeaderSearchOptions & getHeaderSearchOpts()
CompilerInvocation & getInvocation()
PreprocessorOptions & getPreprocessorOpts()
bool ExecuteAction(FrontendAction &Act)
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
DiagnosticOptions & getDiagnosticOpts()
LangOptions & getLangOpts()
void setDependencyDirectivesGetter(std::unique_ptr< DependencyDirectivesGetter > Getter)
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()
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...
virtual void finish()
Callback to inform the diagnostic client that processing of all source files has ended.
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
DiagnosticConsumer * getClient()
llvm::vfs::FileSystem & getVirtualFileSystem() const
unsigned ModulesShareFileManager
Whether to share the FileManager when building modules.
std::string OutputFile
The output file, if any.
unsigned GenerateGlobalModuleIndex
Whether we can generate the global module index if needed.
unsigned DisableFree
Disable memory freeing on exit.
SmallVector< FrontendInputFile, 0 > Inputs
The input files and their types.
unsigned UseGlobalModuleIndex
Whether we can use the global module index if available.
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.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
bool ModulesCheckRelocated
Perform extra checks when loading PCM files for mutable file systems.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
bool AllowPCHWithDifferentModulesCachePath
When true, a PCH with modules cache path different to the current compilation will not be rejected.
std::vector< std::pair< std::string, bool > > Macros
The base class of the type hierarchy.
Command - An executable path/name and argument vector to execute.
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
const llvm::opt::ArgStringList & getArguments() const
const char * getExecutable() const
llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef< const char * > Args)
Returns the driver mode option's value, i.e.
llvm::Error expandResponseFiles(SmallVectorImpl< const char * > &Args, bool ClangCLMode, llvm::BumpPtrAllocator &Alloc, llvm::vfs::FileSystem *FS=nullptr)
Expand response files from a clang driver or cc1 invocation.
bool IsClangCL(StringRef DriverMode)
Checks whether the value produced by getDriverMode is for CL mode.
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)
@ Success
Annotation was successful.
nullptr
This class represents a compute construct, representing a 'Kind' of βparallelβ, 'serial',...
@ Result
The result type of a method or function.
IntrusiveRefCntPtr< llvm::vfs::FileSystem > createVFSFromCompilerInvocation(const CompilerInvocation &CI, DiagnosticsEngine &Diags)
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.