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 StringRef ModulesCachePath =
455 DepFS->resetBypassedPathPrefix();
456 if (!ModulesCachePath.empty())
457 DepFS->setBypassedPathPrefix(ModulesCachePath);
460 std::make_unique<ScanningDependencyDirectivesGetter>(*FileMgr));
468 llvm::SmallVector<StringRef> StableDirs;
470 if (!Sysroot.empty() &&
471 (llvm::sys::path::root_directory(Sysroot) != Sysroot))
481 if (visitPrebuiltModule(
485 PrebuiltModulesASTMap, ScanInstance.
getDiagnostics(), StableDirs))
495 auto Opts = std::make_unique<DependencyOutputOptions>();
499 if (Opts->Targets.empty())
503 Opts->IncludeSystemHeaders =
true;
505 switch (Service.getFormat()) {
506 case ScanningOutputFormat::Make:
508 std::make_shared<DependencyConsumerForwarder>(
509 std::move(Opts), WorkingDirectory, Consumer));
511 case ScanningOutputFormat::P1689:
512 case ScanningOutputFormat::Full:
513 MDC = std::make_shared<ModuleDepCollector>(
514 Service, std::move(Opts), ScanInstance, Consumer, Controller,
515 OriginalInvocation, std::move(PrebuiltModulesASTMap), StableDirs);
536 std::unique_ptr<FrontendAction> Action;
538 if (Service.getFormat() == ScanningOutputFormat::P1689)
539 Action = std::make_unique<PreprocessOnlyAction>();
541 Action = std::make_unique<GetDependenciesByModuleNameAction>(*ModuleName);
543 Action = std::make_unique<ReadPCHAndPreprocessAction>();
551 DiagConsumerFinished =
true;
554 setLastCC1Arguments(std::move(OriginalInvocation));
559 bool hasScanned()
const {
return Scanned; }
560 bool hasDiagConsumerFinished()
const {
return DiagConsumerFinished; }
565 std::vector<std::string> takeLastCC1Arguments() {
566 std::vector<std::string>
Result;
567 std::swap(
Result, LastCC1Arguments);
572 void setLastCC1Arguments(CompilerInvocation &&CI) {
574 MDC->applyDiscoveredDependencies(CI);
575 LastCC1Arguments = CI.getCC1CommandLine();
578 DependencyScanningService &Service;
579 StringRef WorkingDirectory;
580 DependencyConsumer &Consumer;
581 DependencyActionController &Controller;
582 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS;
583 std::optional<StringRef> ModuleName;
584 std::optional<CompilerInstance> ScanInstanceStorage;
585 std::shared_ptr<ModuleDepCollector> MDC;
586 std::vector<std::string> LastCC1Arguments;
587 bool Scanned =
false;
588 bool DiagConsumerFinished =
false;
597 PCHContainerOps = std::make_shared<PCHContainerOperations>();
599 PCHContainerOps->registerReader(
600 std::make_unique<ObjectFilePCHContainerReader>());
602 PCHContainerOps->registerWriter(std::make_unique<RawPCHContainerWriter>());
604 if (Service.shouldTraceVFS())
605 FS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(std::move(FS));
607 switch (Service.getMode()) {
609 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
610 Service.getSharedCache(), FS);
620static std::unique_ptr<DiagnosticOptions>
622 std::vector<const char *> CLI;
623 for (
const std::string &Arg : CommandLine)
624 CLI.push_back(Arg.c_str());
626 sanitizeDiagOpts(*DiagOpts);
631 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
633 std::optional<llvm::MemoryBufferRef> TUBuffer) {
636 std::string DiagnosticOutput;
637 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
642 DiagPrinter, TUBuffer))
643 return llvm::Error::success();
644 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
645 llvm::inconvertibleErrorCode());
649 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
651 StringRef ModuleName) {
654 std::string DiagnosticOutput;
655 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
660 DiagPrinter, ModuleName))
661 return llvm::Error::success();
662 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
663 llvm::inconvertibleErrorCode());
671 Argv.reserve(ArgStrs.size());
672 for (
const std::string &Arg : ArgStrs)
673 Argv.push_back(Arg.c_str());
675 std::unique_ptr<driver::Driver> Driver = std::make_unique<driver::Driver>(
676 Argv[0], llvm::sys::getDefaultTargetTriple(), Diags,
677 "clang LLVM compiler", FS);
678 Driver->setTitle(
"clang_based_tool");
680 llvm::BumpPtrAllocator Alloc;
686 Diags.
Report(diag::err_drv_expand_response_file)
687 << llvm::toString(std::move(E));
691 const std::unique_ptr<driver::Compilation> Compilation(
696 if (Compilation->containsError())
707 std::vector<std::string> CommandLine, DependencyScanningAction &Action,
709 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
713 std::string Executable = CommandLine[0];
715 llvm::opt::ArgStringList Argv;
716 for (
const std::string &Str :
ArrayRef(CommandLine).drop_front())
717 Argv.push_back(Str.c_str());
719 auto Invocation = std::make_shared<CompilerInvocation>();
725 if (!Action.runInvocation(std::move(Invocation), std::move(FS),
729 std::vector<std::string> Args = Action.takeLastCC1Arguments();
734bool DependencyScanningWorker::scanDependencies(
735 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
737 DiagnosticConsumer &DC, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
738 std::optional<StringRef> ModuleName) {
739 std::vector<const char *> CCommandLine(CommandLine.size(),
nullptr);
740 llvm::transform(CommandLine, CCommandLine.begin(),
741 [](
const std::string &Str) { return Str.c_str(); });
743 sanitizeDiagOpts(*DiagOpts);
747 DependencyScanningAction Action(Service, WorkingDirectory, Consumer,
748 Controller, DepFS, ModuleName);
751 if (CommandLine[1] ==
"-cc1") {
753 PCHContainerOps, *Diags, Consumer);
756 CommandLine, *Diags, FS, [&](
const driver::Command &Cmd) {
767 std::vector<std::string> Argv;
776 PCHContainerOps, *Diags, Consumer);
780 if (
Success && !Action.hasScanned())
781 Diags->
Report(diag::err_fe_expected_compiler_job)
782 << llvm::join(CommandLine,
" ");
785 if (!Action.hasDiagConsumerFinished())
788 return Success && Action.hasScanned();
792 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
796 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
798 std::optional<std::vector<std::string>> ModifiedCommandLine;
806 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
808 llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
809 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
810 auto InputPath = TUBuffer->getBufferIdentifier();
813 llvm::MemoryBuffer::getMemBufferCopy(TUBuffer->getBuffer()));
817 OverlayFS->pushOverlay(InMemoryOverlay);
818 ModifiedFS = OverlayFS;
819 ModifiedCommandLine = CommandLine;
820 ModifiedCommandLine->emplace_back(InputPath);
823 const std::vector<std::string> &FinalCommandLine =
824 ModifiedCommandLine ? *ModifiedCommandLine : CommandLine;
825 auto &FinalFS = ModifiedFS ? ModifiedFS : BaseFS;
827 return scanDependencies(WorkingDirectory, FinalCommandLine, Consumer,
828 Controller, DC, FinalFS, std::nullopt);
832 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
836 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
842 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
843 auto InMemoryFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
844 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
847 llvm::sys::fs::createUniquePath(ModuleName +
"-%%%%%%%%.input", FakeInputPath,
849 InMemoryFS->addFile(FakeInputPath, 0, llvm::MemoryBuffer::getMemBuffer(
""));
852 OverlayFS->pushOverlay(InMemoryOverlay);
853 auto ModifiedCommandLine = CommandLine;
854 ModifiedCommandLine.emplace_back(FakeInputPath);
856 return scanDependencies(WorkingDirectory, ModifiedCommandLine, Consumer,
857 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)
int __ovld __cnfn any(char)
Returns 1 if the most significant bit in any component of x is set; otherwise returns 0.