#include #include #include #include #include #include #include ">

clang: lib/Lex/HeaderSearch.cpp File Reference (original) (raw)

#include "[clang/Lex/HeaderSearch.h](HeaderSearch%5F8h%5Fsource.html)"
#include "[clang/Basic/Diagnostic.h](Basic%5F2Diagnostic%5F8h%5Fsource.html)"
#include "[clang/Basic/FileManager.h](FileManager%5F8h%5Fsource.html)"
#include "[clang/Basic/IdentifierTable.h](IdentifierTable%5F8h%5Fsource.html)"
#include "[clang/Basic/Module.h](Module%5F8h%5Fsource.html)"
#include "[clang/Basic/SourceManager.h](SourceManager%5F8h%5Fsource.html)"
#include "[clang/Lex/DirectoryLookup.h](DirectoryLookup%5F8h%5Fsource.html)"
#include "[clang/Lex/ExternalPreprocessorSource.h](ExternalPreprocessorSource%5F8h%5Fsource.html)"
#include "[clang/Lex/HeaderMap.h](HeaderMap%5F8h%5Fsource.html)"
#include "[clang/Lex/HeaderSearchOptions.h](HeaderSearchOptions%5F8h%5Fsource.html)"
#include "[clang/Lex/LexDiagnostic.h](LexDiagnostic%5F8h%5Fsource.html)"
#include "[clang/Lex/ModuleMap.h](ModuleMap%5F8h%5Fsource.html)"
#include "[clang/Lex/Preprocessor.h](Preprocessor%5F8h%5Fsource.html)"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Capacity.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/xxhash.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <string>
#include <system_error>
#include <utility>

Go to the source code of this file.

Functions
ALWAYS_ENABLED_STATISTIC (NumIncluded, "Number of attempted #includes.")
ALWAYS_ENABLED_STATISTIC (NumMultiIncludeFileOptzn, "Number of #includes skipped due to the multi-include optimization.")
ALWAYS_ENABLED_STATISTIC (NumFrameworkLookups, "Number of framework lookups.")
ALWAYS_ENABLED_STATISTIC (NumSubFrameworkLookups, "Number of subframework lookups.")
static OptionalDirectoryEntryRef getTopFrameworkDir (FileManager &FileMgr, StringRef DirName, SmallVectorImpl< std::string > &SubmodulePath)
Given a framework directory, find the top-most framework directory.
static bool needModuleLookup (Module *RequestingModule, bool HasSuggestedModule)
static bool checkMSVCHeaderSearch (DiagnosticsEngine &Diags, OptionalFileEntryRef 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.
static const char * copyString (StringRef Str, llvm::BumpPtrAllocator &Alloc)
static bool isFrameworkStylePath (StringRef Path, bool &IsPrivateHeader, SmallVectorImpl< char > &FrameworkName, SmallVectorImpl< char > &IncludeSpelling)
static void diagnoseFrameworkInclude (DiagnosticsEngine &Diags, SourceLocation IncludeLoc, StringRef Includer, StringRef IncludeFilename, FileEntryRef IncludeFE, bool isAngled=false, bool FoundByHeaderMap=false)
static bool moduleMembershipNeedsMerge (const HeaderFileInfo *HFI, ModuleMap::ModuleHeaderRole Role)
static void mergeHeaderFileInfoModuleBits (HeaderFileInfo &HFI, bool isModuleHeader, bool isTextualModuleHeader)
static void mergeHeaderFileInfo (HeaderFileInfo &HFI, const HeaderFileInfo &OtherHFI)
Merge the header file info provided by OtherHFI into the current header file info (HFI)
static bool suggestModule (HeaderSearch &HS, FileEntryRef File, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule)
static OptionalFileEntryRef getPrivateModuleMap (FileEntryRef File, FileManager &FileMgr, DiagnosticsEngine &Diags)

DEBUG_TYPE

#define DEBUG_TYPE "file-search"

ALWAYS_ENABLED_STATISTIC() [1/4]

ALWAYS_ENABLED_STATISTIC ( NumFrameworkLookups ,
"Number of framework lookups."
)

ALWAYS_ENABLED_STATISTIC() [2/4]

ALWAYS_ENABLED_STATISTIC ( NumIncluded ,
"Number of attempted #includes."
)

ALWAYS_ENABLED_STATISTIC() [3/4]

ALWAYS_ENABLED_STATISTIC ( NumMultiIncludeFileOptzn ,
"Number of #includes skipped due to the multi-include optimization."
)

ALWAYS_ENABLED_STATISTIC() [4/4]

ALWAYS_ENABLED_STATISTIC ( NumSubFrameworkLookups ,
"Number of subframework lookups."
)

checkMSVCHeaderSearch()

copyString()

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

diagnoseFrameworkInclude()

getPrivateModuleMap()

getTopFrameworkDir()

isFrameworkStylePath()

mergeHeaderFileInfo()

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

Definition at line 1289 of file HeaderSearch.cpp.

References clang::HeaderFileInfo::DirInfo, clang::HeaderFileInfo::External, clang::HeaderFileInfo::isImport, clang::HeaderFileInfo::isModuleHeader, clang::HeaderFileInfo::isPragmaOnce, clang::HeaderFileInfo::isTextualModuleHeader, clang::LazyIdentifierInfoPtr::isValid(), clang::HeaderFileInfo::IsValid, clang::HeaderFileInfo::LazyControllingMacro, and mergeHeaderFileInfoModuleBits().

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

mergeHeaderFileInfoModuleBits()

static void mergeHeaderFileInfoModuleBits ( HeaderFileInfo & HFI, bool isModuleHeader, bool isTextualModuleHeader ) static

moduleMembershipNeedsMerge()

needModuleLookup()

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

suggestModule()