24 #include "llvm/ADT/APInt.h"
25 #include "llvm/ADT/Hashing.h"
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/Support/Capacity.h"
28 #include "llvm/Support/FileSystem.h"
29 #include "llvm/Support/Path.h"
30 #include "llvm/Support/raw_ostream.h"
32 #if defined(LLVM_ON_UNIX)
35 using namespace clang;
59 : HSOpts(HSOpts), Diags(Diags), FileMgr(SourceMgr.getFileManager()),
60 FrameworkMap(64), 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(
253 StringRef FileName,
const DirectoryEntry *Dir,
bool IsSystemHeaderDir,
262 if (!findUsableModuleForHeader(File, Dir ? Dir : File->
getDir(),
263 RequestingModule, SuggestedModule,
279 bool &InUserSpecifiedSystemFramework,
282 InUserSpecifiedSystemFramework =
false;
283 HasBeenMapped =
false;
289 llvm::sys::path::append(TmpDir, Filename);
293 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
296 RelativePath->clear();
297 RelativePath->append(Filename.begin(), Filename.end());
300 return HS.getFileAndSuggestModule(TmpDir,
getDir(),
302 RequestingModule, SuggestedModule);
306 return DoFrameworkLookup(Filename, HS, SearchPath, RelativePath,
307 RequestingModule, SuggestedModule,
308 InUserSpecifiedSystemFramework);
310 assert(
isHeaderMap() &&
"Unknown directory lookup");
322 if (llvm::sys::path::is_relative(Dest)) {
324 MappedName.append(Dest.begin(), Dest.end());
325 Filename = StringRef(MappedName.begin(), MappedName.size());
326 HasBeenMapped =
true;
335 StringRef SearchPathRef(
getName());
337 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
340 RelativePath->clear();
341 RelativePath->append(Filename.begin(), Filename.end());
356 assert(llvm::sys::path::extension(DirName) ==
".framework" &&
357 "Not a framework directory");
377 DirName = llvm::sys::path::parent_path(DirName);
388 if (llvm::sys::path::extension(DirName) ==
".framework") {
389 SubmodulePath.push_back(llvm::sys::path::stem(DirName));
390 TopFrameworkDir = Dir;
394 return TopFrameworkDir;
399 const FileEntry *DirectoryLookup::DoFrameworkLookup(
403 bool &InUserSpecifiedSystemFramework)
const {
407 size_t SlashPos = Filename.find(
'/');
408 if (SlashPos == StringRef::npos)
return nullptr;
412 HeaderSearch::FrameworkCacheEntry &CacheEntry =
424 if (FrameworkName.empty() || FrameworkName.back() !=
'/')
425 FrameworkName.push_back(
'/');
428 StringRef ModuleName(Filename.begin(), SlashPos);
429 FrameworkName += ModuleName;
432 FrameworkName +=
".framework/";
435 if (!CacheEntry.Directory) {
440 if (!Dir)
return nullptr;
450 SystemFrameworkMarker +=
".system_framework";
451 if (llvm::sys::fs::exists(SystemFrameworkMarker)) {
452 CacheEntry.IsUserSpecifiedSystemFramework =
true;
458 InUserSpecifiedSystemFramework = CacheEntry.IsUserSpecifiedSystemFramework;
461 RelativePath->clear();
462 RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
466 unsigned OrigSize = FrameworkName.size();
468 FrameworkName +=
"Headers/";
473 SearchPath->append(FrameworkName.begin(), FrameworkName.end()-1);
476 FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
481 const char *Private =
"Private";
482 FrameworkName.insert(FrameworkName.begin()+OrigSize, Private,
483 Private+strlen(Private));
485 SearchPath->insert(SearchPath->begin()+OrigSize, Private,
486 Private+strlen(Private));
488 FE = FileMgr.
getFile(FrameworkName, !SuggestedModule);
492 if (FE && SuggestedModule) {
495 bool FoundFramework =
false;
504 if (llvm::sys::path::extension(FrameworkPath) ==
".framework") {
505 FoundFramework =
true;
510 FrameworkPath = llvm::sys::path::parent_path(FrameworkPath);
511 if (FrameworkPath.empty())
516 if (FoundFramework) {
517 if (!HS.findUsableModuleForFrameworkHeader(
518 FE, FrameworkPath, RequestingModule, SuggestedModule, IsSystem))
521 if (!HS.findUsableModuleForHeader(FE,
getDir(), RequestingModule,
522 SuggestedModule, IsSystem))
544 if (MSFE && FE != MSFE) {
545 Diags.
Report(IncludeLoc, diag::ext_pp_include_search_ms) << MSFE->
getName();
551 static const char *
copyString(StringRef Str, llvm::BumpPtrAllocator &Alloc) {
552 assert(!Str.empty());
553 char *CopyStr = Alloc.Allocate<
char>(Str.size()+1);
554 std::copy(Str.begin(), Str.end(), CopyStr);
555 CopyStr[Str.size()] =
'\0';
567 ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>> Includers,
575 if (llvm::sys::path::is_absolute(Filename)) {
579 if (FromDir)
return nullptr;
584 RelativePath->clear();
585 RelativePath->append(Filename.begin(), Filename.end());
588 return getFileAndSuggestModule(Filename,
nullptr,
590 RequestingModule, SuggestedModule);
602 if (!Includers.empty() && !isAngled && !NoCurDirSearch) {
605 for (
const auto &IncluderAndDir : Includers) {
606 const FileEntry *Includer = IncluderAndDir.first;
610 TmpDir = IncluderAndDir.second->getName();
611 TmpDir.push_back(
'/');
612 TmpDir.append(Filename.begin(), Filename.end());
621 bool IncluderIsSystemHeader =
623 if (
const FileEntry *FE = getFileAndSuggestModule(
624 TmpDir, IncluderAndDir.second, IncluderIsSystemHeader,
625 RequestingModule, SuggestedModule)) {
627 assert(First &&
"only first includer can have no file");
638 unsigned DirInfo = FromHFI.
DirInfo;
648 StringRef SearchPathRef(IncluderAndDir.second->getName());
650 SearchPath->append(SearchPathRef.begin(), SearchPathRef.end());
653 RelativePath->clear();
654 RelativePath->append(Filename.begin(), Filename.end());
662 if (Diags.
isIgnored(diag::ext_pp_include_search_ms, IncludeLoc)) {
666 if (SuggestedModule) {
667 MSSuggestedModule = *SuggestedModule;
680 unsigned i = isAngled ? AngledDirIdx : 0;
685 i = FromDir-&SearchDirs[0];
691 LookupFileCacheInfo &CacheLookup = LookupFileCache[
Filename];
696 if (!SkipCache && CacheLookup.StartIdx == i+1) {
698 i = CacheLookup.HitIdx;
699 if (CacheLookup.MappedName)
700 Filename = CacheLookup.MappedName;
705 CacheLookup.reset(i+1);
711 for (; i != SearchDirs.size(); ++i) {
712 bool InUserSpecifiedSystemFramework =
false;
713 bool HasBeenMapped =
false;
714 const FileEntry *FE = SearchDirs[i].LookupFile(
715 Filename, *
this, SearchPath, RelativePath, RequestingModule,
716 SuggestedModule, InUserSpecifiedSystemFramework, HasBeenMapped,
719 CacheLookup.MappedName =
720 copyString(Filename, LookupFileCache.getAllocator());
724 CurDir = &SearchDirs[i];
738 for (
unsigned j = SystemHeaderPrefixes.size(); j; --j) {
739 if (Filename.startswith(SystemHeaderPrefixes[j-1].first)) {
749 size_t SlashPos = Filename.find(
'/');
750 if (SlashPos != StringRef::npos) {
759 *SuggestedModule = MSSuggestedModule;
764 CacheLookup.HitIdx = i;
772 if (!Includers.empty() && Includers.front().first && !isAngled &&
773 Filename.find(
'/') == StringRef::npos) {
777 ScratchFilename += IncludingHFI.
Framework;
778 ScratchFilename +=
'/';
782 LookupFile(ScratchFilename, IncludeLoc,
true, FromDir,
783 CurDir, Includers.front(), SearchPath, RelativePath,
784 RequestingModule, SuggestedModule);
788 *SuggestedModule = MSSuggestedModule;
792 LookupFileCacheInfo &CacheLookup = LookupFileCache[
Filename];
793 CacheLookup.HitIdx = LookupFileCache[ScratchFilename].HitIdx;
801 *SuggestedModule = MSSuggestedModule;
806 CacheLookup.HitIdx = SearchDirs.size();
822 assert(ContextFileEnt &&
"No context file?");
826 size_t SlashPos = Filename.find(
'/');
827 if (SlashPos == StringRef::npos)
return nullptr;
830 const char *ContextName = ContextFileEnt->
getName();
833 const unsigned DotFrameworkLen = 10;
834 const char *FrameworkPos = strstr(ContextName,
".framework");
835 if (FrameworkPos ==
nullptr ||
836 (FrameworkPos[DotFrameworkLen] !=
'/' &&
837 FrameworkPos[DotFrameworkLen] !=
'\\'))
843 FrameworkName +=
"Frameworks/";
844 FrameworkName.append(Filename.begin(), Filename.begin()+SlashPos);
845 FrameworkName +=
".framework/";
848 *FrameworkMap.insert(std::make_pair(Filename.substr(0, SlashPos),
849 FrameworkCacheEntry())).first;
852 if (CacheLookup.second.Directory &&
853 CacheLookup.first().size() == FrameworkName.size() &&
854 memcmp(CacheLookup.first().data(), &FrameworkName[0],
855 CacheLookup.first().size()) != 0)
859 if (!CacheLookup.second.Directory) {
860 ++NumSubFrameworkLookups;
864 if (!Dir)
return nullptr;
868 CacheLookup.second.Directory = Dir;
874 RelativePath->clear();
875 RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
880 HeadersFilename +=
"Headers/";
884 SearchPath->append(HeadersFilename.begin(), HeadersFilename.end()-1);
887 HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
888 if (!(FE = FileMgr.
getFile(HeadersFilename,
true))) {
891 HeadersFilename = FrameworkName;
892 HeadersFilename +=
"PrivateHeaders/";
896 SearchPath->append(HeadersFilename.begin(), HeadersFilename.end()-1);
899 HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
900 if (!(FE = FileMgr.
getFile(HeadersFilename,
true)))
912 FrameworkName.pop_back();
913 if (!findUsableModuleForFrameworkHeader(FE, FrameworkName, RequestingModule,
914 SuggestedModule,
false))
928 assert(OtherHFI.
External &&
"expected to merge external HFI");
952 if (FE->
getUID() >= FileInfo.size())
953 FileInfo.resize(FE->
getUID() + 1);
957 if (ExternalSource && !HFI->
Resolved) {
961 HFI = &FileInfo[FE->
getUID()];
962 if (ExternalHFI.External)
975 bool WantExternal)
const {
979 if (ExternalSource) {
980 if (FE->
getUID() >= FileInfo.size()) {
983 FileInfo.resize(FE->
getUID() + 1);
986 HFI = &FileInfo[FE->
getUID()];
993 HFI = &FileInfo[FE->
getUID()];
994 if (ExternalHFI.External)
997 }
else if (FE->
getUID() >= FileInfo.size()) {
1000 HFI = &FileInfo[FE->
getUID()];
1012 return HFI->isPragmaOnce || HFI->isImport || HFI->ControllingMacro ||
1013 HFI->ControllingMacroID;
1019 bool isCompilingModuleHeader) {
1023 if (!isCompilingModuleHeader) {
1024 if (!isModularHeader)
1027 if (HFI && HFI->isModuleHeader)
1032 HFI.isModuleHeader |= isModularHeader;
1033 HFI.isCompilingModuleHeader |= isCompilingModuleHeader;
1038 bool isImport,
Module *M) {
1068 ++NumMultiIncludeFileOptzn;
1080 return SearchDirs.capacity()
1081 + llvm::capacity_in_bytes(FileInfo)
1082 + llvm::capacity_in_bytes(HeaderMaps)
1083 + LookupFileCache.getAllocator().getTotalMemory()
1084 + FrameworkMap.getAllocator().getTotalMemory();
1088 return FrameworkNames.insert(Framework).first->first();
1094 if (!HSOpts->ImplicitModuleMaps)
1099 StringRef DirName = FileName;
1102 DirName = llvm::sys::path::parent_path(DirName);
1103 if (DirName.empty())
1113 llvm::sys::path::extension(Dir->
getName()) ==
1115 case LMM_NewlyLoaded:
1116 case LMM_AlreadyLoaded:
1119 for (
unsigned I = 0, N = FixUpDirectories.size();
I != N; ++
I)
1120 DirectoryHasModuleMap[FixUpDirectories[
I]] =
true;
1123 case LMM_NoDirectory:
1124 case LMM_InvalidModuleMap:
1134 FixUpDirectories.push_back(Dir);
1140 if (ExternalSource) {
1148 bool HeaderSearch::findUsableModuleForHeader(
1151 if (File && SuggestedModule) {
1159 bool HeaderSearch::findUsableModuleForFrameworkHeader(
1160 const FileEntry *File, StringRef FrameworkName,
Module *RequestingModule,
1163 if (SuggestedModule) {
1170 StringRef ModuleName = llvm::sys::path::stem(TopFrameworkDir->
getName());
1174 loadFrameworkModule(ModuleName, TopFrameworkDir, IsSystemFramework);
1187 StringRef Filename = llvm::sys::path::filename(File->
getName());
1189 if (Filename ==
"module.map")
1190 llvm::sys::path::append(PrivateFilename,
"module_private.map");
1191 else if (Filename ==
"module.modulemap")
1192 llvm::sys::path::append(PrivateFilename,
"module.private.modulemap");
1195 return FileMgr.
getFile(PrivateFilename);
1206 StringRef DirName(Dir->
getName());
1207 if (llvm::sys::path::filename(DirName) ==
"Modules") {
1208 DirName = llvm::sys::path::parent_path(DirName);
1209 if (DirName.endswith(
".framework"))
1213 assert(Dir &&
"parent must exist");
1217 switch (loadModuleMapFileImpl(File, IsSystem, Dir)) {
1218 case LMM_AlreadyLoaded:
1219 case LMM_NewlyLoaded:
1221 case LMM_NoDirectory:
1222 case LMM_InvalidModuleMap:
1225 llvm_unreachable(
"Unknown load module map result");
1228 HeaderSearch::LoadModuleMapResult
1229 HeaderSearch::loadModuleMapFileImpl(
const FileEntry *File,
bool IsSystem,
1231 assert(File &&
"expected FileEntry");
1235 auto AddResult = LoadedModuleMaps.insert(std::make_pair(File,
true));
1236 if (!AddResult.second)
1237 return AddResult.first->second ? LMM_AlreadyLoaded : LMM_InvalidModuleMap;
1240 LoadedModuleMaps[File] =
false;
1241 return LMM_InvalidModuleMap;
1247 LoadedModuleMaps[File] =
false;
1248 return LMM_InvalidModuleMap;
1253 return LMM_NewlyLoaded;
1258 if (!HSOpts->ImplicitModuleMaps)
1264 llvm::sys::path::append(ModuleMapFileName,
"Modules");
1265 llvm::sys::path::append(ModuleMapFileName,
"module.modulemap");
1270 ModuleMapFileName = Dir->
getName();
1271 llvm::sys::path::append(ModuleMapFileName,
"module.map");
1272 return FileMgr.
getFile(ModuleMapFileName);
1275 Module *HeaderSearch::loadFrameworkModule(StringRef
Name,
1283 case LMM_InvalidModuleMap:
1285 if (HSOpts->ImplicitModuleMaps)
1286 ModMap.inferFrameworkModule(Dir, IsSystem,
nullptr);
1289 case LMM_AlreadyLoaded:
1290 case LMM_NoDirectory:
1293 case LMM_NewlyLoaded:
1301 HeaderSearch::LoadModuleMapResult
1307 return LMM_NoDirectory;
1310 HeaderSearch::LoadModuleMapResult
1313 auto KnownDir = DirectoryHasModuleMap.find(Dir);
1314 if (KnownDir != DirectoryHasModuleMap.end())
1315 return KnownDir->second ? LMM_AlreadyLoaded : LMM_InvalidModuleMap;
1318 LoadModuleMapResult
Result =
1319 loadModuleMapFileImpl(ModuleMapFile, IsSystem, Dir);
1323 if (Result == LMM_NewlyLoaded)
1324 DirectoryHasModuleMap[Dir] =
true;
1325 else if (Result == LMM_InvalidModuleMap)
1326 DirectoryHasModuleMap[Dir] =
false;
1329 return LMM_InvalidModuleMap;
1335 if (HSOpts->ImplicitModuleMaps) {
1337 for (
unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
1338 bool IsSystem = SearchDirs[Idx].isSystemHeaderDirectory();
1339 if (SearchDirs[Idx].isFramework()) {
1342 llvm::sys::path::native(SearchDirs[Idx].getFrameworkDir()->getName(),
1346 for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
1347 Dir != DirEnd && !EC; Dir.increment(EC)) {
1348 if (llvm::sys::path::extension(Dir->path()) !=
".framework")
1357 loadFrameworkModule(llvm::sys::path::stem(Dir->path()), FrameworkDir,
1364 if (SearchDirs[Idx].isHeaderMap())
1373 loadSubdirectoryModuleMaps(SearchDirs[Idx]);
1381 Modules.push_back(M->getValue());
1386 if (!HSOpts->ImplicitModuleMaps)
1390 for (
unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
1392 if (!SearchDirs[Idx].isNormalDir()) {
1398 SearchDirs[Idx].isSystemHeaderDirectory(),
1399 SearchDirs[Idx].isFramework());
1403 void HeaderSearch::loadSubdirectoryModuleMaps(
DirectoryLookup &SearchDir) {
1404 assert(HSOpts->ImplicitModuleMaps &&
1405 "Should not be loading subdirectory module maps");
1412 llvm::sys::path::native(SearchDir.
getDir()->
getName(), DirNative);
1413 for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
1414 Dir != DirEnd && !EC; Dir.increment(EC)) {
1415 bool IsFramework = llvm::sys::path::extension(Dir->path()) ==
".framework";
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...
const FileEntry * LookupFile(StringRef &Filename, HeaderSearch &HS, 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...
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.
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.
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.
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).
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.