clang 8.0.0

Functions
HeaderSearch.cpp File Reference
`#include "clang/Lex/HeaderSearch.h"`
`#include "clang/Basic/Diagnostic.h"`
`#include "clang/Basic/FileManager.h"`
`#include "clang/Basic/IdentifierTable.h"`
`#include "clang/Basic/Module.h"`
`#include "clang/Basic/SourceManager.h"`
`#include "clang/Lex/DirectoryLookup.h"`
`#include "clang/Lex/ExternalPreprocessorSource.h"`
`#include "clang/Lex/HeaderMap.h"`
`#include "clang/Lex/HeaderSearchOptions.h"`
`#include "clang/Lex/LexDiagnostic.h"`
`#include "clang/Lex/ModuleMap.h"`
`#include "clang/Lex/Preprocessor.h"`
`#include "llvm/ADT/APInt.h"`
`#include "llvm/ADT/Hashing.h"`
`#include "llvm/ADT/SmallString.h"`
`#include "llvm/ADT/SmallVector.h"`
`#include "llvm/ADT/StringRef.h"`
`#include "llvm/Support/Allocator.h"`
`#include "llvm/Support/Capacity.h"`
`#include "llvm/Support/ErrorHandling.h"`
`#include "llvm/Support/FileSystem.h"`
`#include "llvm/Support/Path.h"`
`#include "llvm/Support/VirtualFileSystem.h"`
`#include <algorithm>`
`#include <cassert>`
`#include <cstddef>`
`#include <cstdio>`
`#include <cstring>`
`#include <string>`
`#include <system_error>`
`#include <utility>`
Include dependency graph for HeaderSearch.cpp:

Go to the source code of this file.

## Functions
static const DirectoryEntry * | getTopFrameworkDir (FileManager &FileMgr, StringRef DirName, SmallVectorImpl< std::string > &SubmodulePath)
| Given a framework directory, find the top-most framework directory. More...
static bool | needModuleLookup (Module *RequestingModule, bool HasSuggestedModule)
static bool | checkMSVCHeaderSearch (DiagnosticsEngine &Diags, const FileEntry *MSFE, const FileEntry *FE, SourceLocation IncludeLoc)
| Return true with a diagnostic if the file that MSVC would have found fails to match the one that Clang would have found with MSVC header search disabled. More...
static const char * | copyString (StringRef Str, llvm::BumpPtrAllocator &Alloc)
static bool | isFrameworkStylePath (StringRef Path, bool &IsPrivateHeader, SmallVectorImpl< char > &FrameworkName)
static void | diagnoseFrameworkInclude (DiagnosticsEngine &Diags, SourceLocation IncludeLoc, StringRef Includer, StringRef IncludeFilename, const FileEntry *IncludeFE, bool isAngled=false, bool FoundByHeaderMap=false)
static void | mergeHeaderFileInfo (HeaderFileInfo &HFI, const HeaderFileInfo &OtherHFI)
| Merge the header file info provided by `OtherHFI` into the current header file info (`HFI`) More...
static bool | suggestModule (HeaderSearch &HS, const FileEntry *File, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule)
static const FileEntry * | getPrivateModuleMap (const FileEntry *File, FileManager &FileMgr)

## Function Documentation

## ◆ checkMSVCHeaderSearch()

static bool checkMSVCHeaderSearch | ( | DiagnosticsEngine & | Diags,
|  | const FileEntry * | MSFE,
|  | const FileEntry * | FE,
|  | SourceLocation | IncludeLoc
| ) |  |
| static

Return true with a diagnostic if the file that MSVC would have found fails to match the one that Clang would have found with MSVC header search disabled.

Definition at line 603 of file HeaderSearch.cpp.

References clang::FileEntry::getName(), and clang::DiagnosticsEngine::Report().

Referenced by clang::HeaderSearch::LookupFile().

## ◆ copyString()

static const char* copyString | ( | StringRef | Str,
|  | llvm::BumpPtrAllocator & | Alloc
| ) |  |
| static

Definition at line 613 of file HeaderSearch.cpp.

Referenced by clang::edit::EditedSource::canInsertInOffset(), clang::edit::EditedSource::copyString(), and clang::HeaderSearch::LookupFile().

## ◆ diagnoseFrameworkInclude()

static void diagnoseFrameworkInclude | ( | DiagnosticsEngine & | Diags,
|  | SourceLocation | IncludeLoc,
|  | StringRef | Includer,
|  | StringRef | IncludeFilename,
|  | const FileEntry * | IncludeFE,
|  | bool | isAngled = `false`,
|  | bool | FoundByHeaderMap = `false`
| ) |  |
| static

Definition at line 655 of file HeaderSearch.cpp.

References clang::FixItHint::CreateReplacement(), clang::FileEntry::getName(), isFrameworkStylePath(), and clang::DiagnosticsEngine::Report().

Referenced by clang::HeaderSearch::LookupFile().

## ◆ getPrivateModuleMap()

static const FileEntry* getPrivateModuleMap | ( | const FileEntry * | File,
|  | FileManager & | FileMgr
| ) |  |
| static

Definition at line 1399 of file HeaderSearch.cpp.

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

Referenced by clang::HeaderSearch::loadModuleMapFile().

## ◆ getTopFrameworkDir()

static const DirectoryEntry* getTopFrameworkDir | ( | FileManager & | FileMgr,
|  | StringRef | DirName,
|  | SmallVectorImpl< std::string > & | SubmodulePath
| ) |  |
| static

Given a framework directory, find the top-most framework directory.

Parameters

  FileMgr | The file manager to use for directory lookups.
  DirName | The name of the framework directory.
  SubmodulePath | Will be populated with the submodule path from the returned top-level module to the originally named framework.

Definition at line 411 of file HeaderSearch.cpp.

References clang::FileManager::getCanonicalName(), and clang::FileManager::getDirectory().

Referenced by suggestModule().

## ◆ isFrameworkStylePath()

static bool isFrameworkStylePath | ( | StringRef | Path,
|  | bool & | IsPrivateHeader,
|  | SmallVectorImpl< char > & | FrameworkName
| ) |  |
| static

Definition at line 621 of file HeaderSearch.cpp.

Referenced by diagnoseFrameworkInclude().

## ◆ mergeHeaderFileInfo()

static void mergeHeaderFileInfo | ( | HeaderFileInfo & | HFI,
|  | const HeaderFileInfo & | OtherHFI
| ) |  |
| static

Merge the header file info provided by `OtherHFI` into the current header file info (`HFI`)

Definition at line 1076 of file HeaderSearch.cpp.

References clang::HeaderFileInfo::ControllingMacro, clang::HeaderFileInfo::ControllingMacroID, clang::HeaderFileInfo::DirInfo, clang::HeaderFileInfo::External, clang::HeaderFileInfo::Framework, clang::HeaderFileInfo::IndexHeaderMapHeader, clang::HeaderFileInfo::isImport, clang::HeaderFileInfo::isModuleHeader, clang::HeaderFileInfo::isPragmaOnce, clang::HeaderFileInfo::IsValid, and clang::HeaderFileInfo::NumIncludes.

Referenced by clang::HeaderSearch::getExistingFileInfo(), and clang::HeaderSearch::getFileInfo().

## ◆ needModuleLookup()

static bool needModuleLookup | ( | Module * | RequestingModule,
|  | bool | HasSuggestedModule
| ) |  |
| static

Definition at line 454 of file HeaderSearch.cpp.

References clang::SrcMgr::C_User, Filename, clang::FileEntry::getDir(), clang::FileManager::getDirectory(), clang::FileManager::getFile(), clang::HeaderSearch::getFileMgr(), clang::DirectoryEntry::getName(), clang::HeaderSearch::IncrementFrameworkLookupCount(), clang::HeaderSearch::LookupFrameworkCache(), and clang::Module::NoUndeclaredIncludes.

Referenced by suggestModule().

## ◆ suggestModule()

static bool suggestModule | ( | HeaderSearch & | HS,
|  | const FileEntry * | File,
|  | Module * | RequestingModule,
|  | ModuleMap::KnownHeader * | SuggestedModule
| ) |  |
| static

Definition at line 1340 of file HeaderSearch.cpp.

References clang::Module::directlyUses(), clang::HeaderSearch::findModuleForHeader(), clang::ModuleMap::KnownHeader::getModule(), clang::HeaderSearch::getModuleMap(), clang::DirectoryEntry::getName(), clang::FileEntry::getName(), clang::ModuleMap::KnownHeader::getRole(), getTopFrameworkDir(), clang::HeaderSearch::hasModuleMap(), needModuleLookup(), clang::Module::NoUndeclaredIncludes, clang::ModuleMap::resolveUses(), and clang::ModuleMap::TextualHeader.