15#include "llvm/ADT/STLExtras.h"
16#include "llvm/Support/BLAKE3.h"
26 for (StringRef FileDep : FileDeps) {
27 auto ResolvedFileDep =
36 assert(!std::holds_alternative<std::monostate>(BuildInfo) &&
37 "Using uninitialized ModuleDeps");
38 if (
const auto *CI = std::get_if<CowCompilerInvocation>(&BuildInfo))
39 BuildInfo = CI->getCC1CommandLine();
40 return std::get<std::vector<std::string>>(BuildInfo);
46 for (
const auto Dep : ModuleFileDependents) {
49 PrebuiltModulesMap[Dep].updateDependentsNotInStableDirs(PrebuiltModulesMap);
60 std::vector<HeaderSearchOptions::Entry> Entries;
63 llvm::BitVector SearchPathUsage(Entries.size());
64 llvm::DenseSet<const serialization::ModuleFile *> Visited;
70 if (!Visited.contains(
Import))
75 if (SearchPathUsage.size() != Entries.size())
76 llvm::report_fatal_error(
77 "Inconsistent search path options between modules detected");
79 for (
auto Idx : SearchPathUsage.set_bits())
80 Opts.
UserEntries.push_back(std::move(Entries[Idx]));
83 std::vector<std::string> VFSOverlayFiles;
86 llvm::BitVector VFSUsage(VFSOverlayFiles.size());
87 llvm::DenseSet<const serialization::ModuleFile *> Visited;
96 if (!Visited.contains(
Import))
101 auto PrebuiltModulePropIt =
102 PrebuiltModulesASTMap.find(MF->
FileName);
103 if (PrebuiltModulePropIt == PrebuiltModulesASTMap.end())
105 for (std::size_t I = 0, E = VFSOverlayFiles.size(); I != E; ++I) {
106 if (PrebuiltModulePropIt->second.getVFS().contains(
114 if (VFSUsage.size() != VFSOverlayFiles.size())
115 llvm::report_fatal_error(
116 "Inconsistent -ivfsoverlay options between modules detected");
118 for (
auto Idx : VFSUsage.set_bits())
124 bool IsSystemModule) {
129 bool Wsystem_headers =
false;
130 for (StringRef Opt : Opts.
Warnings) {
131 bool isPositive = !Opt.consume_front(
"no-");
132 if (Opt ==
"system-headers")
133 Wsystem_headers = isPositive;
151static std::vector<std::string>
splitString(std::string S,
char Separator) {
153 StringRef(S).split(Segments, Separator, -1,
false);
154 std::vector<std::string> Result;
155 Result.reserve(Segments.size());
156 for (StringRef Segment : Segments)
157 Result.push_back(Segment.str());
161void ModuleDepCollector::addOutputPaths(CowCompilerInvocation &CI,
167 Controller.lookupModuleOutput(
207 const StringRef Input) {
208 using namespace llvm::sys;
210 if (!path::is_absolute(Input))
213 auto PathStartsWith = [](StringRef Prefix, StringRef Path) {
214 auto PrefixIt = path::begin(Prefix), PrefixEnd = path::end(Prefix);
215 for (
auto PathIt = path::begin(Path), PathEnd = path::end(Path);
216 PrefixIt != PrefixEnd && PathIt != PathEnd; ++PrefixIt, ++PathIt) {
217 if (*PrefixIt != *PathIt)
220 return PrefixIt == PrefixEnd;
223 return any_of(Directories, [&](StringRef Dir) {
224 return !Dir.empty() && PathStartsWith(Dir, Input);
231 "Sysroots differ between module dependencies and current TU");
234 "ResourceDirs differ between module dependencies and current TU");
237 if (!Entry.IgnoreSysRoot)
291 [&CI](
const std::pair<std::string, bool> &Def) {
292 StringRef MacroDef = Def.first;
293 return CI.getHeaderSearchOpts().ModulesIgnoreMacros.contains(
294 llvm::CachedHashString(MacroDef.split(
'=').first));
304ModuleDepCollector::getInvocationAdjustedForModuleBuildWithoutOutputs(
306 llvm::function_ref<
void(CowCompilerInvocation &)> Optimize)
const {
307 CowCompilerInvocation CI = CommonInvocation;
318 auto CurrentModuleMapEntry =
320 assert(CurrentModuleMapEntry &&
"module map file entry not found");
329 auto ModuleMapEntry =
330 ScanInstance.getFileManager().getOptionalFileRef(ModuleMapFile);
331 assert(ModuleMapEntry &&
"module map file entry not found");
338 if (Service.shouldEagerLoadModules() &&
339 DepModuleMapFiles.contains(*ModuleMapEntry))
344 if (*ModuleMapEntry == *CurrentModuleMapEntry &&
345 !DepModuleMapFiles.contains(*ModuleMapEntry))
372llvm::DenseSet<const FileEntry *> ModuleDepCollector::collectModuleMapFiles(
373 ArrayRef<ModuleID> ClangModuleDeps)
const {
374 llvm::DenseSet<const FileEntry *> ModuleMapFiles;
375 for (
const ModuleID &MID : ClangModuleDeps) {
376 ModuleDeps *MD = ModuleDepsByID.lookup(MID);
377 assert(MD &&
"Inconsistent dependency info");
379 auto FE = ScanInstance.getFileManager().getOptionalFileRef(
381 assert(FE &&
"Missing module map file that was previously found");
382 ModuleMapFiles.insert(*FE);
384 return ModuleMapFiles;
387void ModuleDepCollector::addModuleMapFiles(
388 CompilerInvocation &CI, ArrayRef<ModuleID> ClangModuleDeps)
const {
389 if (Service.shouldEagerLoadModules())
392 for (
const ModuleID &MID : ClangModuleDeps) {
393 ModuleDeps *MD = ModuleDepsByID.lookup(MID);
394 assert(MD &&
"Inconsistent dependency info");
399void ModuleDepCollector::addModuleFiles(
400 CompilerInvocation &CI, ArrayRef<ModuleID> ClangModuleDeps)
const {
401 for (
const ModuleID &MID : ClangModuleDeps) {
402 ModuleDeps *MD = ModuleDepsByID.lookup(MID);
403 std::string PCMPath =
406 if (Service.shouldEagerLoadModules())
410 {MID.ModuleName, std::move(PCMPath)});
414void ModuleDepCollector::addModuleFiles(
415 CowCompilerInvocation &CI, ArrayRef<ModuleID> ClangModuleDeps)
const {
416 for (
const ModuleID &MID : ClangModuleDeps) {
417 ModuleDeps *MD = ModuleDepsByID.lookup(MID);
418 std::string PCMPath =
421 if (Service.shouldEagerLoadModules())
425 {MID.ModuleName, std::move(PCMPath)});
453 CurrentModuleMap->getNameAsRequested());
456 for (
const auto &KV : ModularDeps)
457 if (DirectModularDeps.contains(KV.first))
458 DirectDeps.push_back(KV.second->ID);
461 addModuleMapFiles(CI, DirectDeps);
463 addModuleFiles(CI, DirectDeps);
465 for (
const auto &KV : DirectPrebuiltModularDeps)
474#define IF_RELATIVE_RETURN_FALSE(PATH) \
476 if (!PATH.empty() && !llvm::sys::path::is_absolute(PATH)) \
480#define IF_ANY_RELATIVE_RETURN_FALSE(PATHS) \
482 if (llvm::any_of(PATHS, [](const auto &P) { \
483 return !P.empty() && !llvm::sys::path::is_absolute(P); \
491 for (
auto &Entry : HeaderSearchOpts.UserEntries)
492 if (Entry.IgnoreSysRoot)
497 for (
auto I = HeaderSearchOpts.PrebuiltModuleFiles.begin(),
498 E = HeaderSearchOpts.PrebuiltModuleFiles.end();
555 llvm::vfs::FileSystem &
VFS) {
556 llvm::HashBuilder<llvm::TruncatedBLAKE3<16>, llvm::endianness::native>
563 llvm::ErrorOr<std::string> CWD =
VFS.getCurrentWorkingDirectory();
565 HashBuilder.add(*CWD);
569 ArgVec.reserve(4096);
571 Arg.toVector(ArgVec);
572 ArgVec.push_back(
'\0');
574 HashBuilder.add(ArgVec);
582 HashBuilder.add(ID.ModuleName);
583 HashBuilder.add(ID.ContextHash);
586 HashBuilder.add(EagerLoadModules);
588 llvm::BLAKE3Result<16> Hash = HashBuilder.final();
589 std::array<uint64_t, 2> Words;
590 static_assert(
sizeof(Hash) ==
sizeof(Words),
"Hash must match Words");
591 std::memcpy(Words.data(), Hash.data(),
sizeof(Hash));
592 return toString(llvm::APInt(
sizeof(Words) * 8, Words), 36,
false);
595void ModuleDepCollector::associateWithContextHash(
599 IgnoreCWD, ScanInstance.getVirtualFileSystem());
600 bool Inserted = ModuleDepsByID.insert({Deps.
ID, &Deps}).second;
602 assert(Inserted &&
"duplicate module mapping");
618 if (std::optional<StringRef> Filename =
SM.getNonBuiltinFilenameForID(FID))
619 MDC.addFileDep(llvm::sys::path::remove_leading_dotslash(*Filename));
625 StringRef SearchPath, StringRef RelativePath,
const Module *SuggestedModule,
627 if (!
File && !ModuleImported) {
632 handleImport(SuggestedModule);
638 if (MDC.ScanInstance.getPreprocessor().isInImportingCXXNamedModules()) {
640 RequiredModule.
ModuleName = Path[0].getIdentifierInfo()->getName().str();
642 MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule));
646 handleImport(Imported);
649void ModuleDepCollectorPP::handleImport(
const Module *Imported) {
655 if (MDC.isPrebuiltModule(TopLevelModule))
656 MDC.DirectPrebuiltModularDeps.insert(
659 MDC.DirectModularDeps.insert(TopLevelModule);
660 MDC.DirectImports.insert(Imported);
665 FileID MainFileID = MDC.ScanInstance.getSourceManager().getMainFileID();
666 MDC.MainFile = std::string(MDC.ScanInstance.getSourceManager()
667 .getFileEntryRefForID(MainFileID)
670 auto &PP = MDC.ScanInstance.getPreprocessor();
671 if (PP.isInNamedModule()) {
673 ProvidedModule.
ModuleName = PP.getNamedModuleName();
679 if (PP.isInImplementationUnit())
680 MDC.RequiredStdCXXModules.push_back(ProvidedModule);
682 MDC.ProvidedStdCXXModule = ProvidedModule;
685 if (!MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude.empty())
686 MDC.addFileDep(MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude);
689 MDC.ScanInstance.getPreprocessor().getAffectingClangModules())
690 if (!MDC.isPrebuiltModule(M))
691 MDC.DirectModularDeps.insert(M);
693 MDC.addVisibleModules();
695 for (
const Module *M : MDC.DirectModularDeps)
696 handleTopLevelModule(M);
698 MDC.Consumer.handleContextHash(
699 MDC.ScanInstance.getInvocation().getModuleHash());
701 MDC.Consumer.handleDependencyOutputOpts(*MDC.Opts);
703 MDC.Consumer.handleProvidedAndRequiredStdCXXModules(
704 MDC.ProvidedStdCXXModule, MDC.RequiredStdCXXModules);
706 for (
auto &&I : MDC.ModularDeps)
707 MDC.Consumer.handleModuleDependency(*I.second);
709 for (
const Module *M : MDC.DirectModularDeps) {
710 auto It = MDC.ModularDeps.find(M);
712 if (It != MDC.ModularDeps.end())
713 MDC.Consumer.handleDirectModuleDependency(It->second->ID);
716 for (
auto &&I : MDC.VisibleModules)
717 MDC.Consumer.handleVisibleModule(std::string(I.getKey()));
719 for (
auto &&I : MDC.FileDeps)
720 MDC.Consumer.handleFileDependency(I);
722 for (
auto &&I : MDC.DirectPrebuiltModularDeps)
723 MDC.Consumer.handlePrebuiltModuleDependency(I.second);
726std::optional<ModuleID>
727ModuleDepCollectorPP::handleTopLevelModule(
const Module *M) {
738 if (
auto ModI = MDC.ModularDeps.find(M); ModI != MDC.ModularDeps.end())
739 return ModI->second->ID;
741 auto OwnedMD = std::make_unique<ModuleDeps>();
767 MDC.ScanInstance.
getASTReader()->getModuleManager().lookup(
783 llvm::DenseSet<const Module *> SeenDeps;
784 addAllSubmodulePrebuiltDeps(M, MD, SeenDeps);
785 addAllSubmoduleDeps(M, MD, SeenDeps);
786 addAllAffectingClangModules(M, MD, SeenDeps);
789 PathBuf.reserve(256);
802 "__inferred_module.map"))
811 CowCompilerInvocation CI =
812 MDC.getInvocationAdjustedForModuleBuildWithoutOutputs(
813 MD, [&](CowCompilerInvocation &BuildInvocation) {
814 if (
any(MDC.Service.getOptimizeArgs() &
818 *MDC.ScanInstance.getASTReader(), *MF,
819 MDC.PrebuiltModulesASTMap,
820 MDC.Service.getOptimizeArgs());
822 if (
any(MDC.Service.getOptimizeArgs() &
832 llvm::ErrorOr<std::string> CWD =
833 MDC.ScanInstance.getVirtualFileSystem()
834 .getCurrentWorkingDirectory();
846 MDC.associateWithContextHash(CI,
IgnoreCWD, MD);
849 MDC.addOutputPaths(CI, MD);
851 MD.BuildInfo = std::move(CI);
853 MDC.ModularDeps.insert({M, std::move(OwnedMD)});
859 llvm::function_ref<
void(
const Module *)> F) {
864 llvm::stable_sort(Submodules, [](
const Module *A,
const Module *B) {
867 for (
const Module *SubM : Submodules)
871void ModuleDepCollectorPP::addAllSubmodulePrebuiltDeps(
873 llvm::DenseSet<const Module *> &SeenSubmodules) {
874 addModulePrebuiltDeps(M, MD, SeenSubmodules);
877 addAllSubmodulePrebuiltDeps(SubM, MD, SeenSubmodules);
881void ModuleDepCollectorPP::addModulePrebuiltDeps(
883 llvm::DenseSet<const Module *> &SeenSubmodules) {
886 if (MDC.isPrebuiltModule(
Import->getTopLevelModule()))
887 if (SeenSubmodules.insert(
Import->getTopLevelModule()).second) {
890 auto PrebuiltModulePropIt = MDC.PrebuiltModulesASTMap.find(
893 (PrebuiltModulePropIt != MDC.PrebuiltModulesASTMap.end()) &&
894 PrebuiltModulePropIt->second.isInStableDir();
899void ModuleDepCollectorPP::addAllSubmoduleDeps(
901 llvm::DenseSet<const Module *> &AddedModules) {
902 addModuleDep(M, MD, AddedModules);
905 addAllSubmoduleDeps(SubM, MD, AddedModules);
909void ModuleDepCollectorPP::addOneModuleDep(
const Module *M,
const ModuleID ID,
916void ModuleDepCollectorPP::addModuleDep(
918 llvm::DenseSet<const Module *> &AddedModules) {
921 !MDC.isPrebuiltModule(
Import)) {
922 if (
auto ImportID = handleTopLevelModule(
Import->getTopLevelModule()))
923 if (AddedModules.insert(
Import->getTopLevelModule()).second)
924 addOneModuleDep(
Import->getTopLevelModule(), *ImportID, MD);
929void ModuleDepCollectorPP::addAllAffectingClangModules(
931 llvm::DenseSet<const Module *> &AddedModules) {
932 addAffectingClangModule(M, MD, AddedModules);
935 addAllAffectingClangModules(SubM, MD, AddedModules);
938void ModuleDepCollectorPP::addAffectingClangModule(
940 llvm::DenseSet<const Module *> &AddedModules) {
943 "Not quite import not top-level module");
945 !MDC.isPrebuiltModule(Affecting)) {
946 if (
auto ImportID = handleTopLevelModule(Affecting))
947 if (AddedModules.insert(Affecting).second)
948 addOneModuleDep(Affecting, *ImportID, MD);
955 std::unique_ptr<DependencyOutputOptions> Opts,
960 : Service(Service), ScanInstance(ScanInstance), Consumer(
C),
961 Controller(Controller),
962 PrebuiltModulesASTMap(
std::move(PrebuiltModulesASTMap)),
963 StableDirs(StableDirs), Opts(
std::move(Opts)),
973bool ModuleDepCollector::isPrebuiltModule(
const Module *M) {
975 const auto &PrebuiltModuleFiles =
977 auto PrebuiltModuleFileIt = PrebuiltModuleFiles.find(Name);
978 if (PrebuiltModuleFileIt == PrebuiltModuleFiles.end())
980 assert(
"Prebuilt module came from the expected AST file" &&
985void ModuleDepCollector::addVisibleModules() {
986 llvm::DenseSet<const Module *> ImportedModules;
987 auto InsertVisibleModules = [&](
const Module *M) {
988 if (ImportedModules.contains(M))
994 while (!Stack.empty()) {
995 const Module *CurrModule = Stack.pop_back_val();
996 if (ImportedModules.contains(CurrModule))
998 ImportedModules.insert(CurrModule);
1005 InsertVisibleModules(
Import);
1010 if (llvm::sys::path::is_absolute(Path) &&
1011 !llvm::sys::path::is_style_windows(llvm::sys::path::Style::native))
1013 Storage.assign(Path.begin(), Path.end());
1015 llvm::sys::path::make_preferred(Storage);
1016 return StringRef(Storage.data(), Storage.size());
1019void ModuleDepCollector::addFileDep(StringRef Path) {
1023 FileDeps.emplace_back(Path);
1027 llvm::SmallString<256>
Storage;
1029 FileDeps.emplace_back(Path);
1032void ModuleDepCollector::addFileDep(
ModuleDeps &MD, StringRef Path) {
1033 MD.FileDeps.emplace_back(Path);
static std::vector< std::string > splitString(std::string S, char Separator)
static void optimizeHeaderSearchOpts(HeaderSearchOptions &Opts, ASTReader &Reader, const serialization::ModuleFile &MF, const PrebuiltModulesAttrsMap &PrebuiltModulesASTMap, ScanningOptimizations OptimizeArgs)
static void optimizeDiagnosticOpts(DiagnosticOptions &Opts, bool IsSystemModule)
static StringRef makeAbsoluteAndPreferred(CompilerInstance &CI, StringRef Path, SmallVectorImpl< char > &Storage)
#define IF_RELATIVE_RETURN_FALSE(PATH)
static CowCompilerInvocation makeCommonInvocationForModuleBuild(CompilerInvocation CI)
static void forEachSubmoduleSorted(const Module *M, llvm::function_ref< void(const Module *)> F)
static bool needsModules(FrontendInputFile FIF)
static bool isSafeToIgnoreCWD(const CowCompilerInvocation &CI)
#define IF_ANY_RELATIVE_RETURN_FALSE(PATHS)
static std::string getModuleContextHash(const ModuleDeps &MD, const CowCompilerInvocation &CI, bool EagerLoadModules, bool IgnoreCWD, llvm::vfs::FileSystem &VFS)
static void optimizeCWD(CowCompilerInvocation &BuildInvocation, StringRef CWD)
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Reads an AST files chain containing the contents of a translation unit.
static TemporarilyOwnedStringRef ResolveImportedPath(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
Represents a character-granular source range.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
std::string CoverageNotesFile
The filename with path we use for coverage notes files.
std::string ProfileInstrumentUsePath
Name of the profile file to use as input for -fprofile-instr-use.
std::string SampleProfileFile
Name of the profile file to use with -fprofile-sample-use.
std::string CoverageDataFile
The filename with path we use for coverage data files.
std::string DebugCompilationDir
The string to embed in debug information as the current working directory.
std::string MainFileName
The user provided name for the "main file", if non-empty.
std::string CoverageCompilationDir
The string to embed in coverage mapping as the current working directory.
std::string ProfileRemappingFile
Name of the profile remapping file to apply to the profile data supplied by -fprofile-sample-use or -...
std::string DwarfDebugFlags
The string to embed in the debug information for the compile unit, if non-empty.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
FileManager & getFileManager() const
Return the current file manager to the caller.
IntrusiveRefCntPtr< ASTReader > getASTReader() const
Preprocessor & getPreprocessor() const
Return the current preprocessor.
HeaderSearchOptions & getHeaderSearchOpts()
const FrontendOptions & getFrontendOpts() const
const CodeGenOptions & getCodeGenOpts() const
const FileSystemOptions & getFileSystemOpts() const
void generateCC1CommandLine(llvm::SmallVectorImpl< const char * > &Args, StringAllocator SA) const
Generate cc1-compatible command line arguments from this instance.
const DependencyOutputOptions & getDependencyOutputOpts() const
const HeaderSearchOptions & getHeaderSearchOpts() const
const PreprocessorOptions & getPreprocessorOpts() const
const DiagnosticOptions & getDiagnosticOpts() const
const LangOptions & getLangOpts() const
Const getters.
Helper class for holding the data necessary to invoke the compiler.
PreprocessorOptions & getPreprocessorOpts()
void clearImplicitModuleBuildOptions()
Disable implicit modules and canonicalize options that are only used by implicit modules.
LangOptions & getLangOpts()
Mutable getters.
DependencyOutputOptions & getDependencyOutputOpts()
void resetNonModularOptions()
Reset all of the options that are not considered when building a module.
FrontendOptions & getFrontendOpts()
CodeGenOptions & getCodeGenOpts()
HeaderSearchOptions & getHeaderSearchOpts()
DiagnosticOptions & getDiagnosticOpts()
Same as CompilerInvocation, but with copy-on-write optimization.
FrontendOptions & getMutFrontendOpts()
LangOptions & getMutLangOpts()
Mutable getters.
HeaderSearchOptions & getMutHeaderSearchOpts()
CodeGenOptions & getMutCodeGenOpts()
FileSystemOptions & getMutFileSystemOpts()
DiagnosticOptions & getMutDiagnosticOpts()
DependencyOutputOptions & getMutDependencyOutputOpts()
std::string OutputFile
The file to write dependency output to.
std::vector< std::string > Targets
A list of names to use as the targets in the dependency file; this list must contain at least one ent...
std::vector< std::pair< std::string, ExtraDepKind > > ExtraDeps
A list of extra dependencies (filename and kind) to be used for every target.
Options for controlling the compiler diagnostics engine.
std::vector< std::string > Remarks
The list of -R... options used to alter the diagnostic mappings, with the prefixes removed.
std::vector< std::string > Warnings
The list of -W... options used to alter the diagnostic mappings, with the prefixes removed.
std::vector< std::string > UndefPrefixes
The list of prefixes from -Wundef-prefix=... used to generate warnings for undefined macros.
std::vector< std::string > SystemHeaderWarningsModules
The list of -Wsystem-headers-in-module=... options used to override whether -Wsystem-headers is enabl...
std::string DiagnosticSerializationFile
The file to serialize diagnostics to (non-appending).
StringRef getName() const
The name of this FileEntry.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
bool makeAbsolutePath(SmallVectorImpl< char > &Path) const
Makes Path absolute taking into account FileSystemOptions and the working directory option.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
InputKind DashX
The input kind, either specified via -x argument or deduced from the input file name.
std::vector< std::string > ModuleFiles
The list of additional prebuilt module files to load before processing the input.
unsigned IsSystemModule
When using -emit-module, treat the modulemap as a system module.
std::vector< std::string > LLVMArgs
A list of arguments to forward to LLVM's option processing; this should only be used for debugging an...
std::string OutputFile
The output file, if any.
unsigned GenReducedBMI
Whether to generate reduced BMI for C++20 named modules.
std::string ModuleOutputPath
Output Path for module output file.
SmallVector< FrontendInputFile, 0 > Inputs
The input files and their types.
frontend::ActionKind ProgramAction
The frontend action to perform.
std::vector< std::string > ModuleMapFiles
The list of module map files to load before processing the input.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::string ModuleName
The module currently being compiled as specified by -fmodule-name.
std::vector< std::string > NoSanitizeFiles
Paths to files specifying which objects (files, functions, variables) should not be instrumented.
OptionalFileEntryRef getModuleMapFileForUniquing(const Module *M) const
std::error_code canonicalizeModuleMapPath(SmallVectorImpl< char > &Path)
Canonicalize Path in a manner suitable for a module map file.
Describes a module or submodule.
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers).
std::string Name
The name of this module.
llvm::iterator_range< submodule_iterator > submodules()
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used.
llvm::SmallSetVector< Module *, 2 > AffectingClangModules
The set of top-level modules that affected the compilation of this module, but were not imported.
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
OptionalFileEntryRef getASTFile() const
The serialized AST file for this module, if one was created.
bool UseExportAsModuleLinkName
Autolinking uses the framework name for linking purposes when this is false and the export_as name ot...
std::vector< std::pair< std::string, bool > > Macros
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void addPPCallbacks(std::unique_ptr< PPCallbacks > C)
Module * getCurrentModuleImplementation()
Retrieves the module whose implementation we're current compiling, if any.
HeaderSearch & getHeaderSearchInfo() const
Encodes a location in the source.
This class handles loading and caching of source files into memory.
Token - This structure provides full information about a lexed token.
Information about a module that has been loaded by the ASTReader.
std::string FileName
The file name of the module file.
llvm::SetVector< ModuleFile * > Imports
List of modules which this module directly imported.
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
llvm::BitVector VFSUsage
The bit vector denoting usage of each VFS entry (true = used).
ModuleKind Kind
The type of this module.
std::string BaseDirectory
The base directory of the module.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
@ GeneratePCH
Generate pre-compiled header.
@ GenerateModule
Generate pre-compiled module from a module map.
const unsigned VERSION_MINOR
AST file minor version number supported by this version of Clang.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
@ MK_ImplicitModule
File is an implicitly-loaded module.
The JSON file list parser is used to communicate input to InstallAPI.
CustomizableOptional< FileEntryRef > OptionalFileEntryRef
void quoteMakeTarget(StringRef Target, SmallVectorImpl< char > &Res)
Quote target names for inclusion in GNU Make dependency files.
ArrayRef< IdentifierLoc > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
@ Asm
Assembly: we accept this only so that we can preprocess it.
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
int const char * function
int __ovld __cnfn any(char)
Returns 1 if the most significant bit in any component of x is set; otherwise returns 0.