#include "clang/Lex/ModuleMap.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <optional>
#include <string>
#include <system_error>
#include <utility>
usingnamespaceclang;
void ModuleMapCallbacks::anchor() { … }
void ModuleMap::resolveLinkAsDependencies(Module *Mod) { … }
void ModuleMap::addLinkAsDependency(Module *Mod) { … }
Module::HeaderKind ModuleMap::headerRoleToKind(ModuleHeaderRole Role) { … }
ModuleMap::ModuleHeaderRole
ModuleMap::headerKindToRole(Module::HeaderKind Kind) { … }
bool ModuleMap::isModular(ModuleHeaderRole Role) { … }
Module::ExportDecl
ModuleMap::resolveExport(Module *Mod,
const Module::UnresolvedExportDecl &Unresolved,
bool Complain) const { … }
Module *ModuleMap::resolveModuleId(const ModuleId &Id, Module *Mod,
bool Complain) const { … }
static void appendSubframeworkPaths(Module *Mod,
SmallVectorImpl<char> &Path) { … }
OptionalFileEntryRef ModuleMap::findHeader(
Module *M, const Module::UnresolvedHeaderDirective &Header,
SmallVectorImpl<char> &RelativePathName, bool &NeedsFramework) { … }
static bool isBuiltinHeaderName(StringRef FileName) { … }
static bool isBuiltInModuleName(StringRef ModuleName) { … }
void ModuleMap::resolveHeader(Module *Mod,
const Module::UnresolvedHeaderDirective &Header,
bool &NeedsFramework) { … }
bool ModuleMap::resolveAsBuiltinHeader(
Module *Mod, const Module::UnresolvedHeaderDirective &Header) { … }
ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
const LangOptions &LangOpts, const TargetInfo *Target,
HeaderSearch &HeaderInfo)
: … { … }
ModuleMap::~ModuleMap() { … }
void ModuleMap::setTarget(const TargetInfo &Target) { … }
static StringRef sanitizeFilenameAsIdentifier(StringRef Name,
SmallVectorImpl<char> &Buffer) { … }
bool ModuleMap::isBuiltinHeader(FileEntryRef File) { … }
bool ModuleMap::shouldImportRelativeToBuiltinIncludeDir(StringRef FileName,
Module *Module) const { … }
ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(FileEntryRef File) { … }
ModuleMap::KnownHeader ModuleMap::findHeaderInUmbrellaDirs(
FileEntryRef File, SmallVectorImpl<DirectoryEntryRef> &IntermediateDirs) { … }
static bool violatesPrivateInclude(Module *RequestingModule,
const FileEntry *IncFileEnt,
ModuleMap::KnownHeader Header) { … }
static Module *getTopLevelOrNull(Module *M) { … }
void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
bool RequestingModuleIsModuleInterface,
SourceLocation FilenameLoc,
StringRef Filename, FileEntryRef File) { … }
static bool isBetterKnownHeader(const ModuleMap::KnownHeader &New,
const ModuleMap::KnownHeader &Old) { … }
ModuleMap::KnownHeader ModuleMap::findModuleForHeader(FileEntryRef File,
bool AllowTextual,
bool AllowExcluded) { … }
ModuleMap::KnownHeader
ModuleMap::findOrCreateModuleForHeaderInUmbrellaDir(FileEntryRef File) { … }
ArrayRef<ModuleMap::KnownHeader>
ModuleMap::findAllModulesForHeader(FileEntryRef File) { … }
ArrayRef<ModuleMap::KnownHeader>
ModuleMap::findResolvedModulesForHeader(FileEntryRef File) const { … }
bool ModuleMap::isHeaderInUnavailableModule(FileEntryRef Header) const { … }
bool ModuleMap::isHeaderUnavailableInModule(
FileEntryRef Header, const Module *RequestingModule) const { … }
Module *ModuleMap::findModule(StringRef Name) const { … }
Module *ModuleMap::lookupModuleUnqualified(StringRef Name,
Module *Context) const { … }
Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{ … }
std::pair<Module *, bool> ModuleMap::findOrCreateModule(StringRef Name,
Module *Parent,
bool IsFramework,
bool IsExplicit) { … }
Module *ModuleMap::createGlobalModuleFragmentForModuleUnit(SourceLocation Loc,
Module *Parent) { … }
Module *
ModuleMap::createImplicitGlobalModuleFragmentForModuleUnit(SourceLocation Loc,
Module *Parent) { … }
Module *
ModuleMap::createPrivateModuleFragmentForInterfaceUnit(Module *Parent,
SourceLocation Loc) { … }
Module *ModuleMap::createModuleUnitWithKind(SourceLocation Loc, StringRef Name,
Module::ModuleKind Kind) { … }
Module *ModuleMap::createModuleForInterfaceUnit(SourceLocation Loc,
StringRef Name) { … }
Module *ModuleMap::createModuleForImplementationUnit(SourceLocation Loc,
StringRef Name) { … }
Module *ModuleMap::createHeaderUnit(SourceLocation Loc, StringRef Name,
Module::Header H) { … }
static void inferFrameworkLink(Module *Mod) { … }
Module *ModuleMap::inferFrameworkModule(DirectoryEntryRef FrameworkDir,
bool IsSystem, Module *Parent) { … }
Module *ModuleMap::inferFrameworkModule(DirectoryEntryRef FrameworkDir,
Attributes Attrs, Module *Parent) { … }
Module *ModuleMap::createShadowedModule(StringRef Name, bool IsFramework,
Module *ShadowingModule) { … }
void ModuleMap::setUmbrellaHeaderAsWritten(
Module *Mod, FileEntryRef UmbrellaHeader, const Twine &NameAsWritten,
const Twine &PathRelativeToRootModuleDirectory) { … }
void ModuleMap::setUmbrellaDirAsWritten(
Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten,
const Twine &PathRelativeToRootModuleDirectory) { … }
void ModuleMap::addUnresolvedHeader(Module *Mod,
Module::UnresolvedHeaderDirective Header,
bool &NeedsFramework) { … }
void ModuleMap::resolveHeaderDirectives(const FileEntry *File) const { … }
void ModuleMap::resolveHeaderDirectives(
Module *Mod, std::optional<const FileEntry *> File) const { … }
void ModuleMap::addHeader(Module *Mod, Module::Header Header,
ModuleHeaderRole Role, bool Imported) { … }
FileID ModuleMap::getContainingModuleMapFileID(const Module *Module) const { … }
OptionalFileEntryRef
ModuleMap::getContainingModuleMapFile(const Module *Module) const { … }
FileID ModuleMap::getModuleMapFileIDForUniquing(const Module *M) const { … }
OptionalFileEntryRef
ModuleMap::getModuleMapFileForUniquing(const Module *M) const { … }
void ModuleMap::setInferredModuleAllowedBy(Module *M, FileID ModMapFID) { … }
std::error_code
ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl<char> &Path) { … }
void ModuleMap::addAdditionalModuleMapFile(const Module *M,
FileEntryRef ModuleMap) { … }
LLVM_DUMP_METHOD void ModuleMap::dump() { … }
bool ModuleMap::resolveExports(Module *Mod, bool Complain) { … }
bool ModuleMap::resolveUses(Module *Mod, bool Complain) { … }
bool ModuleMap::resolveConflicts(Module *Mod, bool Complain) { … }
namespace clang {
struct MMToken { … };
class ModuleMapParser { … };
}
SourceLocation ModuleMapParser::consumeToken() { … }
void ModuleMapParser::skipUntil(MMToken::TokenKind K) { … }
bool ModuleMapParser::parseModuleId(ModuleId &Id) { … }
namespace {
enum AttributeKind { … };
}
void ModuleMapParser::diagnosePrivateModules(SourceLocation ExplicitLoc,
SourceLocation FrameworkLoc) { … }
void ModuleMapParser::parseModuleDecl() { … }
void ModuleMapParser::parseExternModuleDecl() { … }
static bool shouldAddRequirement(Module *M, StringRef Feature,
bool &IsRequiresExcludedHack) { … }
void ModuleMapParser::parseRequiresDecl() { … }
void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,
SourceLocation LeadingLoc) { … }
static bool compareModuleHeaders(const Module::Header &A,
const Module::Header &B) { … }
void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { … }
void ModuleMapParser::parseExportDecl() { … }
void ModuleMapParser::parseExportAsDecl() { … }
void ModuleMapParser::parseUseDecl() { … }
void ModuleMapParser::parseLinkDecl() { … }
void ModuleMapParser::parseConfigMacros() { … }
static std::string formatModuleId(const ModuleId &Id) { … }
void ModuleMapParser::parseConflict() { … }
void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { … }
bool ModuleMapParser::parseOptionalAttributes(Attributes &Attrs) { … }
bool ModuleMapParser::parseModuleMapFile() { … }
bool ModuleMap::parseModuleMapFile(FileEntryRef File, bool IsSystem,
DirectoryEntryRef Dir, FileID ID,
unsigned *Offset,
SourceLocation ExternModuleLoc) { … }