clang  6.0.0svn
Classes | Public Types | Public Member Functions | Friends | List of all members
clang::HeaderSearch Class Reference

Encapsulates the information needed to find the file referenced by a #include or #include_next, (sub-)framework lookup, etc. More...

#include "clang/Lex/HeaderSearch.h"

Public Types

using search_dir_iterator = std::vector< DirectoryLookup >::const_iterator
 

Public Member Functions

 HeaderSearch (std::shared_ptr< HeaderSearchOptions > HSOpts, SourceManager &SourceMgr, DiagnosticsEngine &Diags, const LangOptions &LangOpts, const TargetInfo *Target)
 
 HeaderSearch (const HeaderSearch &)=delete
 
HeaderSearchoperator= (const HeaderSearch &)=delete
 
 ~HeaderSearch ()
 
HeaderSearchOptionsgetHeaderSearchOpts () const
 Retrieve the header-search options with which this header search was initialized. More...
 
FileManagergetFileMgr () const
 
void SetSearchPaths (const std::vector< DirectoryLookup > &dirs, unsigned angledDirIdx, unsigned systemDirIdx, bool noCurDirSearch)
 Interface for setting the file search paths. More...
 
void AddSearchPath (const DirectoryLookup &dir, bool isAngled)
 Add an additional search path. More...
 
void SetSystemHeaderPrefixes (ArrayRef< std::pair< std::string, bool >> P)
 Set the list of system header prefixes. More...
 
bool HasIncludeAliasMap () const
 Checks whether the map exists or not. More...
 
void AddIncludeAlias (StringRef Source, StringRef Dest)
 Map the source include name to the dest include name. More...
 
StringRef MapHeaderToIncludeAlias (StringRef Source)
 MapHeaderToIncludeAlias - Maps one header file name to a different header file name, for use with the include_alias pragma. More...
 
void setModuleCachePath (StringRef CachePath)
 Set the path to the module cache. More...
 
StringRef getModuleCachePath () const
 Retrieve the path to the module cache. More...
 
void setDirectoryHasModuleMap (const DirectoryEntry *Dir)
 Consider modules when including files from this directory. More...
 
void ClearFileInfo ()
 Forget everything we know about headers so far. More...
 
void SetExternalLookup (ExternalPreprocessorSource *EPS)
 
ExternalPreprocessorSourcegetExternalLookup () const
 
void SetExternalSource (ExternalHeaderFileInfoSource *ES)
 Set the external source of header information. More...
 
void setTarget (const TargetInfo &Target)
 Set the target information for the header search, if not already known. More...
 
const FileEntryLookupFile (StringRef Filename, SourceLocation IncludeLoc, bool isAngled, const DirectoryLookup *FromDir, const DirectoryLookup *&CurDir, ArrayRef< std::pair< const FileEntry *, const DirectoryEntry *>> Includers, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule, bool *IsMapped, bool SkipCache=false, bool BuildSystemModule=false)
 Given a "foo" or <foo> reference, look up the indicated file, return null on failure. More...
 
const FileEntryLookupSubframeworkHeader (StringRef Filename, const FileEntry *RelativeFileEnt, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule)
 Look up a subframework for the specified #include file. More...
 
FrameworkCacheEntry & LookupFrameworkCache (StringRef FWName)
 Look up the specified framework name in our framework cache. More...
 
bool ShouldEnterIncludeFile (Preprocessor &PP, const FileEntry *File, bool isImport, bool ModulesEnabled, Module *CorrespondingModule)
 Mark the specified file as a target of of a #include, #include_next, or #import directive. More...
 
SrcMgr::CharacteristicKind getFileDirFlavor (const FileEntry *File)
 Return whether the specified file is a normal header, a system header, or a C++ friendly system header. More...
 
void MarkFileIncludeOnce (const FileEntry *File)
 Mark the specified file as a "once only" file, e.g. More...
 
void MarkFileSystemHeader (const FileEntry *File)
 Mark the specified file as a system header, e.g. More...
 
void MarkFileModuleHeader (const FileEntry *File, ModuleMap::ModuleHeaderRole Role, bool IsCompiledModuleHeader)
 Mark the specified file as part of a module. More...
 
void IncrementIncludeCount (const FileEntry *File)
 Increment the count for the number of times the specified FileEntry has been entered. More...
 
void SetFileControllingMacro (const FileEntry *File, const IdentifierInfo *ControllingMacro)
 Mark the specified file as having a controlling macro. More...
 
bool FirstTimeLexingFile (const FileEntry *File)
 Return true if this is the first time encountering this header. More...
 
bool isFileMultipleIncludeGuarded (const FileEntry *File)
 Determine whether this file is intended to be safe from multiple inclusions, e.g., it has #pragma once or a controlling macro. More...
 
const HeaderMapCreateHeaderMap (const FileEntry *FE)
 CreateHeaderMap - This method returns a HeaderMap for the specified FileEntry, uniquing them through the 'HeaderMaps' datastructure. More...
 
void getHeaderMapFileNames (SmallVectorImpl< std::string > &Names) const
 Get filenames for all registered header maps. More...
 
std::string getCachedModuleFileName (Module *Module)
 Retrieve the name of the cached module file that should be used to load the given module. More...
 
std::string getPrebuiltModuleFileName (StringRef ModuleName, bool FileMapOnly=false)
 Retrieve the name of the prebuilt module file that should be used to load a module with the given name. More...
 
std::string getCachedModuleFileName (StringRef ModuleName, StringRef ModuleMapPath)
 Retrieve the name of the (to-be-)cached module file that should be used to load a module with the given name. More...
 
ModulelookupModule (StringRef ModuleName, bool AllowSearch=true)
 Lookup a module Search for a module with the given name. More...
 
const FileEntrylookupModuleMapFile (const DirectoryEntry *Dir, bool IsFramework)
 Try to find a module map file in the given directory, returning nullptr if none is found. More...
 
void IncrementFrameworkLookupCount ()
 
bool hasModuleMap (StringRef Filename, const DirectoryEntry *Root, bool IsSystem)
 Determine whether there is a module map that may map the header with the given file name to a (sub)module. More...
 
ModuleMap::KnownHeader findModuleForHeader (const FileEntry *File, bool AllowTextual=false) const
 Retrieve the module that corresponds to the given file, if any. More...
 
bool loadModuleMapFile (const FileEntry *File, bool IsSystem, FileID ID=FileID(), unsigned *Offset=nullptr, StringRef OriginalModuleMapFile=StringRef())
 Read the contents of the given module map file. More...
 
void collectAllModules (SmallVectorImpl< Module *> &Modules)
 Collect the set of all known, top-level modules. More...
 
void loadTopLevelSystemModules ()
 Load all known, top-level system modules. More...
 
ModuleMapgetModuleMap ()
 Retrieve the module map. More...
 
const ModuleMapgetModuleMap () const
 Retrieve the module map. More...
 
unsigned header_file_size () const
 
HeaderFileInfogetFileInfo (const FileEntry *FE)
 Return the HeaderFileInfo structure for the specified FileEntry, in preparation for updating it in some way. More...
 
const HeaderFileInfogetExistingFileInfo (const FileEntry *FE, bool WantExternal=true) const
 Return the HeaderFileInfo structure for the specified FileEntry, if it has ever been filled in. More...
 
search_dir_iterator search_dir_begin () const
 
search_dir_iterator search_dir_end () const
 
unsigned search_dir_size () const
 
search_dir_iterator quoted_dir_begin () const
 
search_dir_iterator quoted_dir_end () const
 
search_dir_iterator angled_dir_begin () const
 
search_dir_iterator angled_dir_end () const
 
search_dir_iterator system_dir_begin () const
 
search_dir_iterator system_dir_end () const
 
StringRef getUniqueFrameworkName (StringRef Framework)
 Retrieve a uniqued framework name. More...
 
std::string suggestPathToFileForDiagnostics (const FileEntry *File, bool *IsSystem=nullptr)
 Suggest a path by which the specified file could be found, for use in diagnostics to suggest a #include. More...
 
void PrintStats ()
 
size_t getTotalMemory () const
 

Friends

class DirectoryLookup
 

Detailed Description

Encapsulates the information needed to find the file referenced by a #include or #include_next, (sub-)framework lookup, etc.

Definition at line 148 of file HeaderSearch.h.

Member Typedef Documentation

◆ search_dir_iterator

using clang::HeaderSearch::search_dir_iterator = std::vector<DirectoryLookup>::const_iterator

Definition at line 666 of file HeaderSearch.h.

Constructor & Destructor Documentation

◆ HeaderSearch() [1/2]

HeaderSearch::HeaderSearch ( std::shared_ptr< HeaderSearchOptions HSOpts,
SourceManager SourceMgr,
DiagnosticsEngine Diags,
const LangOptions LangOpts,
const TargetInfo Target 
)

Definition at line 70 of file HeaderSearch.cpp.

◆ HeaderSearch() [2/2]

clang::HeaderSearch::HeaderSearch ( const HeaderSearch )
delete

◆ ~HeaderSearch()

HeaderSearch::~HeaderSearch ( )

Definition at line 78 of file HeaderSearch.cpp.

Member Function Documentation

◆ AddIncludeAlias()

void clang::HeaderSearch::AddIncludeAlias ( StringRef  Source,
StringRef  Dest 
)
inline

Map the source include name to the dest include name.

The Source should include the angle brackets or quotes, the dest should not. This allows for distinction between <> and "" headers.

Definition at line 309 of file HeaderSearch.h.

◆ AddSearchPath()

void clang::HeaderSearch::AddSearchPath ( const DirectoryLookup dir,
bool  isAngled 
)
inline

Add an additional search path.

Definition at line 289 of file HeaderSearch.h.

◆ angled_dir_begin()

search_dir_iterator clang::HeaderSearch::angled_dir_begin ( ) const
inline

Definition at line 680 of file HeaderSearch.h.

◆ angled_dir_end()

search_dir_iterator clang::HeaderSearch::angled_dir_end ( ) const
inline

Definition at line 684 of file HeaderSearch.h.

◆ ClearFileInfo()

void clang::HeaderSearch::ClearFileInfo ( )
inline

Forget everything we know about headers so far.

Definition at line 343 of file HeaderSearch.h.

◆ collectAllModules()

void HeaderSearch::collectAllModules ( SmallVectorImpl< Module *> &  Modules)

Collect the set of all known, top-level modules.

Parameters
ModulesWill be filled with the set of known, top-level modules.

Definition at line 1482 of file HeaderSearch.cpp.

References clang::vfs::FileSystem::dir_begin(), clang::FileManager::getDirectory(), clang::DirectoryEntry::getName(), clang::FileManager::getVirtualFileSystem(), loadModuleMapFile(), clang::ModuleMap::module_begin(), and clang::ModuleMap::module_end().

◆ CreateHeaderMap()

const HeaderMap * HeaderSearch::CreateHeaderMap ( const FileEntry FE)

CreateHeaderMap - This method returns a HeaderMap for the specified FileEntry, uniquing them through the 'HeaderMaps' datastructure.

Definition at line 108 of file HeaderSearch.cpp.

References clang::HeaderMap::Create().

◆ findModuleForHeader()

ModuleMap::KnownHeader HeaderSearch::findModuleForHeader ( const FileEntry File,
bool  AllowTextual = false 
) const

Retrieve the module that corresponds to the given file, if any.

Parameters
FileThe header that we wish to map to a module.
AllowTextualWhether we want to find textual headers too.

Definition at line 1252 of file HeaderSearch.cpp.

References clang::ModuleMap::findModuleForHeader(), and getExistingFileInfo().

Referenced by clang::VerifyDiagnosticConsumer::HandleDiagnostic(), and suggestModule().

◆ FirstTimeLexingFile()

bool clang::HeaderSearch::FirstTimeLexingFile ( const FileEntry File)
inline

Return true if this is the first time encountering this header.

Definition at line 469 of file HeaderSearch.h.

◆ getCachedModuleFileName() [1/2]

std::string HeaderSearch::getCachedModuleFileName ( Module Module)

Retrieve the name of the cached module file that should be used to load the given module.

Parameters
ModuleThe module whose module file name will be returned.
Returns
The name of the module file that corresponds to this module, or an empty string if this module does not correspond to any module file.

Definition at line 134 of file HeaderSearch.cpp.

References getModuleMap(), clang::ModuleMap::getModuleMapFileForUniquing(), clang::FileEntry::getName(), and clang::Module::Name.

◆ getCachedModuleFileName() [2/2]

std::string HeaderSearch::getCachedModuleFileName ( StringRef  ModuleName,
StringRef  ModuleMapPath 
)

Retrieve the name of the (to-be-)cached module file that should be used to load a module with the given name.

Parameters
ModuleNameThe module whose module file name will be returned.
ModuleMapPathA path that when combined with ModuleName uniquely identifies this module. See Module::ModuleMap.
Returns
The name of the module file that corresponds to this module, or an empty string if this module does not correspond to any module file.

Definition at line 162 of file HeaderSearch.cpp.

References clang::FileManager::getCanonicalName(), clang::FileManager::getDirectory(), getModuleCachePath(), Parent, and clang::Result.

◆ getExistingFileInfo()

const HeaderFileInfo * HeaderSearch::getExistingFileInfo ( const FileEntry FE,
bool  WantExternal = true 
) const

Return the HeaderFileInfo structure for the specified FileEntry, if it has ever been filled in.

Parameters
WantExternalWhether the caller wants purely-external header file info (where External is true).

Definition at line 1046 of file HeaderSearch.cpp.

References clang::HeaderFileInfo::External, clang::ExternalHeaderFileInfoSource::GetHeaderFileInfo(), clang::FileEntry::getUID(), clang::HeaderFileInfo::IsValid, mergeHeaderFileInfo(), and clang::HeaderFileInfo::Resolved.

Referenced by CreateSLocExpansionAbbrev(), findModuleForHeader(), isFileMultipleIncludeGuarded(), and MarkFileModuleHeader().

◆ getExternalLookup()

ExternalPreprocessorSource* clang::HeaderSearch::getExternalLookup ( ) const
inline

Definition at line 351 of file HeaderSearch.h.

◆ getFileDirFlavor()

SrcMgr::CharacteristicKind clang::HeaderSearch::getFileDirFlavor ( const FileEntry File)
inline

Return whether the specified file is a normal header, a system header, or a C++ friendly system header.

Definition at line 430 of file HeaderSearch.h.

◆ getFileInfo()

HeaderFileInfo & HeaderSearch::getFileInfo ( const FileEntry FE)

◆ getFileMgr()

FileManager& clang::HeaderSearch::getFileMgr ( ) const
inline

◆ getHeaderMapFileNames()

void HeaderSearch::getHeaderMapFileNames ( SmallVectorImpl< std::string > &  Names) const

Get filenames for all registered header maps.

Definition at line 128 of file HeaderSearch.cpp.

Referenced by collectHeaderMaps().

◆ getHeaderSearchOpts()

HeaderSearchOptions& clang::HeaderSearch::getHeaderSearchOpts ( ) const
inline

Retrieve the header-search options with which this header search was initialized.

Definition at line 271 of file HeaderSearch.h.

Referenced by clang::CompilerInstance::createPCHExternalASTSource(), and loadModuleMapFile().

◆ getModuleCachePath()

StringRef clang::HeaderSearch::getModuleCachePath ( ) const
inline

Retrieve the path to the module cache.

Definition at line 335 of file HeaderSearch.h.

Referenced by clang::FrontendAction::Execute(), and getCachedModuleFileName().

◆ getModuleMap() [1/2]

ModuleMap& clang::HeaderSearch::getModuleMap ( )
inline

◆ getModuleMap() [2/2]

const ModuleMap& clang::HeaderSearch::getModuleMap ( ) const
inline

Retrieve the module map.

Definition at line 650 of file HeaderSearch.h.

◆ getPrebuiltModuleFileName()

std::string HeaderSearch::getPrebuiltModuleFileName ( StringRef  ModuleName,
bool  FileMapOnly = false 
)

Retrieve the name of the prebuilt module file that should be used to load a module with the given name.

Parameters
ModuleNameThe module whose module file name will be returned.
FileMapOnlyIf true, then only look in the explicit module name
Returns
The name of the module file that corresponds to this module, or an empty string if this module does not correspond to any module file.

Definition at line 140 of file HeaderSearch.cpp.

References getFileMgr(), clang::if(), and clang::Result.

◆ getTotalMemory()

size_t HeaderSearch::getTotalMemory ( ) const

Definition at line 1192 of file HeaderSearch.cpp.

◆ getUniqueFrameworkName()

StringRef HeaderSearch::getUniqueFrameworkName ( StringRef  Framework)

Retrieve a uniqued framework name.

Definition at line 1200 of file HeaderSearch.cpp.

Referenced by LookupFile().

◆ HasIncludeAliasMap()

bool clang::HeaderSearch::HasIncludeAliasMap ( ) const
inline

Checks whether the map exists or not.

Definition at line 303 of file HeaderSearch.h.

◆ hasModuleMap()

bool HeaderSearch::hasModuleMap ( StringRef  Filename,
const DirectoryEntry Root,
bool  IsSystem 
)

Determine whether there is a module map that may map the header with the given file name to a (sub)module.

Always returns false if modules are disabled.

Parameters
FilenameThe name of the file.
RootThe "root" directory, at which we should stop looking for module maps.
IsSystemWhether the directories we're looking at are system header directories.

Definition at line 1204 of file HeaderSearch.cpp.

Referenced by suggestModule().

◆ header_file_size()

unsigned clang::HeaderSearch::header_file_size ( ) const
inline

Definition at line 652 of file HeaderSearch.h.

Referenced by CreateSLocExpansionAbbrev().

◆ IncrementFrameworkLookupCount()

void clang::HeaderSearch::IncrementFrameworkLookupCount ( )
inline

Definition at line 538 of file HeaderSearch.h.

Referenced by needModuleLookup().

◆ IncrementIncludeCount()

void clang::HeaderSearch::IncrementIncludeCount ( const FileEntry File)
inline

Increment the count for the number of times the specified FileEntry has been entered.

Definition at line 455 of file HeaderSearch.h.

Referenced by clang::Preprocessor::EnterMainSourceFile().

◆ isFileMultipleIncludeGuarded()

bool HeaderSearch::isFileMultipleIncludeGuarded ( const FileEntry File)

Determine whether this file is intended to be safe from multiple inclusions, e.g., it has #pragma once or a controlling macro.

This routine does not consider the effect of #import

Definition at line 1081 of file HeaderSearch.cpp.

References getExistingFileInfo().

◆ loadModuleMapFile()

bool HeaderSearch::loadModuleMapFile ( const FileEntry File,
bool  IsSystem,
FileID  ID = FileID(),
unsigned *  Offset = nullptr,
StringRef  OriginalModuleMapFile = StringRef() 
)

Read the contents of the given module map file.

Parameters
FileThe module map file.
IsSystemWhether this file is in a system header directory.
IDIf the module map file is already mapped (perhaps as part of processing a preprocessed module), the ID of the file.
Offset[inout] An offset within ID to start parsing. On exit, filled by the end of the parsed contents (either EOF or the location of an end-of-module-map pragma).
OriginalModuleMapFileThe original path to the module map file, used to resolve paths within the module (this is required when building the module from preprocessed source).
Returns
true if an error occurred, false otherwise.

Definition at line 1334 of file HeaderSearch.cpp.

References clang::FileEntry::getDir(), clang::FileManager::getDirectory(), getHeaderSearchOpts(), clang::DirectoryEntry::getName(), getPrivateModuleMap(), clang::FileManager::getVirtualFile(), and clang::ModuleMap::parseModuleMapFile().

Referenced by collectAllModules(), loadModuleMapForModuleBuild(), loadTopLevelSystemModules(), and lookupModule().

◆ loadTopLevelSystemModules()

void HeaderSearch::loadTopLevelSystemModules ( )

◆ LookupFile()

const FileEntry * HeaderSearch::LookupFile ( StringRef  Filename,
SourceLocation  IncludeLoc,
bool  isAngled,
const DirectoryLookup FromDir,
const DirectoryLookup *&  CurDir,
ArrayRef< std::pair< const FileEntry *, const DirectoryEntry *>>  Includers,
SmallVectorImpl< char > *  SearchPath,
SmallVectorImpl< char > *  RelativePath,
Module RequestingModule,
ModuleMap::KnownHeader SuggestedModule,
bool IsMapped,
bool  SkipCache = false,
bool  BuildSystemModule = false 
)

Given a "foo" or <foo> reference, look up the indicated file, return null on failure.

LookupFile - Given a "foo" or <foo> reference, look up the indicated file, return null on failure.

Returns
If successful, this returns 'UsedDir', the DirectoryLookup member the file was found in, or null if not applicable.
Parameters
IncludeLocUsed for diagnostics if valid.
isAngledindicates whether the file reference is a <> reference.
CurDirIf non-null, the file was found in the specified directory search location. This is used to implement #include_next.
IncludersIndicates where the #including file(s) are, in case relative searches are needed. In reverse order of inclusion.
SearchPathIf non-null, will be set to the search path relative to which the file was found. If the include path is absolute, SearchPath will be set to an empty string.
RelativePathIf non-null, will be set to the path relative to SearchPath at which the file was found. This only differs from the Filename for framework includes.
SuggestedModuleIf non-null, and the file found is semantically part of a known module, this will be set to the module that should be imported instead of preprocessing/parsing the file found.
IsMappedIf non-null, and the search involved header maps, set to true.

isAngled indicates whether the file reference is for system #include's or not (i.e. using <> instead of ""). Includers, if non-empty, indicates where the #including file(s) are, in case a relative search is needed. Microsoft mode will pass all #including files.

Definition at line 626 of file HeaderSearch.cpp.

References clang::SrcMgr::C_System, clang::SrcMgr::C_User, checkMSVCHeaderSearch(), copyString(), clang::HeaderFileInfo::DirInfo, Filename, clang::HeaderFileInfo::Framework, clang::DirectoryLookup::getDirCharacteristic(), getFileInfo(), getUniqueFrameworkName(), clang::HeaderFileInfo::IndexHeaderMapHeader, clang::DiagnosticsEngine::isIgnored(), clang::DirectoryLookup::isIndexHeaderMap(), and LookupSubframeworkHeader().

Referenced by DetectEOL(), and clang::Preprocessor::LookupFile().

◆ LookupFrameworkCache()

FrameworkCacheEntry& clang::HeaderSearch::LookupFrameworkCache ( StringRef  FWName)
inline

Look up the specified framework name in our framework cache.

Returns
The DirectoryEntry it is in if we know, null otherwise.

Definition at line 415 of file HeaderSearch.h.

References clang::HeaderFileInfo::isImport.

Referenced by needModuleLookup().

◆ lookupModule()

Module * HeaderSearch::lookupModule ( StringRef  ModuleName,
bool  AllowSearch = true 
)

Lookup a module Search for a module with the given name.

Parameters
ModuleNameThe name of the module we're looking for.
AllowSearchWhether we are allowed to search in the various search directories to produce a module definition. If not, this lookup will only return an already-known module.
Returns
The module with the given name.

Definition at line 201 of file HeaderSearch.cpp.

References clang::SrcMgr::C_User, clang::ModuleMap::findModule(), clang::FileManager::getDirectory(), and loadModuleMapFile().

Referenced by clang::FrontendAction::getCurrentModule(), clang::Preprocessor::getCurrentModule(), clang::Preprocessor::getModuleForLocation(), getTopImportImplicitModule(), clang::PCHGenerator::HandleTranslationUnit(), and prepareToBuildModule().

◆ lookupModuleMapFile()

const FileEntry * HeaderSearch::lookupModuleMapFile ( const DirectoryEntry Dir,
bool  IsFramework 
)

Try to find a module map file in the given directory, returning nullptr if none is found.

Definition at line 1408 of file HeaderSearch.cpp.

References clang::FileManager::getFile(), and clang::DirectoryEntry::getName().

Referenced by clang::ModuleMap::inferFrameworkModule().

◆ LookupSubframeworkHeader()

const FileEntry * HeaderSearch::LookupSubframeworkHeader ( StringRef  Filename,
const FileEntry ContextFileEnt,
SmallVectorImpl< char > *  SearchPath,
SmallVectorImpl< char > *  RelativePath,
Module RequestingModule,
ModuleMap::KnownHeader SuggestedModule 
)

Look up a subframework for the specified #include file.

LookupSubframeworkHeader - Look up a subframework for the specified #include file.

For example, if #include'ing <HIToolbox/HIToolbox.h> from within ".../Carbon.framework/Headers/Carbon.h", check to see if HIToolbox is a subframework within Carbon.framework. If so, return the FileEntry for the designated file, otherwise return null.

Definition at line 887 of file HeaderSearch.cpp.

References clang::HeaderFileInfo::DirInfo, clang::FileManager::getDirectory(), clang::FileManager::getFile(), getFileInfo(), and clang::FileEntry::getName().

Referenced by LookupFile(), and clang::Preprocessor::LookupFile().

◆ MapHeaderToIncludeAlias()

StringRef clang::HeaderSearch::MapHeaderToIncludeAlias ( StringRef  Source)
inline

MapHeaderToIncludeAlias - Maps one header file name to a different header file name, for use with the include_alias pragma.

Note that the source file name should include the angle brackets or quotes. Returns StringRef as null if the header cannot be mapped.

Definition at line 319 of file HeaderSearch.h.

◆ MarkFileIncludeOnce()

void clang::HeaderSearch::MarkFileIncludeOnce ( const FileEntry File)
inline

Mark the specified file as a "once only" file, e.g.

due to #pragma once.

Definition at line 436 of file HeaderSearch.h.

References clang::HeaderFileInfo::isImport, and clang::HeaderFileInfo::isPragmaOnce.

◆ MarkFileModuleHeader()

void HeaderSearch::MarkFileModuleHeader ( const FileEntry File,
ModuleMap::ModuleHeaderRole  Role,
bool  IsCompiledModuleHeader 
)

Mark the specified file as part of a module.

Definition at line 1089 of file HeaderSearch.cpp.

References getExistingFileInfo(), getFileInfo(), and clang::ModuleMap::TextualHeader.

Referenced by clang::ModuleMap::addHeader().

◆ MarkFileSystemHeader()

void clang::HeaderSearch::MarkFileSystemHeader ( const FileEntry File)
inline

Mark the specified file as a system header, e.g.

due to #pragma GCC system_header.

Definition at line 444 of file HeaderSearch.h.

References clang::SrcMgr::C_System.

◆ operator=()

HeaderSearch& clang::HeaderSearch::operator= ( const HeaderSearch )
delete

◆ PrintStats()

void HeaderSearch::PrintStats ( )

Definition at line 84 of file HeaderSearch.cpp.

Referenced by clang::FrontendAction::EndSourceFile().

◆ quoted_dir_begin()

search_dir_iterator clang::HeaderSearch::quoted_dir_begin ( ) const
inline

Definition at line 672 of file HeaderSearch.h.

◆ quoted_dir_end()

search_dir_iterator clang::HeaderSearch::quoted_dir_end ( ) const
inline

Definition at line 676 of file HeaderSearch.h.

◆ search_dir_begin()

search_dir_iterator clang::HeaderSearch::search_dir_begin ( ) const
inline

Definition at line 668 of file HeaderSearch.h.

◆ search_dir_end()

search_dir_iterator clang::HeaderSearch::search_dir_end ( ) const
inline

Definition at line 669 of file HeaderSearch.h.

◆ search_dir_size()

unsigned clang::HeaderSearch::search_dir_size ( ) const
inline

Definition at line 670 of file HeaderSearch.h.

◆ setDirectoryHasModuleMap()

void clang::HeaderSearch::setDirectoryHasModuleMap ( const DirectoryEntry Dir)
inline

Consider modules when including files from this directory.

Definition at line 338 of file HeaderSearch.h.

◆ SetExternalLookup()

void clang::HeaderSearch::SetExternalLookup ( ExternalPreprocessorSource EPS)
inline

Definition at line 347 of file HeaderSearch.h.

◆ SetExternalSource()

void clang::HeaderSearch::SetExternalSource ( ExternalHeaderFileInfoSource ES)
inline

Set the external source of header information.

Definition at line 356 of file HeaderSearch.h.

References Filename.

◆ SetFileControllingMacro()

void clang::HeaderSearch::SetFileControllingMacro ( const FileEntry File,
const IdentifierInfo ControllingMacro 
)
inline

Mark the specified file as having a controlling macro.

This is used by the multiple-include optimization to eliminate no-op #includes.

Definition at line 463 of file HeaderSearch.h.

References clang::HeaderFileInfo::ControllingMacro.

◆ setModuleCachePath()

void clang::HeaderSearch::setModuleCachePath ( StringRef  CachePath)
inline

Set the path to the module cache.

Definition at line 330 of file HeaderSearch.h.

◆ SetSearchPaths()

void clang::HeaderSearch::SetSearchPaths ( const std::vector< DirectoryLookup > &  dirs,
unsigned  angledDirIdx,
unsigned  systemDirIdx,
bool  noCurDirSearch 
)
inline

Interface for setting the file search paths.

Definition at line 276 of file HeaderSearch.h.

◆ SetSystemHeaderPrefixes()

void clang::HeaderSearch::SetSystemHeaderPrefixes ( ArrayRef< std::pair< std::string, bool >>  P)
inline

Set the list of system header prefixes.

Definition at line 298 of file HeaderSearch.h.

References P.

◆ setTarget()

void HeaderSearch::setTarget ( const TargetInfo Target)

Set the target information for the header search, if not already known.

Definition at line 592 of file HeaderSearch.cpp.

References clang::ModuleMap::setTarget().

Referenced by clang::Preprocessor::Initialize().

◆ ShouldEnterIncludeFile()

bool HeaderSearch::ShouldEnterIncludeFile ( Preprocessor PP,
const FileEntry File,
bool  isImport,
bool  ModulesEnabled,
Module CorrespondingModule 
)

◆ suggestPathToFileForDiagnostics()

std::string HeaderSearch::suggestPathToFileForDiagnostics ( const FileEntry File,
bool IsSystem = nullptr 
)

Suggest a path by which the specified file could be found, for use in diagnostics to suggest a #include.

Parameters
IsSystemIf non-null, filled in to indicate whether the suggested path is relative to a system header directory.

Definition at line 1577 of file HeaderSearch.cpp.

◆ system_dir_begin()

search_dir_iterator clang::HeaderSearch::system_dir_begin ( ) const
inline

Definition at line 688 of file HeaderSearch.h.

◆ system_dir_end()

search_dir_iterator clang::HeaderSearch::system_dir_end ( ) const
inline

Definition at line 692 of file HeaderSearch.h.

References clang::HeaderFileInfo::Framework.

Friends And Related Function Documentation

◆ DirectoryLookup

friend class DirectoryLookup
friend

Definition at line 149 of file HeaderSearch.h.


The documentation for this class was generated from the following files: