;
54voidModuleMapCallbacks::anchor() {}
57 autoPendingLinkAs = PendingLinkAsModule.find(Mod->
Name);
58 if(PendingLinkAs != PendingLinkAsModule.end()) {
59 for(
auto&Name : PendingLinkAs->second) {
62M->UseExportAsModuleLinkName =
true;
75 switch((
int)Role) {
87llvm_unreachable(
"unknown header role");
92 switch((
int)Kind) {
104llvm_unreachable(
"unknown header kind");
112ModuleMap::resolveExport(
Module*Mod,
114 boolComplain)
const{
117assert(
Unresolved.Wildcard &&
"Invalid unresolved export");
130 boolComplain)
const{
135Diags.
Report(
Id[0].second, diag::err_mmap_missing_module_unqualified)
142 for(
unsignedI = 1, N =
Id.size(); I != N; ++I) {
146Diags.
Report(
Id[I].second, diag::err_mmap_missing_module_qualified)
147<<
Id[I].first << Context->getFullModuleName()
165 for(; Mod; Mod = Mod->
Parent) {
167Paths.push_back(Mod->
Name);
174 for(StringRef Framework : llvm::drop_begin(llvm::reverse(Paths)))
175llvm::sys::path::append(
Path,
"Frameworks", Framework +
".framework");
195 unsignedFullPathLength = FullPathName.size();
197 unsignedRelativePathLength = RelativePathName.size();
200llvm::sys::path::append(RelativePathName,
"Headers", Header.
FileName);
201llvm::sys::path::append(FullPathName, RelativePathName);
202 if(
auto File= GetFile(FullPathName))
212RelativePathName.clear();
214RelativePathName.resize(RelativePathLength);
215FullPathName.resize(FullPathLength);
216llvm::sys::path::append(RelativePathName,
"PrivateHeaders",
218llvm::sys::path::append(FullPathName, RelativePathName);
219 returnGetFile(FullPathName);
222 if(llvm::sys::path::is_absolute(Header.
FileName)) {
223RelativePathName.clear();
224RelativePathName.append(Header.
FileName.begin(), Header.
FileName.end());
229 returnGetFrameworkFile();
232llvm::sys::path::append(RelativePathName, Header.
FileName);
233llvm::sys::path::append(FullPathName, RelativePathName);
234 autoNormalHdrFile = GetFile(FullPathName);
236 if(!NormalHdrFile && Directory->getName().ends_with(
".framework")) {
240FullPathName.assign(Directory->getName());
241RelativePathName.clear();
242 if(GetFrameworkFile()) {
244diag::warn_mmap_incomplete_framework_module_declaration)
246NeedsFramework =
true;
251 returnNormalHdrFile;
258 returnllvm::StringSwitch<bool>(
FileName)
259.Case(
"float.h",
true)
260.Case(
"iso646.h",
true)
261.Case(
"limits.h",
true)
262.Case(
"stdalign.h",
true)
263.Case(
"stdarg.h",
true)
264.Case(
"stdatomic.h",
true)
265.Case(
"stdbool.h",
true)
266.Case(
"stddef.h",
true)
267.Case(
"stdint.h",
true)
268.Case(
"tgmath.h",
true)
269.Case(
"unwind.h",
true)
276 returnllvm::StringSwitch<bool>(ModuleName)
277.Case(
"_Builtin_float",
true)
278.Case(
"_Builtin_inttypes",
true)
279.Case(
"_Builtin_iso646",
true)
280.Case(
"_Builtin_limits",
true)
281.Case(
"_Builtin_stdalign",
true)
282.Case(
"_Builtin_stdarg",
true)
283.Case(
"_Builtin_stdatomic",
true)
284.Case(
"_Builtin_stdbool",
true)
285.Case(
"_Builtin_stddef",
true)
286.Case(
"_Builtin_stdint",
true)
287.Case(
"_Builtin_stdnoreturn",
true)
288.Case(
"_Builtin_tgmath",
true)
289.Case(
"_Builtin_unwind",
true)
293voidModuleMap::resolveHeader(
Module*Mod,
295 bool&NeedsFramework) {
298findHeader(Mod, Header, RelativePathName, NeedsFramework)) {
301 if(
Module*UmbrellaMod = UmbrellaDirs[UmbrellaDir])
303<< UmbrellaMod->getFullModuleName();
307RelativePathName.str());
331boolModuleMap::resolveAsBuiltinHeader(
334llvm::sys::path::is_absolute(Header.
FileName) ||
336!BuiltinIncludeDir || BuiltinIncludeDir == Mod->
Directory||
358: SourceMgr(SourceMgr), Diags(Diags), LangOpts(LangOpts),
Target(
Target),
359HeaderInfo(HeaderInfo) {
360MMapLangOpts.LineComment =
true;
366assert((!this->Target || this->Target == &
Target) &&
367 "Improper target override");
382Buffer.push_back(
'_');
383Buffer.reserve(Buffer.size() + Name.size());
384 for(
unsignedI = 0, N = Name.size(); I != N; ++I) {
386Buffer.push_back(Name[I]);
388Buffer.push_back(
'_');
391Name = StringRef(Buffer.data(), Buffer.size());
394 while(llvm::StringSwitch<bool>(Name)
395#define
KEYWORD(Keyword,Conditions) .Case(#Keyword,
true)
396#define
ALIAS(Keyword, AliasOf, Conditions) .Case(Keyword,
true)
397#include
"clang/Basic/TokenKinds.def" 399 if(Name.data() != Buffer.data())
400Buffer.append(Name.begin(), Name.end());
401Buffer.push_back(
'_');
402Name = StringRef(Buffer.data(), Buffer.size());
409 return File.getDir() == BuiltinIncludeDir && LangOpts.BuiltinHeadersInSystemModules &&
415 returnLangOpts.BuiltinHeadersInSystemModules && BuiltinIncludeDir &&
420ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(
FileEntryRef File) {
422HeadersMap::iterator Known = Headers.find(
File);
426 returnHeaders.find(
File);
433 if(UmbrellaDirs.empty())
447 autoKnownDir = UmbrellaDirs.find(*Dir);
448 if(KnownDir != UmbrellaDirs.end())
451IntermediateDirs.push_back(*Dir);
454DirName = llvm::sys::path::parent_path(DirName);
472 boolIsPrivate =
false;
476 for(
autoHs : HeaderList)
477IsPrivate |= llvm::any_of(
479assert(IsPrivate &&
"inconsistent headers and roles");
490 boolRequestingModuleIsModuleInterface,
498 if(RequestingModule) {
503 boolExcluded =
false;
505 Module*NotUsed =
nullptr;
507HeadersMap::iterator Known = findKnownHeader(
File);
508 if(Known != Headers.end()) {
524 if(RequestingModule && LangOpts.ModulesDeclUse &&
539Diags.
Report(FilenameLoc, diag::warn_use_of_private_header_outside_module)
546Diags.
Report(FilenameLoc, diag::err_undeclared_use_of_module_indirect)
552 if(Excluded || isHeaderInUmbrellaDirs(
File))
557 if(RequestingModule && LangOpts.ModulesStrictDeclUse) {
558Diags.
Report(FilenameLoc, diag::err_undeclared_use_of_module)
560}
else if(RequestingModule && RequestingModuleIsModuleInterface &&
564diag::warn_non_modular_include_in_framework_module :
565diag::warn_non_modular_include_in_module;
601 boolAllowExcluded) {
608HeadersMap::iterator Known = findKnownHeader(
File);
609 if(Known != Headers.end()) {
618 returnMakeResult(H);
622 returnMakeResult(
Result);
625 returnMakeResult(findOrCreateModuleForHeaderInUmbrellaDir(
File));
630assert(!Headers.count(
File) &&
"already have a module for this header");
633KnownHeader H = findHeaderInUmbrellaDirs(
File, SkippedDirs);
641UmbrellaModule = UmbrellaModule->
Parent;
655llvm::sys::path::stem(SkippedDir.getName()), NameBuf);
661UmbrellaDirs[SkippedDir] =
Result;
672llvm::sys::path::stem(
File.getName()), NameBuf);
685 for(
unsignedI = 0, N = SkippedDirs.size(); I != N; ++I)
686UmbrellaDirs[SkippedDirs[I]] =
Result;
690Headers[
File].push_back(Header);
699HeadersMap::iterator Known = findKnownHeader(
File);
700 if(Known != Headers.end())
701 returnKnown->second;
703 if(findOrCreateModuleForHeaderInUmbrellaDir(
File))
704 returnHeaders.find(
File)->second;
713 autoIt = Headers.find(
File);
714 if(It == Headers.end())
726HeadersMap::const_iterator Known = Headers.find(Header);
727 if(Known != Headers.end()) {
729I = Known->second.begin(),
730 E= Known->second.end();
736 if(I->isAvailable() &&
737(!RequestingModule ||
754StringRef DirName = Dir->
getName();
756 autoIsUnavailable = [&](
const Module*M) {
757 return!M->
isAvailable() && (!RequestingModule ||
764 autoKnownDir = UmbrellaDirs.find(*Dir);
765 if(KnownDir != UmbrellaDirs.end()) {
767 if(IsUnavailable(
Found))
775UmbrellaModule = UmbrellaModule->
Parent;
782llvm::sys::path::stem(SkippedDir.getName()), NameBuf);
786 if(IsUnavailable(
Found))
793llvm::sys::path::stem(Header.
getName()),
800 returnIsUnavailable(
Found);
803SkippedDirs.push_back(*Dir);
806DirName = llvm::sys::path::parent_path(DirName);
818llvm::StringMap<Module *>::const_iterator Known = Modules.find(Name);
819 if(Known != Modules.end())
820 returnKnown->getValue();
828 if(!
Parent->InferSubmodules)
832 Parent->InferExplicitSubmodules, 0);
833 Result->InferExplicitSubmodules =
Parent->InferExplicitSubmodules;
835 Result->InferExportWildcard =
Parent->InferExportWildcard;
836 if(
Result->InferExportWildcard)
843 for(; Context; Context = Context->Parent) {
855 returnContext->findSubmodule(Name);
864 returnstd::make_pair(Sub,
false);
868 returnstd::make_pair(M,
true);
872 boolIsFramework,
boolIsExplicit) {
874 "Creating duplicate submodule");
878IsFramework, IsExplicit, NumCreatedModules++);
883ModuleScopeIDs[
Result] = CurrentModuleScopeID;
892 true, NumCreatedModules++);
897PendingSubmodules.emplace_back(
Result);
904assert(
Parent&&
"We should only create an implicit global module fragment " 905 "in a module purview");
909 auto*
Result=
new(ModulesAlloc.Allocate())
911 false,
false, NumCreatedModules++);
921 true, NumCreatedModules++);
928 auto*
Result=
new(ModulesAlloc.Allocate())
930 false, NumCreatedModules++);
934 for(
auto&Submodule : PendingSubmodules)
935Submodule->setParent(
Result);
936PendingSubmodules.clear();
942assert(LangOpts.
CurrentModule== Name &&
"module name mismatch");
943assert(!Modules[Name] &&
"redefining existing module");
947Modules[Name] = SourceModule =
Result;
952assert(MainFile &&
"no input file for module interface");
960assert(LangOpts.
CurrentModule== Name &&
"module name mismatch");
963 "creating implementation module without an interface");
968StringRef IName =
".ImplementationUnit";
969assert(!Modules[IName] &&
"multiple implementation units?");
973Modules[IName] = SourceModule =
Result;
977 "no input file for module implementation");
984assert(LangOpts.
CurrentModule== Name &&
"module name mismatch");
985assert(!Modules[Name] &&
"redefining existing module");
987 auto*
Result=
new(ModulesAlloc.Allocate())
989 false, NumCreatedModules++);
991Modules[Name] = SourceModule =
Result;
999assert(Mod->
IsFramework&&
"Can only infer linking for framework modules");
1001 "Can only infer linking for top-level frameworks");
1003StringRef FrameworkName(Mod->
Name);
1004FrameworkName.consume_back(
"_Private");
1013 returninferFrameworkModule(FrameworkDir, Attrs,
Parent);
1022StringRef FrameworkDirName =
1030llvm::sys::path::stem(FrameworkDirName), ModuleNameStorage);
1043 boolcanInfer =
false;
1044 if(llvm::sys::path::has_parent_path(FrameworkDirName)) {
1046StringRef
Parent= llvm::sys::path::parent_path(FrameworkDirName);
1050llvm::DenseMap<const DirectoryEntry *, InferredDirectory>::const_iterator
1051inferred = InferredDirectories.find(*ParentDir);
1052 if(inferred == InferredDirectories.end()) {
1055 boolIsFrameworkDir =
Parent.ends_with(
".framework");
1059inferred = InferredDirectories.find(*ParentDir);
1062 if(inferred == InferredDirectories.end())
1063inferred = InferredDirectories.insert(
1064std::make_pair(*ParentDir, InferredDirectory())).first;
1067 if(inferred->second.InferModules) {
1070StringRef Name = llvm::sys::path::stem(FrameworkDirName);
1072!llvm::is_contained(inferred->second.ExcludedModules, Name);
1074Attrs.IsSystem |= inferred->second.Attrs.IsSystem;
1075Attrs.IsExternC |= inferred->second.Attrs.IsExternC;
1076Attrs.IsExhaustive |= inferred->second.Attrs.IsExhaustive;
1077Attrs.NoUndeclaredIncludes |=
1078inferred->second.Attrs.NoUndeclaredIncludes;
1079ModuleMapFID = inferred->second.ModuleMapFID;
1093llvm::sys::path::append(UmbrellaName,
"Headers", ModuleName +
".h");
1099 if(!UmbrellaHeader)
1104 true,
false, NumCreatedModules++);
1109Modules[ModuleName] =
Result;
1110ModuleScopeIDs[
Result] = CurrentModuleScopeID;
1113 Result->IsSystem |= Attrs.IsSystem;
1114 Result->IsExternC |= Attrs.IsExternC;
1115 Result->ConfigMacrosExhaustive |= Attrs.IsExhaustive;
1116 Result->NoUndeclaredIncludes |= Attrs.NoUndeclaredIncludes;
1117 Result->Directory = FrameworkDir;
1120StringRef RelativePath = UmbrellaName.str().substr(
1121 Result->getTopLevelModule()->Directory->getName().size());
1122RelativePath = llvm::sys::path::relative_path(RelativePath);
1132 Result->InferSubmodules =
true;
1133 Result->InferExportWildcard =
true;
1138llvm::sys::path::append(SubframeworksDirName,
"Frameworks");
1139llvm::sys::path::native(SubframeworksDirName);
1141 for(llvm::vfs::directory_iterator
1142Dir = FS.dir_begin(SubframeworksDirName, EC),
1144Dir != DirEnd && !EC; Dir.increment(EC)) {
1145 if(!StringRef(Dir->path()).ends_with(
".framework"))
1153StringRef SubframeworkDirName =
1155 boolFoundParent =
false;
1159= llvm::sys::path::parent_path(SubframeworkDirName);
1160 if(SubframeworkDirName.empty())
1165 if(*SubDir == FrameworkDir) {
1166FoundParent =
true;
1176inferFrameworkModule(*SubframeworkDir, Attrs,
Result);
1182 if(!
Result->isSubFramework())
1189 Module*ShadowingModule) {
1194IsFramework,
false, NumCreatedModules++);
1195 Result->ShadowingModule = ShadowingModule;
1196 Result->markUnavailable(
true);
1197ModuleScopeIDs[
Result] = CurrentModuleScopeID;
1198ShadowModules.push_back(
Result);
1205 constTwine &PathRelativeToRootModuleDirectory) {
1210PathRelativeToRootModuleDirectory.str();
1211UmbrellaDirs[UmbrellaHeader.
getDir()] = Mod;
1214 for(
const auto&Cb : Callbacks)
1215Cb->moduleMapAddUmbrellaHeader(UmbrellaHeader);
1220 constTwine &PathRelativeToRootModuleDirectory) {
1224PathRelativeToRootModuleDirectory.str();
1225UmbrellaDirs[UmbrellaDir] = Mod;
1228voidModuleMap::addUnresolvedHeader(
Module*Mod,
1230 bool&NeedsFramework) {
1233 if(resolveAsBuiltinHeader(Mod, Header)) {
1252LazyHeadersByModTime[*Header.
ModTime].push_back(Mod);
1254LazyHeadersBySize[*Header.
Size].push_back(Mod);
1261resolveHeader(Mod, Header, NeedsFramework);
1265 autoBySize = LazyHeadersBySize.find(
File->getSize());
1266 if(BySize != LazyHeadersBySize.end()) {
1267 for(
auto*M : BySize->second)
1269LazyHeadersBySize.erase(BySize);
1272 autoByModTime = LazyHeadersByModTime.find(
File->getModificationTime());
1273 if(ByModTime != LazyHeadersByModTime.end()) {
1274 for(
auto*M : ByModTime->second)
1276LazyHeadersByModTime.erase(ByModTime);
1281 Module*Mod, std::optional<const FileEntry *>
File)
const{
1282 boolNeedsFramework =
false;
1284 const autoSize =
File? (*File)->getSize() : 0;
1285 const autoModTime =
File? (*File)->getModificationTime() : 0;
1289(Header.
Size&& Header.
Size!= Size)))
1290NewHeaders.push_back(Header);
1294 const_cast<ModuleMap*
>(
this)->resolveHeader(Mod, Header, NeedsFramework);
1308 auto&HeaderList = Headers[HeaderEntry];
1309 if(llvm::is_contained(HeaderList, KH))
1312HeaderList.push_back(KH);
1315 boolisCompilingModuleHeader = Mod->
isForBuilding(LangOpts);
1316 if(!Imported || isCompilingModuleHeader) {
1323 for(
const auto&Cb : Callbacks)
1324Cb->moduleMapAddHeader(HeaderEntry.
getName());
1341assert(InferredModuleAllowedBy.count(M) &&
"missing inferred module map");
1342 returnInferredModuleAllowedBy.find(M)->second;
1354InferredModuleAllowedBy[M] = ModMapFID;
1359StringRef Dir = llvm::sys::path::parent_path({
Path.data(),
Path.size()});
1363 if(llvm::sys::path::filename(Dir) ==
"Modules") {
1364StringRef
Parent= llvm::sys::path::parent_path(Dir);
1365 if(
Parent.ends_with(
".framework"))
1372 returnllvm::errorToErrorCode(DirEntry.takeError());
1376 if(CanonicalDir != Dir)
1377llvm::sys::path::replace_path_prefix(
Path, Dir, CanonicalDir);
1385llvm::sys::path::remove_dots(
Path);
1387 returnstd::error_code();
1392AdditionalModMaps[M].insert(
ModuleMap);
1396llvm::errs() <<
"Modules:";
1397 for(llvm::StringMap<Module *>::iterator M = Modules.begin(),
1398MEnd = Modules.end();
1400M->getValue()->
print(llvm::errs(), 2);
1402llvm::errs() <<
"Headers:";
1403 for(HeadersMap::iterator H = Headers.begin(), HEnd = Headers.end();
1405llvm::errs() <<
" \""<< H->first.getName() <<
"\" -> ";
1407 E= H->second.end();
1409 if(I != H->second.begin())
1410llvm::errs() <<
",";
1411llvm::errs() << I->getModule()->getFullModuleName();
1413llvm::errs() <<
"\n";
1422 if(Export.getPointer() || Export.getInt())
1423Mod->
Exports.push_back(Export);
1432 auto Unresolved= std::move(Top->UnresolvedDirectUses);
1433Top->UnresolvedDirectUses.clear();
1435 Module*DirectUse = resolveModuleId(UDU, Top, Complain);
1437Top->DirectUses.push_back(DirectUse);
1439Top->UnresolvedDirectUses.push_back(UDU);
1441 return!Top->UnresolvedDirectUses.empty();
1448 if(
Module*OtherMod = resolveModuleId(UC.Id, Mod, Complain)) {
1450Conflict.
Other= OtherMod;
1451Conflict.
Message= UC.Message;
1556 boolHadError =
false;
1560llvm::BumpPtrAllocator StringData;
1566 Module*ActiveModule =
nullptr;
1586 voidparseModuleDecl();
1587 voidparseExternModuleDecl();
1588 voidparseRequiresDecl();
1591 voidparseExportDecl();
1592 voidparseExportAsDecl();
1593 voidparseUseDecl();
1594 voidparseLinkDecl();
1595 voidparseConfigMacros();
1596 voidparseConflict();
1597 voidparseInferredModuleDecl(
boolFramework,
bool Explicit);
1606 usingAttributes = ModuleMap::Attributes;
1608 boolparseOptionalAttributes(Attributes &Attrs);
1615: L(L), SourceMgr(SourceMgr),
Target(
Target), Diags(Diags), Map(Map),
1616ModuleMapFID(ModuleMapFID), Directory(Directory), IsSystem(IsSystem) {
1638 casetok::raw_identifier: {
1642Tok.
Kind= llvm::StringSwitch<MMToken::TokenKind>(RI)
1699 casetok::string_literal: {
1714 char*Saved = StringData.Allocate<
char>(Length + 1);
1725 casetok::numeric_constant: {
1728SpellingBuffer.resize(LToken.
getLength() + 1);
1729 const char*Start = SpellingBuffer.data();
1733 if(StringRef(Start, Length).getAsInteger(0,
Value)) {
1753 autoNextIsIdent = [&](StringRef Str) ->
bool{
1758 if(NextIsIdent(
"pragma") && NextIsIdent(
"clang") &&
1759NextIsIdent(
"module") && NextIsIdent(
"contents")) {
1776 unsignedbraceDepth = 0;
1777 unsignedsquareDepth = 0;
1779 switch(Tok.
Kind) {
1784 if(Tok.
is(K) && braceDepth == 0 && squareDepth == 0)
1791 if(Tok.
is(K) && braceDepth == 0 && squareDepth == 0)
1800 else if(Tok.
is(K))
1805 if(squareDepth > 0)
1807 else if(Tok.
is(K))
1812 if(braceDepth == 0 && squareDepth == 0 && Tok.
is(K))
1828boolModuleMapParser::parseModuleId(
ModuleId&
Id) {
1852 enumAttributeKind {
1866AT_no_undeclared_includes
1875voidModuleMapParser::diagnosePrivateModules(
SourceLocationExplicitLoc,
1877 autoGenNoteAndFixIt = [&](StringRef BadName, StringRef Canonical,
1880diag::note_mmap_rename_top_level_private_module);
1881 D<< BadName << M->Name;
1886 auto const*M =
E->getValue();
1887 if(M->Directory != ActiveModule->
Directory)
1891 if(!
FullName.starts_with(M->Name) && !
FullName.ends_with(
"Private"))
1895Canonical.append(
"_Private");
1898 if(ActiveModule->
Parent&& ActiveModule->
Name==
"Private"&& !M->Parent &&
1901diag::warn_mmap_mismatched_private_submodule)
1906FixItInitBegin = FrameworkLoc;
1908FixItInitBegin = ExplicitLoc;
1911FixedPrivModDecl.append(
"framework ");
1912FixedPrivModDecl.append(
"module ");
1913FixedPrivModDecl.append(Canonical);
1915GenNoteAndFixIt(
FullName, FixedPrivModDecl, M,
1922ActiveModule->
Name!= Canonical) {
1924diag::warn_mmap_mismatched_private_module_name)
1925<< ActiveModule->
Name;
1926GenNoteAndFixIt(ActiveModule->
Name, Canonical, M,
1950voidModuleMapParser::parseModuleDecl() {
1954parseExternModuleDecl();
1962 boolFramework =
false;
1966ExplicitLoc = consumeToken();
1972FrameworkLoc = consumeToken();
1983CurrModuleDeclLoc = consumeToken();
1988 returnparseInferredModuleDecl(Framework,
Explicit);
1992 if(parseModuleId(
Id)) {
1998 if(
Id.size() > 1) {
1999Diags.
Report(
Id.front().second, diag::err_mmap_nested_submodule_id)
2007Diags.
Report(ExplicitLoc, diag::err_mmap_explicit_top_level);
2013 Module*PreviousActiveModule = ActiveModule;
2014 if(
Id.size() > 1) {
2017ActiveModule =
nullptr;
2018 const Module*TopLevelModule =
nullptr;
2019 for(
unsignedI = 0, N =
Id.size() - 1; I != N; ++I) {
2022TopLevelModule = Next;
2023ActiveModule = Next;
2027Diags.
Report(
Id[I].second, diag::err_mmap_missing_parent_module)
2028<<
Id[I].first << (ActiveModule !=
nullptr)
2035 if(TopLevelModule &&
2037assert(ModuleMapFID !=
2039 "submodule defined in same file as 'module *' that allowed its " 2040 "top-level module");
2046StringRef ModuleName =
Id.back().first;
2051 if(parseOptionalAttributes(Attrs))
2064 Module*ShadowingModule =
nullptr;
2072 boolInferred = Existing->IsInferred;
2088 boolPartOfFramework = Framework || Existing->isPartOfFramework();
2091 boolParsedAsMainInput =
2096 if(LoadedFromASTFile || Inferred || PartOfFramework || ParsedAsMainInput) {
2097ActiveModule = PreviousActiveModule;
2104Diags.
Report(LBraceLoc, diag::note_mmap_lbrace_match);
2111ShadowingModule = Existing;
2114Diags.
Report(ModuleNameLoc, diag::err_mmap_module_redefinition)
2116Diags.
Report(Existing->DefinitionLoc, diag::note_mmap_prev_definition);
2129 if(ShadowingModule) {
2138 if(Attrs.IsSystem || IsSystem)
2140 if(Attrs.IsExternC)
2142 if(Attrs.NoUndeclaredIncludes)
2146StringRef MapFileName(
2148 if(MapFileName.ends_with(
"module.private.modulemap") ||
2149MapFileName.ends_with(
"module_private.map")) {
2159!Diags.
isIgnored(diag::warn_mmap_mismatched_private_submodule,
2161!Diags.
isIgnored(diag::warn_mmap_mismatched_private_module_name,
2164diagnosePrivateModules(ExplicitLoc, FrameworkLoc);
2168 switch(Tok.
Kind) {
2175parseConfigMacros();
2194parseExportAsDecl();
2202parseRequiresDecl();
2214parseUmbrellaDirDecl(UmbrellaLoc);
2245Diags.
Report(LBraceLoc, diag::note_mmap_lbrace_match);
2258ActiveModule->
Parent) {
2265ActiveModule = PreviousActiveModule;
2272voidModuleMapParser::parseExternModuleDecl() {
2287 if(parseModuleId(
Id)) {
2303 if(llvm::sys::path::is_relative(FileNameRef)) {
2304ModuleMapFileName += Directory.
getName();
2305llvm::sys::path::append(ModuleMapFileName,
FileName);
2306FileNameRef = ModuleMapFileName;
2314 FileID(),
nullptr, ExternLoc);
2333 bool&IsRequiresExcludedHack) {
2334 if(Feature ==
"excluded"&&
2337IsRequiresExcludedHack =
true;
2339}
else if(Feature ==
"cplusplus"&& M->
fullModuleNameIs({
"IOKit",
"avc"})) {
2357voidModuleMapParser::parseRequiresDecl() {
2365 boolRequiredState =
true;
2367RequiredState =
false;
2378std::string Feature = std::string(Tok.
getString());
2381 boolIsRequiresExcludedHack =
false;
2382 boolShouldAddRequirement =
2385 if(IsRequiresExcludedHack)
2386UsesRequiresExcludedHack.insert(ActiveModule);
2388 if(ShouldAddRequirement) {
2390ActiveModule->
addRequirement(Feature, RequiredState, Map.LangOpts,
2420LeadingToken = Tok.
Kind;
2430 if(UsesRequiresExcludedHack.count(ActiveModule)) {
2462!std::holds_alternative<std::monostate>(ActiveModule->
Umbrella)) {
2478 switch(llvm::StringSwitch<Attribute>(Str)
2479.Case(
"size", Size)
2480.Case(
"mtime", ModTime)
2484Diags.
Report(
Loc, diag::err_mmap_duplicate_header_attribute) << Str;
2487diag::err_mmap_invalid_header_attribute_value) << Str;
2497Diags.
Report(
Loc, diag::err_mmap_duplicate_header_attribute) << Str;
2500diag::err_mmap_invalid_header_attribute_value) << Str;
2509Diags.
Report(
Loc, diag::err_mmap_expected_header_attribute);
2519Diags.
Report(LBraceLoc, diag::note_mmap_lbrace_match);
2524 boolNeedsFramework =
false;
2528 if(!Map.LangOpts.BuiltinHeadersInSystemModules ||
2531Map.addUnresolvedHeader(ActiveModule, std::move(Header), NeedsFramework);
2534Diags.
Report(CurrModuleDeclLoc, diag::note_mmap_add_framework_keyword)
2548voidModuleMapParser::parseUmbrellaDirDecl(
SourceLocationUmbrellaLoc) {
2557std::string DirName = std::string(Tok.
getString());
2558std::string DirNameAsWritten = DirName;
2562 if(!std::holds_alternative<std::monostate>(ActiveModule->
Umbrella)) {
2563Diags.
Report(DirNameLoc, diag::err_mmap_umbrella_clash)
2571 if(llvm::sys::path::is_absolute(DirName)) {
2575PathName = Directory.
getName();
2576llvm::sys::path::append(PathName, DirName);
2581Diags.
Report(DirNameLoc, diag::warn_mmap_umbrella_dir_not_found)
2586 if(UsesRequiresExcludedHack.count(ActiveModule)) {
2593llvm::vfs::FileSystem &FS =
2595 for(llvm::vfs::recursive_directory_iterator I(FS, Dir->
getName(), EC),
E;
2596I !=
E&& !EC; I.increment(EC)) {
2599Headers.push_back(std::move(Header));
2606 for(
auto&Header : Headers)
2611 if(
Module*OwningModule = Map.UmbrellaDirs[*Dir]) {
2612Diags.
Report(UmbrellaLoc, diag::err_mmap_umbrella_clash)
2613<< OwningModule->getFullModuleName();
2631voidModuleMapParser::parseExportDecl() {
2637 boolWildcard =
false;
2641ParsedModuleId.push_back(
2665ExportLoc, ParsedModuleId, Wildcard
2674voidModuleMapParser::parseExportAsDecl() {
2684 if(ActiveModule->
Parent) {
2711voidModuleMapParser::parseUseDecl() {
2713 autoKWLoc = consumeToken();
2716parseModuleId(ParsedModuleId);
2718 if(ActiveModule->
Parent)
2719Diags.
Report(KWLoc, diag::err_mmap_use_decl_submodule);
2728voidModuleMapParser::parseLinkDecl() {
2733 boolIsFramework =
false;
2736IsFramework =
true;
2747std::string LibraryName = std::string(Tok.
getString());
2760voidModuleMapParser::parseConfigMacros() {
2765 if(ActiveModule->
Parent) {
2766Diags.
Report(ConfigMacrosLoc, diag::err_mmap_config_macro_submodule);
2771 if(parseOptionalAttributes(Attrs))
2774 if(Attrs.IsExhaustive && !ActiveModule->
Parent) {
2784 if(!ActiveModule->
Parent) {
2803 if(!ActiveModule->
Parent) {
2814llvm::raw_string_ostream OS(result);
2816 for(
unsignedI = 0, N =
Id.size(); I != N; ++I) {
2830voidModuleMapParser::parseConflict() {
2836 if(parseModuleId(Conflict.
Id))
2869voidModuleMapParser::parseInferredModuleDecl(
boolFramework,
bool Explicit) {
2872 boolFailed =
false;
2875 if(!ActiveModule && !Framework) {
2876Diags.
Report(StarLoc, diag::err_mmap_top_level_inferred_submodule);
2884Diags.
Report(StarLoc, diag::err_mmap_inferred_no_umbrella);
2890Diags.
Report(StarLoc, diag::err_mmap_inferred_redef);
2893diag::note_mmap_prev_definition);
2899Diags.
Report(StarLoc, diag::err_mmap_inferred_framework_submodule);
2903Diags.
Report(StarLoc, diag::err_mmap_explicit_inferred_framework);
2921 if(parseOptionalAttributes(Attrs))
2931Map.InferredDirectories[Directory].InferModules =
true;
2932Map.InferredDirectories[Directory].Attrs = Attrs;
2933Map.InferredDirectories[Directory].ModuleMapFID = ModuleMapFID;
2948 switch(Tok.
Kind) {
2957<< (ActiveModule !=
nullptr);
2969Map.InferredDirectories[Directory].ExcludedModules.push_back(
2975 if(!ActiveModule) {
2977<< (ActiveModule !=
nullptr);
2987diag::err_mmap_expected_export_wildcard);
2998<< (ActiveModule !=
nullptr);
3008Diags.
Report(LBraceLoc, diag::note_mmap_lbrace_match);
3025boolModuleMapParser::parseOptionalAttributes(Attributes &Attrs) {
3026 boolHadError =
false;
3042AttributeKind Attribute
3043= llvm::StringSwitch<AttributeKind>(Tok.
getString())
3044.Case(
"exhaustive", AT_exhaustive)
3045.Case(
"extern_c", AT_extern_c)
3046.Case(
"no_undeclared_includes", AT_no_undeclared_includes)
3047.Case(
"system", AT_system)
3048.Default(AT_unknown);
3049 switch(Attribute) {
3056Attrs.IsSystem =
true;
3060Attrs.IsExternC =
true;
3064Attrs.IsExhaustive =
true;
3067 caseAT_no_undeclared_includes:
3068Attrs.NoUndeclaredIncludes =
true;
3076Diags.
Report(LSquareLoc, diag::note_mmap_lsquare_match);
3094 switch(Tok.
Kind) {
3140assert(
Target&&
"Missing target information");
3141llvm::DenseMap<const FileEntry *, bool>::iterator Known
3142= ParsedModuleMap.find(
File);
3143 if(Known != ParsedModuleMap.end())
3144 returnKnown->second;
3147 if(ID.isInvalid()) {
3148 autoFileCharacter =
3153assert(
Target&&
"Missing target information");
3154std::optional<llvm::MemoryBufferRef> Buffer = SourceMgr.
getBufferOrNone(ID);
3156 returnParsedModuleMap[
File] =
true;
3157assert((!Offset || *Offset <= Buffer->getBufferSize()) &&
3158 "invalid buffer offset");
3162Buffer->getBufferStart(),
3163Buffer->getBufferStart() + (Offset ? *Offset : 0),
3164Buffer->getBufferEnd());
3172assert(
Loc.first == ID &&
"stopped in a different file?");
3173*Offset =
Loc.second;
3177 for(
const auto&Cb : Callbacks)
3178Cb->moduleMapFileRead(Start,
File, IsSystem);
Defines the Diagnostic-related interfaces.
Defines the clang::FileManager interface and associated types.
#define ALIAS(NAME, TOK, FLAGS)
#define KEYWORD(NAME, FLAGS)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
static bool isBuiltinHeaderName(StringRef FileName)
Determine whether the given file name is the name of a builtin header, supplied by Clang to replace,...
static bool isBuiltInModuleName(StringRef ModuleName)
Determine whether the given module name is the name of a builtin module that is cyclic with a system ...
static Module * getTopLevelOrNull(Module *M)
static bool violatesPrivateInclude(Module *RequestingModule, const FileEntry *IncFileEnt, ModuleMap::KnownHeader Header)
static void inferFrameworkLink(Module *Mod)
For a framework module, infer the framework against which we should link.
static StringRef sanitizeFilenameAsIdentifier(StringRef Name, SmallVectorImpl< char > &Buffer)
"Sanitize" a filename so that it can be used as an identifier.
static void appendSubframeworkPaths(Module *Mod, SmallVectorImpl< char > &Path)
Append to Paths the set of paths needed to get to the subframework in which the given module lives.
static bool shouldAddRequirement(Module *M, StringRef Feature, bool &IsRequiresExcludedHack)
Whether to add the requirement Feature to the module M.
static std::string formatModuleId(const ModuleId &Id)
Format a module-id into a string.
static bool isBetterKnownHeader(const ModuleMap::KnownHeader &New, const ModuleMap::KnownHeader &Old)
static bool compareModuleHeaders(const Module::Header &A, const Module::Header &B)
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
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 isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
A reference to a DirectoryEntry that includes the name of the directory as it was accessed by the Fil...
StringRef getName() const
Cached information about one directory (either on disk or in the virtual file system).
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
StringRef getName() const
The name of this FileEntry.
DirectoryEntryRef getDir() const
Cached information about one file (either on disk or in the virtual file system).
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
llvm::vfs::FileSystem & getVirtualFileSystem() const
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
StringRef getCanonicalName(DirectoryEntryRef Dir)
Retrieve the canonical name for a given directory.
llvm::Expected< DirectoryEntryRef > getDirectoryRef(StringRef DirName, bool CacheFailure=true)
Lookup, cache, and verify the specified directory (real or virtual).
OptionalDirectoryEntryRef getOptionalDirectoryRef(StringRef DirName, bool CacheFailure=true)
Get a DirectoryEntryRef if it exists, without doing anything on error.
LLVM_DEPRECATED("Functions returning DirectoryEntry are deprecated.", "getOptionalDirectoryRef()") llvm LLVM_DEPRECATED("Functions returning FileEntry are deprecated.", "getOptionalFileRef()") llvm llvm::Expected< FileEntryRef > getFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true, bool IsText=true)
Lookup, cache, and verify the specified directory (real or virtual).
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
@ CMK_ModuleMap
Compiling a module from a module map.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isCompilingModule() const
Are we compiling a module?
std::string CurrentModule
The name of the current module, of which the main source file is a part.
Lexer - This provides a simple interface that turns a text buffer into a stream of tokens.
bool LexFromRawLexer(Token &Result)
LexFromRawLexer - Lex a token from a designated raw lexer (one with no associated preprocessor object...
SourceLocation getSourceLocation(const char *Loc, unsigned TokLen=1) const
getSourceLocation - Return a source location identifier for the specified offset in the current file.
static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, const LangOptions &LangOpts, bool *Invalid=nullptr)
getSpelling - This method is used to get the spelling of a token into a preallocated buffer,...
Required to construct a Module.
SourceLocation getLocation()
bool terminatedByDirective()
bool parseModuleMapFile()
Parse a module map file.
ModuleMapParser(Lexer &L, SourceManager &SourceMgr, const TargetInfo *Target, DiagnosticsEngine &Diags, ModuleMap &Map, FileID ModuleMapFID, DirectoryEntryRef Directory, bool IsSystem)
Module * createShadowedModule(StringRef Name, bool IsFramework, Module *ShadowingModule)
Create a new top-level module that is shadowed by ShadowingModule.
bool resolveExports(Module *Mod, bool Complain)
Resolve all of the unresolved exports in the given module.
void addLinkAsDependency(Module *Mod)
Make module to use export_as as the link dependency name if enough information is available or add it...
void dump()
Dump the contents of the module map, for debugging purposes.
std::pair< Module *, bool > findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Find a new module or submodule, or create it if it does not already exist.
void setUmbrellaDirAsWritten(Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella directory of the given module to the given directory.
void diagnoseHeaderInclusion(Module *RequestingModule, bool RequestingModuleIsModuleInterface, SourceLocation FilenameLoc, StringRef Filename, FileEntryRef File)
Reports errors if a module must not include a specific file.
void addAdditionalModuleMapFile(const Module *M, FileEntryRef ModuleMap)
OptionalFileEntryRef getContainingModuleMapFile(const Module *Module) const
static Module::HeaderKind headerRoleToKind(ModuleHeaderRole Role)
Convert a header role to a kind.
Module * findModule(StringRef Name) const
Retrieve a module with the given name.
bool mayShadowNewModule(Module *ExistingModule)
KnownHeader findModuleForHeader(FileEntryRef File, bool AllowTextual=false, bool AllowExcluded=false)
Retrieve the module that owns the given header file, if any.
Module * createHeaderUnit(SourceLocation Loc, StringRef Name, Module::Header H)
Create a C++20 header unit.
static bool isModular(ModuleHeaderRole Role)
Check if the header with the given role is a modular one.
bool resolveConflicts(Module *Mod, bool Complain)
Resolve all of the unresolved conflicts in the given module.
bool isHeaderUnavailableInModule(FileEntryRef Header, const Module *RequestingModule) const
Determine whether the given header is unavailable as part of the specified module.
void resolveHeaderDirectives(const FileEntry *File) const
Resolve all lazy header directives for the specified file.
module_iterator module_begin() const
ArrayRef< KnownHeader > findResolvedModulesForHeader(FileEntryRef File) const
Like findAllModulesForHeader, but do not attempt to infer module ownership from umbrella headers if w...
OptionalFileEntryRef getModuleMapFileForUniquing(const Module *M) const
bool shouldImportRelativeToBuiltinIncludeDir(StringRef FileName, Module *Module) const
Module * createModuleForImplementationUnit(SourceLocation Loc, StringRef Name)
Create a new module for a C++ module implementation unit.
ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags, const LangOptions &LangOpts, const TargetInfo *Target, HeaderSearch &HeaderInfo)
Construct a new module map.
std::error_code canonicalizeModuleMapPath(SmallVectorImpl< char > &Path)
Canonicalize Path in a manner suitable for a module map file.
FileID getModuleMapFileIDForUniquing(const Module *M) const
Get the module map file that (along with the module name) uniquely identifies this module.
void setInferredModuleAllowedBy(Module *M, FileID ModMapFID)
void setUmbrellaHeaderAsWritten(Module *Mod, FileEntryRef UmbrellaHeader, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella header of the given module to the given header.
Module * findOrCreateModuleFirst(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Call ModuleMap::findOrCreateModule and throw away the information whether the module was found or cre...
Module * lookupModuleUnqualified(StringRef Name, Module *Context) const
Retrieve a module with the given name using lexical name lookup, starting at the given context.
bool isBuiltinHeader(FileEntryRef File)
Is this a compiler builtin header?
Module * createModule(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Create new submodule, assuming it does not exist.
module_iterator module_end() const
bool isHeaderInUnavailableModule(FileEntryRef Header) const
Determine whether the given header is part of a module marked 'unavailable'.
FileID getContainingModuleMapFileID(const Module *Module) const
Retrieve the module map file containing the definition of the given module.
bool parseModuleMapFile(FileEntryRef File, bool IsSystem, DirectoryEntryRef HomeDir, FileID ID=FileID(), unsigned *Offset=nullptr, SourceLocation ExternModuleLoc=SourceLocation())
Parse the given module map file, and record any modules we encounter.
~ModuleMap()
Destroy the module map.
Module * createGlobalModuleFragmentForModuleUnit(SourceLocation Loc, Module *Parent=nullptr)
Create a global module fragment for a C++ module unit.
void setTarget(const TargetInfo &Target)
Set the target information.
Module * lookupModuleQualified(StringRef Name, Module *Context) const
Retrieve a module with the given name within the given context, using direct (qualified) name lookup.
void resolveLinkAsDependencies(Module *Mod)
Use PendingLinkAsModule information to mark top level link names that are going to be replaced by exp...
ModuleHeaderRole
Flags describing the role of a module header.
@ PrivateHeader
This header is included but private.
@ ExcludedHeader
This header is explicitly excluded from the module.
@ NormalHeader
This header is normally included in the module.
@ TextualHeader
This header is part of the module (for layering purposes) but should be textually included.
Module * createModuleForInterfaceUnit(SourceLocation Loc, StringRef Name)
Create a new module for a C++ module interface unit.
void addHeader(Module *Mod, Module::Header Header, ModuleHeaderRole Role, bool Imported=false)
Adds this header to the given module.
Module * createPrivateModuleFragmentForInterfaceUnit(Module *Parent, SourceLocation Loc)
Create a global module fragment for a C++ module interface unit.
Module * findOrInferSubmodule(Module *Parent, StringRef Name)
ArrayRef< KnownHeader > findAllModulesForHeader(FileEntryRef File)
Retrieve all the modules that contain the given header file.
Module * createImplicitGlobalModuleFragmentForModuleUnit(SourceLocation Loc, Module *Parent)
Module * createModuleUnitWithKind(SourceLocation Loc, StringRef Name, Module::ModuleKind Kind)
Create a new C++ module with the specified kind, and reparent any pending global module fragment(s) t...
static ModuleHeaderRole headerKindToRole(Module::HeaderKind Kind)
Convert a header kind to a role. Requires Kind to not be HK_Excluded.
bool resolveUses(Module *Mod, bool Complain)
Resolve all of the unresolved uses in the given module.
Describes a module or submodule.
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
void addRequirement(StringRef Feature, bool RequiredState, const LangOptions &LangOpts, const TargetInfo &Target)
Add the given feature requirement to the list of features required by this module.
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
bool isForBuilding(const LangOptions &LangOpts) const
Determine whether this module can be built in this compilation.
std::variant< std::monostate, FileEntryRef, DirectoryEntryRef > Umbrella
The umbrella header or directory.
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
bool directlyUses(const Module *Requested)
Determine whether this module has declared its intention to directly use another module.
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
SourceLocation InferredSubmoduleLoc
The location of the inferred submodule.
unsigned IsUnimportable
Whether this module has declared itself unimportable, either because it's missing a requirement from ...
void print(raw_ostream &OS, unsigned Indent=0, bool Dump=false) const
Print the module map for this module to the given stream.
SourceLocation DefinitionLoc
The location of the module definition.
SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders
Headers that are mentioned in the module map file but could not be found on the file system.
Module * Parent
The parent of this module.
void markUnavailable(bool Unimportable)
Mark this module and all of its submodules as unavailable.
SmallVector< UnresolvedHeaderDirective, 1 > UnresolvedHeaders
Headers that are mentioned in the module map file but that we have not yet attempted to resolve to a ...
bool fullModuleNameIs(ArrayRef< StringRef > nameParts) const
Whether the full name of this module is equal to joining nameParts with "."s.
unsigned IsInferred
Whether this is an inferred submodule (module * { ... }).
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.
bool isSubFramework() const
Determine whether this module is a subframework of another framework.
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map.
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used.
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
void addHeader(HeaderKind HK, Header H)
std::string UmbrellaRelativeToRootModuleDirectory
OptionalDirectoryEntryRef Directory
The build directory of this module.
SmallVector< ModuleId, 2 > UnresolvedDirectUses
The set of use declarations that have yet to be resolved.
unsigned NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules.
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
ArrayRef< Header > getHeaders(HeaderKind HK) const
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
bool isSubModuleOf(const Module *Other) const
Check if this module is a (possibly transitive) submodule of Other.
bool isPartOfFramework() const
Determine whether this module is a part of a framework, either because it is a framework module or be...
bool isAvailable() const
Determine whether this module is available for use within the current translation unit.
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
@ ModuleImplementationUnit
This is a C++20 module implementation unit.
@ ImplicitGlobalModuleFragment
This is an implicit fragment of the global module which contains only language linkage declarations (...
@ ModuleInterfaceUnit
This is a C++20 module interface unit.
@ ModuleHeaderUnit
This is a C++20 header unit.
@ PrivateModuleFragment
This is the private module fragment within some C++ module.
@ ExplicitGlobalModuleFragment
This is the explicit Global Module Fragment of a modular TU.
unsigned IsFramework
Whether this is a framework module.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
std::string UmbrellaAsWritten
The name of the umbrella entry, as written in the module map.
unsigned IsAvailable
Whether this module is available in the current translation unit.
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
OptionalDirectoryEntryRef getEffectiveUmbrellaDir() const
Get the effective umbrella directory for this module: either the one explicitly written in the module...
bool UseExportAsModuleLinkName
Autolinking uses the framework name for linking purposes when this is false and the export_as name ot...
std::vector< Conflict > Conflicts
The list of conflicts.
Parser - This implements a parser for the C family of languages.
Encodes a location in the source.
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isValid() const
Return true if this is a valid SourceLocation object.
UIntTy getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it.
This class handles loading and caching of source files into memory.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
OptionalFileEntryRef getFileEntryRefForID(FileID FID) const
Returns the FileEntryRef for the provided FileID.
FileID createFileID(FileEntryRef SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, SourceLocation::UIntTy LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
FileManager & getFileManager() const
FileID getMainFileID() const
Returns the FileID of the main source file.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
std::optional< llvm::MemoryBufferRef > getBufferOrNone(FileID FID, SourceLocation Loc=SourceLocation()) const
Return the buffer for the specified FileID.
A trivial tuple used to represent a source range.
StringLiteralParser - This decodes string escape characters and performs wide string analysis and Tra...
StringLiteral - This represents a string literal expression, e.g.
Exposes information about the current target.
Token - This structure provides full information about a lexed token.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
unsigned getLength() const
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....
tok::TokenKind getKind() const
bool isAtStartOfLine() const
isAtStartOfLine - Return true if this token is at the start of a line.
bool hasUDSuffix() const
Return true if this token is a string or character literal which has a ud-suffix.
StringRef getRawIdentifier() const
getRawIdentifier - For a raw identifier token (i.e., an identifier lexed in raw mode),...
Defines the clang::TargetInfo interface.
bool Sub(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
LLVM_READONLY bool isAsciiIdentifierContinue(unsigned char c)
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
LLVM_READONLY bool isValidAsciiIdentifier(StringRef S, bool AllowDollar=false)
Return true if this is a valid ASCII identifier.
@ Result
The result type of a method or function.
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
A token in a module map file.
SourceLocation getLocation() const
bool is(TokenKind K) const
SourceLocation::UIntTy Location
StringRef getString() const
enum clang::MMToken::TokenKind Kind
uint64_t getInteger() const
A conflict between two modules.
Module * Other
The module that this module conflicts with.
std::string Message
The message provided to the user when there is a conflict.
A library or framework to link against when an entity from this module is used.
An unresolved conflict with another module.
std::string Message
The message provided to the user when there is a conflict.
ModuleId Id
The (unresolved) module id.
Describes an exported module that has not yet been resolved (perhaps because the module it refers to ...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4