23 #include "llvm/ADT/APInt.h"
24 #include "llvm/ADT/Hashing.h"
25 #include "llvm/ADT/SmallString.h"
26 #include "llvm/Support/Capacity.h"
27 #include "llvm/Support/FileSystem.h"
28 #include "llvm/Support/Path.h"
29 #include "llvm/Support/raw_ostream.h"
32 #if defined(LLVM_ON_UNIX)
35 using namespace clang;
59 : HSOpts(std::move(HSOpts)), Diags(Diags),
60 FileMgr(SourceMgr.getFileManager()), FrameworkMap(64),
61 ModMap(SourceMgr, Diags, LangOpts, Target, *this) {
64 NoCurDirSearch =
false;
66 ExternalLookup =
nullptr;
67 ExternalSource =
nullptr;
69 NumMultiIncludeFileOptzn = 0;
70 NumFrameworkLookups = NumSubFrameworkLookups = 0;
75 for (
unsigned i = 0, e = HeaderMaps.size(); i != e; ++i)
76 delete HeaderMaps[i].second;
80 fprintf(stderr,
"\n*** HeaderSearch Stats:\n");
81 fprintf(stderr,
"%d files tracked.\n", (
int)FileInfo.size());
82 unsigned NumOnceOnlyFiles = 0, MaxNumIncludes = 0, NumSingleIncludedFiles = 0;
83 for (
unsigned i = 0, e = FileInfo.size(); i != e; ++i) {
84 NumOnceOnlyFiles += FileInfo[i].isImport;
85 if (MaxNumIncludes < FileInfo[i].NumIncludes)
86 MaxNumIncludes = FileInfo[i].NumIncludes;
87 NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1;
89 fprintf(stderr,
" %d #import/#pragma once files.\n", NumOnceOnlyFiles);
90 fprintf(stderr,
" %d included exactly once.\n", NumSingleIncludedFiles);
91 fprintf(stderr,
" %d max times a file is included.\n", MaxNumIncludes);
93 fprintf(stderr,
" %d #include/#include_next/#import.\n", NumIncluded);
94 fprintf(stderr,
" %d #includes skipped due to"
95 " the multi-include optimization.\n", NumMultiIncludeFileOptzn);
97 fprintf(stderr,
"%d framework lookups.\n", NumFrameworkLookups);
98 fprintf(stderr,
"%d subframework lookups.\n", NumSubFrameworkLookups);
106 if (!HeaderMaps.empty()) {
107 for (
unsigned i = 0, e = HeaderMaps.size(); i != e; ++i)
110 if (HeaderMaps[i].first == FE)
111 return HeaderMaps[i].second;
115 HeaderMaps.push_back(std::make_pair(FE, HM));
129 StringRef ModuleMapPath) {
133 return std::string();
136 llvm::sys::fs::make_absolute(Result);
138 if (HSOpts->DisableModuleHash) {
139 llvm::sys::path::append(Result, ModuleName +
".pcm");
149 FileMgr.
getDirectory(llvm::sys::path::parent_path(ModuleMapPath));
151 return std::string();
153 auto FileName = llvm::sys::path::filename(ModuleMapPath);
155 llvm::hash_code Hash =
156 llvm::hash_combine(DirName.lower(),
FileName.lower());
159 llvm::APInt(64,
size_t(Hash)).toStringUnsigned(HashStr, 36);
160 llvm::sys::path::append(Result, ModuleName +
"-" + HashStr +
".pcm");
162 return Result.str().str();
168 if (Module || !AllowSearch || !HSOpts->ImplicitModuleMaps)
173 for (
unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
174 if (SearchDirs[Idx].isFramework()) {
177 FrameworkDirName += SearchDirs[Idx].getFrameworkDir()->getName();
178 llvm::sys::path::append(FrameworkDirName, ModuleName +
".framework");
183 Module = loadFrameworkModule(ModuleName, FrameworkDir, IsSystem);
192 if (!SearchDirs[Idx].isNormalDir())
195 bool IsSystem = SearchDirs[Idx].isSystemHeaderDirectory();
198 false) == LMM_NewlyLoaded) {
209 NestedModuleMapDirName = SearchDirs[Idx].getDir()->getName();
210 llvm::sys::path::append(NestedModuleMapDirName, ModuleName);
212 false) == LMM_NewlyLoaded){
221 if (SearchDirs[Idx].haveSearchedAllModuleMaps())
226 loadSubdirectoryModuleMaps(SearchDirs[Idx]);
248 assert(
isHeaderMap() &&
"Unknown DirectoryLookup");
252 const FileEntry *HeaderSearch::getFileAndSuggestModule(
254 bool IsSystemHeaderDir,
Module *RequestingModule,
263 if (!findUsableModuleForHeader(File, Dir ? Dir : File->
getDir(),
264 RequestingModule, SuggestedModule,
281 bool &InUserSpecifiedSystemFramework,
284 InUserSpecifiedSystemFramework =
false;
285 HasBeenMapped =
false;
291 llvm::sys::path::append(TmpDir, Filename);
295 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
298 RelativePath->clear();
299 RelativePath->append(Filename.begin(), Filename.end());
302 return HS.getFileAndSuggestModule(TmpDir, IncludeLoc,
getDir(),
304 RequestingModule, SuggestedModule);
308 return DoFrameworkLookup(Filename, HS, SearchPath, RelativePath,
309 RequestingModule, SuggestedModule,
310 InUserSpecifiedSystemFramework);
312 assert(
isHeaderMap() &&
"Unknown directory lookup");
324 if (llvm::sys::path::is_relative(Dest)) {
326 MappedName.append(Dest.begin(), Dest.end());
327 Filename = StringRef(MappedName.begin(), MappedName.size());
328 HasBeenMapped =
true;
337 StringRef SearchPathRef(
getName());
339 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
342 RelativePath->clear();
343 RelativePath->append(Filename.begin(), Filename.end());
358 assert(llvm::sys::path::extension(DirName) ==
".framework" &&
359 "Not a framework directory");
379 DirName = llvm::sys::path::parent_path(DirName);
390 if (llvm::sys::path::extension(DirName) ==
".framework") {
391 SubmodulePath.push_back(llvm::sys::path::stem(DirName));
392 TopFrameworkDir = Dir;
396 return TopFrameworkDir;
401 const FileEntry *DirectoryLookup::DoFrameworkLookup(
405 bool &InUserSpecifiedSystemFramework)
const {
409 size_t SlashPos = Filename.find(
'/');
410 if (SlashPos == StringRef::npos)
return nullptr;
414 HeaderSearch::FrameworkCacheEntry &CacheEntry =
426 if (FrameworkName.empty() || FrameworkName.back() !=
'/')
427 FrameworkName.push_back(
'/');
430 StringRef ModuleName(Filename.begin(), SlashPos);
431 FrameworkName += ModuleName;
434 FrameworkName +=
".framework/";
437 if (!CacheEntry.Directory) {
442 if (!Dir)
return nullptr;
452 SystemFrameworkMarker +=
".system_framework";
453 if (llvm::sys::fs::exists(SystemFrameworkMarker)) {
454 CacheEntry.IsUserSpecifiedSystemFramework =
true;
460 InUserSpecifiedSystemFramework = CacheEntry.IsUserSpecifiedSystemFramework;
463 RelativePath->clear();
464 RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
468 unsigned OrigSize = FrameworkName.size();
470 FrameworkName +=
"Headers/";
475 SearchPath->append(FrameworkName.begin(), FrameworkName.end()-1);
478 FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
483 const char *Private =
"Private";
484 FrameworkName.insert(FrameworkName.begin()+OrigSize, Private,
485 Private+strlen(Private));
487 SearchPath->insert(SearchPath->begin()+OrigSize, Private,
488 Private+strlen(Private));
490 FE = FileMgr.
getFile(FrameworkName, !SuggestedModule);
494 if (FE && SuggestedModule) {
497 bool FoundFramework =
false;
506 if (llvm::sys::path::extension(FrameworkPath) ==
".framework") {
507 FoundFramework =
true;
512 FrameworkPath = llvm::sys::path::parent_path(FrameworkPath);
513 if (FrameworkPath.empty())
518 if (FoundFramework) {
519 if (!HS.findUsableModuleForFrameworkHeader(
520 FE, FrameworkPath, RequestingModule, SuggestedModule, IsSystem))
523 if (!HS.findUsableModuleForHeader(FE,
getDir(), RequestingModule,
524 SuggestedModule, IsSystem))
546 if (MSFE && FE != MSFE) {
547 Diags.
Report(IncludeLoc, diag::ext_pp_include_search_ms) << MSFE->
getName();
553 static const char *
copyString(StringRef Str, llvm::BumpPtrAllocator &Alloc) {
554 assert(!Str.empty());
555 char *CopyStr = Alloc.Allocate<
char>(Str.size()+1);
556 std::copy(Str.begin(), Str.end(), CopyStr);
557 CopyStr[Str.size()] =
'\0';
569 ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>> Includers,
572 bool SkipCache,
bool BuildSystemModule) {
577 if (llvm::sys::path::is_absolute(Filename)) {
581 if (FromDir)
return nullptr;
586 RelativePath->clear();
587 RelativePath->append(Filename.begin(), Filename.end());
590 return getFileAndSuggestModule(Filename, IncludeLoc,
nullptr,
592 RequestingModule, SuggestedModule);
604 if (!Includers.empty() && !isAngled && !NoCurDirSearch) {
607 for (
const auto &IncluderAndDir : Includers) {
608 const FileEntry *Includer = IncluderAndDir.first;
612 TmpDir = IncluderAndDir.second->getName();
613 TmpDir.push_back(
'/');
614 TmpDir.append(Filename.begin(), Filename.end());
623 bool IncluderIsSystemHeader =
626 if (
const FileEntry *FE = getFileAndSuggestModule(
627 TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader,
628 RequestingModule, SuggestedModule)) {
630 assert(First &&
"only first includer can have no file");
641 unsigned DirInfo = FromHFI.
DirInfo;
651 StringRef SearchPathRef(IncluderAndDir.second->getName());
653 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
656 RelativePath->clear();
657 RelativePath->append(Filename.begin(), Filename.end());
665 if (Diags.
isIgnored(diag::ext_pp_include_search_ms, IncludeLoc)) {
669 if (SuggestedModule) {
670 MSSuggestedModule = *SuggestedModule;
683 unsigned i = isAngled ? AngledDirIdx : 0;
688 i = FromDir-&SearchDirs[0];
694 LookupFileCacheInfo &CacheLookup = LookupFileCache[
Filename];
699 if (!SkipCache && CacheLookup.StartIdx == i+1) {
701 i = CacheLookup.HitIdx;
702 if (CacheLookup.MappedName)
703 Filename = CacheLookup.MappedName;
708 CacheLookup.reset(i+1);
714 for (; i != SearchDirs.size(); ++i) {
715 bool InUserSpecifiedSystemFramework =
false;
716 bool HasBeenMapped =
false;
717 const FileEntry *FE = SearchDirs[i].LookupFile(
718 Filename, *
this, IncludeLoc, SearchPath, RelativePath, RequestingModule,
719 SuggestedModule, InUserSpecifiedSystemFramework, HasBeenMapped,
722 CacheLookup.MappedName =
723 copyString(Filename, LookupFileCache.getAllocator());
727 CurDir = &SearchDirs[i];
741 for (
unsigned j = SystemHeaderPrefixes.size(); j; --j) {
742 if (Filename.startswith(SystemHeaderPrefixes[j-1].first)) {
752 size_t SlashPos = Filename.find(
'/');
753 if (SlashPos != StringRef::npos) {
762 *SuggestedModule = MSSuggestedModule;
767 CacheLookup.HitIdx = i;
775 if (!Includers.empty() && Includers.front().first && !isAngled &&
776 Filename.find(
'/') == StringRef::npos) {
780 ScratchFilename += IncludingHFI.
Framework;
781 ScratchFilename +=
'/';
785 LookupFile(ScratchFilename, IncludeLoc,
true, FromDir,
786 CurDir, Includers.front(), SearchPath, RelativePath,
787 RequestingModule, SuggestedModule);
791 *SuggestedModule = MSSuggestedModule;
795 LookupFileCacheInfo &CacheLookup = LookupFileCache[
Filename];
796 CacheLookup.HitIdx = LookupFileCache[ScratchFilename].HitIdx;
804 *SuggestedModule = MSSuggestedModule;
809 CacheLookup.HitIdx = SearchDirs.size();
825 assert(ContextFileEnt &&
"No context file?");
829 size_t SlashPos = Filename.find(
'/');
830 if (SlashPos == StringRef::npos)
return nullptr;
833 const char *ContextName = ContextFileEnt->
getName();
836 const unsigned DotFrameworkLen = 10;
837 const char *FrameworkPos = strstr(ContextName,
".framework");
838 if (FrameworkPos ==
nullptr ||
839 (FrameworkPos[DotFrameworkLen] !=
'/' &&
840 FrameworkPos[DotFrameworkLen] !=
'\\'))
846 FrameworkName +=
"Frameworks/";
847 FrameworkName.append(Filename.begin(), Filename.begin()+SlashPos);
848 FrameworkName +=
".framework/";
851 *FrameworkMap.insert(std::make_pair(Filename.substr(0, SlashPos),
852 FrameworkCacheEntry())).first;
855 if (CacheLookup.second.Directory &&
856 CacheLookup.first().size() == FrameworkName.size() &&
857 memcmp(CacheLookup.first().data(), &FrameworkName[0],
858 CacheLookup.first().size()) != 0)
862 if (!CacheLookup.second.Directory) {
863 ++NumSubFrameworkLookups;
867 if (!Dir)
return nullptr;
871 CacheLookup.second.Directory = Dir;
877 RelativePath->clear();
878 RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
883 HeadersFilename +=
"Headers/";
887 SearchPath->append(HeadersFilename.begin(), HeadersFilename.end()-1);
890 HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
891 if (!(FE = FileMgr.
getFile(HeadersFilename,
true))) {
894 HeadersFilename = FrameworkName;
895 HeadersFilename +=
"PrivateHeaders/";
899 SearchPath->append(HeadersFilename.begin(), HeadersFilename.end()-1);
902 HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
903 if (!(FE = FileMgr.
getFile(HeadersFilename,
true)))
915 FrameworkName.pop_back();
916 if (!findUsableModuleForFrameworkHeader(FE, FrameworkName, RequestingModule,
917 SuggestedModule,
false))
931 assert(OtherHFI.
External &&
"expected to merge external HFI");
955 if (FE->
getUID() >= FileInfo.size())
956 FileInfo.resize(FE->
getUID() + 1);
960 if (ExternalSource && !HFI->
Resolved) {
964 HFI = &FileInfo[FE->
getUID()];
965 if (ExternalHFI.External)
978 bool WantExternal)
const {
982 if (ExternalSource) {
983 if (FE->
getUID() >= FileInfo.size()) {
986 FileInfo.resize(FE->
getUID() + 1);
989 HFI = &FileInfo[FE->
getUID()];
996 HFI = &FileInfo[FE->
getUID()];
997 if (ExternalHFI.External)
1000 }
else if (FE->
getUID() >= FileInfo.size()) {
1003 HFI = &FileInfo[FE->
getUID()];
1015 return HFI->isPragmaOnce || HFI->isImport || HFI->ControllingMacro ||
1016 HFI->ControllingMacroID;
1022 bool isCompilingModuleHeader) {
1026 if (!isCompilingModuleHeader) {
1027 if (!isModularHeader)
1030 if (HFI && HFI->isModuleHeader)
1035 HFI.isModuleHeader |= isModularHeader;
1036 HFI.isCompilingModuleHeader |= isCompilingModuleHeader;
1041 bool isImport,
Module *M) {
1071 ++NumMultiIncludeFileOptzn;
1083 return SearchDirs.capacity()
1084 + llvm::capacity_in_bytes(FileInfo)
1085 + llvm::capacity_in_bytes(HeaderMaps)
1086 + LookupFileCache.getAllocator().getTotalMemory()
1087 + FrameworkMap.getAllocator().getTotalMemory();
1091 return FrameworkNames.insert(Framework).first->first();
1097 if (!HSOpts->ImplicitModuleMaps)
1105 DirName = llvm::sys::path::parent_path(DirName);
1106 if (DirName.empty())
1116 llvm::sys::path::extension(Dir->
getName()) ==
1118 case LMM_NewlyLoaded:
1119 case LMM_AlreadyLoaded:
1122 for (
unsigned I = 0, N = FixUpDirectories.size();
I != N; ++
I)
1123 DirectoryHasModuleMap[FixUpDirectories[
I]] =
true;
1126 case LMM_NoDirectory:
1127 case LMM_InvalidModuleMap:
1137 FixUpDirectories.push_back(Dir);
1143 if (ExternalSource) {
1151 bool HeaderSearch::findUsableModuleForHeader(
1154 if (File && SuggestedModule) {
1162 bool HeaderSearch::findUsableModuleForFrameworkHeader(
1163 const FileEntry *File, StringRef FrameworkName,
Module *RequestingModule,
1166 if (SuggestedModule) {
1173 StringRef ModuleName = llvm::sys::path::stem(TopFrameworkDir->
getName());
1177 loadFrameworkModule(ModuleName, TopFrameworkDir, IsSystemFramework);
1190 StringRef Filename = llvm::sys::path::filename(File->
getName());
1192 if (Filename ==
"module.map")
1193 llvm::sys::path::append(PrivateFilename,
"module_private.map");
1194 else if (Filename ==
"module.modulemap")
1195 llvm::sys::path::append(PrivateFilename,
"module.private.modulemap");
1198 return FileMgr.
getFile(PrivateFilename);
1209 StringRef DirName(Dir->
getName());
1210 if (llvm::sys::path::filename(DirName) ==
"Modules") {
1211 DirName = llvm::sys::path::parent_path(DirName);
1212 if (DirName.endswith(
".framework"))
1216 assert(Dir &&
"parent must exist");
1220 switch (loadModuleMapFileImpl(File, IsSystem, Dir)) {
1221 case LMM_AlreadyLoaded:
1222 case LMM_NewlyLoaded:
1224 case LMM_NoDirectory:
1225 case LMM_InvalidModuleMap:
1228 llvm_unreachable(
"Unknown load module map result");
1231 HeaderSearch::LoadModuleMapResult
1232 HeaderSearch::loadModuleMapFileImpl(
const FileEntry *File,
bool IsSystem,
1234 assert(File &&
"expected FileEntry");
1238 auto AddResult = LoadedModuleMaps.insert(std::make_pair(File,
true));
1239 if (!AddResult.second)
1240 return AddResult.first->second ? LMM_AlreadyLoaded : LMM_InvalidModuleMap;
1243 LoadedModuleMaps[File] =
false;
1244 return LMM_InvalidModuleMap;
1250 LoadedModuleMaps[File] =
false;
1251 return LMM_InvalidModuleMap;
1256 return LMM_NewlyLoaded;
1261 if (!HSOpts->ImplicitModuleMaps)
1267 llvm::sys::path::append(ModuleMapFileName,
"Modules");
1268 llvm::sys::path::append(ModuleMapFileName,
"module.modulemap");
1273 ModuleMapFileName = Dir->
getName();
1274 llvm::sys::path::append(ModuleMapFileName,
"module.map");
1275 return FileMgr.
getFile(ModuleMapFileName);
1278 Module *HeaderSearch::loadFrameworkModule(StringRef
Name,
1286 case LMM_InvalidModuleMap:
1288 if (HSOpts->ImplicitModuleMaps)
1289 ModMap.inferFrameworkModule(Dir, IsSystem,
nullptr);
1292 case LMM_AlreadyLoaded:
1293 case LMM_NoDirectory:
1296 case LMM_NewlyLoaded:
1304 HeaderSearch::LoadModuleMapResult
1310 return LMM_NoDirectory;
1313 HeaderSearch::LoadModuleMapResult
1316 auto KnownDir = DirectoryHasModuleMap.find(Dir);
1317 if (KnownDir != DirectoryHasModuleMap.end())
1318 return KnownDir->second ? LMM_AlreadyLoaded : LMM_InvalidModuleMap;
1321 LoadModuleMapResult
Result =
1322 loadModuleMapFileImpl(ModuleMapFile, IsSystem, Dir);
1326 if (Result == LMM_NewlyLoaded)
1327 DirectoryHasModuleMap[Dir] =
true;
1328 else if (Result == LMM_InvalidModuleMap)
1329 DirectoryHasModuleMap[Dir] =
false;
1332 return LMM_InvalidModuleMap;
1338 if (HSOpts->ImplicitModuleMaps) {
1340 for (
unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
1341 bool IsSystem = SearchDirs[Idx].isSystemHeaderDirectory();
1342 if (SearchDirs[Idx].isFramework()) {
1345 llvm::sys::path::native(SearchDirs[Idx].getFrameworkDir()->getName(),
1351 Dir != DirEnd && !EC; Dir.increment(EC)) {
1352 if (llvm::sys::path::extension(Dir->
getName()) !=
".framework")
1361 loadFrameworkModule(llvm::sys::path::stem(Dir->
getName()),
1362 FrameworkDir, IsSystem);
1368 if (SearchDirs[Idx].isHeaderMap())
1377 loadSubdirectoryModuleMaps(SearchDirs[Idx]);
1385 Modules.push_back(M->getValue());
1390 if (!HSOpts->ImplicitModuleMaps)
1394 for (
unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
1396 if (!SearchDirs[Idx].isNormalDir()) {
1402 SearchDirs[Idx].isSystemHeaderDirectory(),
1403 SearchDirs[Idx].isFramework());
1407 void HeaderSearch::loadSubdirectoryModuleMaps(
DirectoryLookup &SearchDir) {
1408 assert(HSOpts->ImplicitModuleMaps &&
1409 "Should not be loading subdirectory module maps");
1416 llvm::sys::path::native(SearchDir.
getDir()->
getName(), DirNative);
1419 Dir != DirEnd && !EC; Dir.increment(EC)) {
1421 llvm::sys::path::extension(Dir->
getName()) ==
".framework";
1435 const char *Name = File->
getName();
1437 unsigned BestPrefixLength = 0;
1438 unsigned BestSearchDir;
1440 for (
unsigned I = 0;
I != SearchDirs.size(); ++
I) {
1442 if (!SearchDirs[
I].isNormalDir())
1445 const char *Dir = SearchDirs[
I].getDir()->getName();
1452 while (NI != NE && *NI ==
".")
1458 while (DI != DE && *DI ==
".")
1464 if (PrefixLength > BestPrefixLength) {
1465 BestPrefixLength = PrefixLength;
1477 *IsSystem = BestPrefixLength ? BestSearchDir >= SystemDirIdx :
false;
1478 return Name + BestPrefixLength;
std::string Name
The name of this module.
bool parseModuleMapFile(const FileEntry *File, bool IsSystem, const DirectoryEntry *HomeDir, SourceLocation ExternModuleLoc=SourceLocation())
Parse the given module map file, and record any modules we encounter.
module_iterator module_begin() const
Implements support for file system lookup, file system caching, and directory search management...
Defines the clang::FileManager interface and associated types.
Module * findModule(StringRef Name) const
Retrieve a module with the given name.
This header is part of the module (for layering purposes) but should be textually included...
SrcMgr::CharacteristicKind getDirCharacteristic() const
DirCharacteristic - The type of directory this is, one of the DirType enum values.
virtual IdentifierInfo * GetIdentifier(unsigned ID)=0
Return the identifier associated with the given ID number.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
virtual directory_iterator dir_begin(const Twine &Dir, std::error_code &EC)=0
Get a directory_iterator for Dir.
The virtual file system interface.
One of these records is kept for each identifier that is lexed.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isFramework() const
isFramework - True if this is a framework directory.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Describes a module or submodule.
IntrusiveRefCntPtr< vfs::FileSystem > getVirtualFileSystem() const
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
Concrete class used by the front-end to report problems and issues.
bool isMacroDefinedInLocalModule(const IdentifierInfo *II, Module *M)
Determine whether II is defined as a macro within the module M, if that is a module that we've alread...
module_iterator module_end() const
detail::InMemoryDirectory::const_iterator I
void setTarget(const TargetInfo &Target)
Set the target information.
llvm::StringMap< Module * >::const_iterator module_iterator
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
const DirectoryEntry * getDirectory(StringRef DirName, bool CacheFailure=true)
Lookup, cache, and verify the specified directory (real or virtual).
const HeaderMap * getHeaderMap() const
getHeaderMap - Return the directory that this entry refers to.
ModuleHeaderRole
Flags describing the role of a module header.
Exposes information about the current target.
Abstract interface for external sources of preprocessor information.
bool isSystemHeaderDirectory() const
Whether this describes a system header directory.
Defines the clang::Preprocessor interface.
bool isNormalDir() const
isNormalDir - Return true if this is a normal directory, not a header map.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const FileEntry * LookupFile(StringRef &Filename, HeaderSearch &HS, SourceLocation IncludeLoc, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule, bool &InUserSpecifiedSystemFramework, bool &HasBeenMapped, SmallVectorImpl< char > &MappedName) const
LookupFile - Lookup the specified file in this search path, returning it if it exists or returning nu...
The result type of a method or function.
DirectoryLookup - This class represents one entry in the search list that specifies the search order ...
bool haveSearchedAllModuleMaps() const
Determine whether we have already searched this entire directory for module maps. ...
const char * getName() const
const DirectoryEntry * getFrameworkDir() const
getFrameworkDir - Return the directory that this framework refers to.
Encodes a location in the source.
Cached information about one file (either on disk or in the virtual file system). ...
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
const char * getName() const
bool isMacroDefined(StringRef Id)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
StringRef getCanonicalName(const DirectoryEntry *Dir)
Retrieve the canonical name for a given directory.
const FileEntry * getModuleMapFileForUniquing(const Module *M) const
Get the module map file that (along with the module name) uniquely identifies this module...
virtual void updateOutOfDateIdentifier(IdentifierInfo &II)=0
Update an out-of-date identifier.
const char * getName() const
getName - Return the directory or filename corresponding to this lookup object.
KnownHeader findModuleForHeader(const FileEntry *File)
Retrieve the module that owns the given header file, if any.
Cached information about one directory (either on disk or in the virtual file system).
An input iterator over the entries in a virtual path, similar to llvm::sys::fs::directory_iterator.
bool isHeaderMap() const
isHeaderMap - Return true if this is a header map, not a normal directory.
bool isIndexHeaderMap() const
Whether this header map is building a framework or not.
const DirectoryEntry * getDir() const
getDir - Return the directory that this entry refers to.
void setSearchedAllModuleMaps(bool SAMM)
Specify whether we have already searched all of the subdirectories for module maps.
const DirectoryEntry * getDir() const
Return the directory the file lives in.
This class handles loading and caching of source files into memory.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.