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) {
397 if (
any(Service.getOptimizeArgs() & ScanningOptimizations::Macros))
398 canonicalizeDefines(Invocation->getPreprocessorOpts());
401 CompilerInvocation OriginalInvocation(*Invocation);
408 setLastCC1Arguments(std::move(OriginalInvocation));
416 ScanInstanceStorage.emplace(std::move(Invocation),
417 std::move(PCHContainerOps), ModCache.get());
418 CompilerInstance &ScanInstance = *ScanInstanceStorage;
425 assert(!DiagConsumerFinished &&
"attempt to reuse finished consumer");
435 Service.getBuildSessionTimestamp();
445 any(Service.getOptimizeArgs() & ScanningOptimizations::VFS);
452 DepFS->resetBypassedPathPrefix();
454 SmallString<256> ModulesCachePath;
458 DepFS->setBypassedPathPrefix(ModulesCachePath);
462 std::make_unique<ScanningDependencyDirectivesGetter>(*FileMgr));
470 llvm::SmallVector<StringRef> StableDirs;
472 if (!Sysroot.empty() &&
473 (llvm::sys::path::root_directory(Sysroot) != Sysroot))
483 if (visitPrebuiltModule(
487 PrebuiltModulesASTMap, ScanInstance.
getDiagnostics(), StableDirs))
497 auto Opts = std::make_unique<DependencyOutputOptions>();
501 if (Opts->Targets.empty())
505 Opts->IncludeSystemHeaders =
true;
507 switch (Service.getFormat()) {
508 case ScanningOutputFormat::Make:
510 std::make_shared<DependencyConsumerForwarder>(
511 std::move(Opts), WorkingDirectory, Consumer));
513 case ScanningOutputFormat::P1689:
514 case ScanningOutputFormat::Full:
515 MDC = std::make_shared<ModuleDepCollector>(
516 Service, std::move(Opts), ScanInstance, Consumer, Controller,
517 OriginalInvocation, std::move(PrebuiltModulesASTMap), StableDirs);
538 std::unique_ptr<FrontendAction> Action;
540 if (Service.getFormat() == ScanningOutputFormat::P1689)
541 Action = std::make_unique<PreprocessOnlyAction>();
543 Action = std::make_unique<GetDependenciesByModuleNameAction>(*ModuleName);
545 Action = std::make_unique<ReadPCHAndPreprocessAction>();
553 DiagConsumerFinished =
true;
556 setLastCC1Arguments(std::move(OriginalInvocation));
561 bool hasScanned()
const {
return Scanned; }
562 bool hasDiagConsumerFinished()
const {
return DiagConsumerFinished; }
567 std::vector<std::string> takeLastCC1Arguments() {
568 std::vector<std::string>
Result;
569 std::swap(
Result, LastCC1Arguments);
574 void setLastCC1Arguments(CompilerInvocation &&CI) {
576 MDC->applyDiscoveredDependencies(CI);
577 LastCC1Arguments = CI.getCC1CommandLine();
580 DependencyScanningService &Service;
581 StringRef WorkingDirectory;
582 DependencyConsumer &Consumer;
583 DependencyActionController &Controller;
584 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS;
585 std::optional<StringRef> ModuleName;
586 std::optional<CompilerInstance> ScanInstanceStorage;
587 std::shared_ptr<ModuleDepCollector> MDC;
588 std::vector<std::string> LastCC1Arguments;
589 bool Scanned =
false;
590 bool DiagConsumerFinished =
false;
599 PCHContainerOps = std::make_shared<PCHContainerOperations>();
601 PCHContainerOps->registerReader(
602 std::make_unique<ObjectFilePCHContainerReader>());
604 PCHContainerOps->registerWriter(std::make_unique<RawPCHContainerWriter>());
606 if (Service.shouldTraceVFS())
607 FS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(std::move(FS));
609 switch (Service.getMode()) {
611 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
612 Service.getSharedCache(), FS);
622static std::unique_ptr<DiagnosticOptions>
624 std::vector<const char *> CLI;
625 for (
const std::string &Arg : CommandLine)
626 CLI.push_back(Arg.c_str());
628 sanitizeDiagOpts(*DiagOpts);
633 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
635 std::optional<llvm::MemoryBufferRef> TUBuffer) {
638 std::string DiagnosticOutput;
639 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
644 DiagPrinter, TUBuffer))
645 return llvm::Error::success();
646 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
647 llvm::inconvertibleErrorCode());
651 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
653 StringRef ModuleName) {
656 std::string DiagnosticOutput;
657 llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
662 DiagPrinter, ModuleName))
663 return llvm::Error::success();
664 return llvm::make_error<llvm::StringError>(DiagnosticsOS.str(),
665 llvm::inconvertibleErrorCode());
673 Argv.reserve(ArgStrs.size());
674 for (
const std::string &Arg : ArgStrs)
675 Argv.push_back(Arg.c_str());
677 std::unique_ptr<driver::Driver> Driver = std::make_unique<driver::Driver>(
678 Argv[0], llvm::sys::getDefaultTargetTriple(), Diags,
679 "clang LLVM compiler", FS);
680 Driver->setTitle(
"clang_based_tool");
682 llvm::BumpPtrAllocator Alloc;
688 Diags.
Report(diag::err_drv_expand_response_file)
689 << llvm::toString(std::move(E));
693 const std::unique_ptr<driver::Compilation> Compilation(
698 if (Compilation->containsError())
709 std::vector<std::string> CommandLine, DependencyScanningAction &Action,
711 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
715 std::string Executable = CommandLine[0];
717 llvm::opt::ArgStringList Argv;
718 for (
const std::string &Str :
ArrayRef(CommandLine).drop_front())
719 Argv.push_back(Str.c_str());
721 auto Invocation = std::make_shared<CompilerInvocation>();
727 if (!Action.runInvocation(std::move(Invocation), std::move(FS),
731 std::vector<std::string> Args = Action.takeLastCC1Arguments();
736bool DependencyScanningWorker::scanDependencies(
737 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
739 DiagnosticConsumer &DC, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
740 std::optional<StringRef> ModuleName) {
741 std::vector<const char *> CCommandLine(CommandLine.size(),
nullptr);
742 llvm::transform(CommandLine, CCommandLine.begin(),
743 [](
const std::string &Str) { return Str.c_str(); });
745 sanitizeDiagOpts(*DiagOpts);
749 DependencyScanningAction Action(Service, WorkingDirectory, Consumer,
750 Controller, DepFS, ModuleName);
753 if (CommandLine[1] ==
"-cc1") {
755 PCHContainerOps, *Diags, Consumer);
758 CommandLine, *Diags, FS, [&](
const driver::Command &Cmd) {
769 std::vector<std::string> Argv;
778 PCHContainerOps, *Diags, Consumer);
782 if (
Success && !Action.hasScanned())
783 Diags->
Report(diag::err_fe_expected_compiler_job)
784 << llvm::join(CommandLine,
" ");
787 if (!Action.hasDiagConsumerFinished())
790 return Success && Action.hasScanned();
794 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
798 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
800 std::optional<std::vector<std::string>> ModifiedCommandLine;
808 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
810 llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
811 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
812 auto InputPath = TUBuffer->getBufferIdentifier();
815 llvm::MemoryBuffer::getMemBufferCopy(TUBuffer->getBuffer()));
819 OverlayFS->pushOverlay(InMemoryOverlay);
820 ModifiedFS = OverlayFS;
821 ModifiedCommandLine = CommandLine;
822 ModifiedCommandLine->emplace_back(InputPath);
825 const std::vector<std::string> &FinalCommandLine =
826 ModifiedCommandLine ? *ModifiedCommandLine : CommandLine;
827 auto &FinalFS = ModifiedFS ? ModifiedFS : BaseFS;
829 return scanDependencies(WorkingDirectory, FinalCommandLine, Consumer,
830 Controller, DC, FinalFS, std::nullopt);
834 StringRef WorkingDirectory,
const std::vector<std::string> &CommandLine,
838 BaseFS->setCurrentWorkingDirectory(WorkingDirectory);
844 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
845 auto InMemoryFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
846 InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);
849 llvm::sys::fs::createUniquePath(ModuleName +
"-%%%%%%%%.input", FakeInputPath,
851 InMemoryFS->addFile(FakeInputPath, 0, llvm::MemoryBuffer::getMemBuffer(
""));
854 OverlayFS->pushOverlay(InMemoryOverlay);
855 auto ModifiedCommandLine = CommandLine;
856 ModifiedCommandLine.emplace_back(FakeInputPath);
858 return scanDependencies(WorkingDirectory, ModifiedCommandLine, Consumer,
859 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.
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.
FileManager & getFileManager() const
Return the current file manager to the caller.
ModuleCache & getModuleCache() const
void addDependencyCollector(std::shared_ptr< DependencyCollector > Listener)
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()
bool hasDiagnostics() const
HeaderSearchOptions & getHeaderSearchOpts()
CompilerInvocation & getInvocation()
PreprocessorOptions & getPreprocessorOpts()
FileManager * createFileManager()
Create the file manager and replace any existing one with it.
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.
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.