clang-tools  14.0.0git
Public Member Functions | List of all members
clang::clangd::CanonicalIncludes Class Reference

Maps a definition location onto an #include file, based on a set of filename rules. More...

#include <CanonicalIncludes.h>

Public Member Functions

void addMapping (llvm::StringRef Path, llvm::StringRef CanonicalPath)
 Adds a string-to-string mapping from Path to CanonicalPath. More...
 
llvm::StringRef mapSymbol (llvm::StringRef QualifiedName) const
 Returns the overridden include for symbol with QualifiedName, or "". More...
 
llvm::StringRef mapHeader (llvm::StringRef Header) const
 Returns the overridden include for for files in Header, or "". More...
 
void addSystemHeadersMapping (const LangOptions &Language)
 Adds mapping for system headers and some special symbols (e.g. More...
 

Detailed Description

Maps a definition location onto an #include file, based on a set of filename rules.

Only const methods (i.e. mapHeader) in this class are thread safe.

Definition at line 36 of file CanonicalIncludes.h.

Member Function Documentation

◆ addMapping()

void clang::clangd::CanonicalIncludes::addMapping ( llvm::StringRef  Path,
llvm::StringRef  CanonicalPath 
)

Adds a string-to-string mapping from Path to CanonicalPath.

Definition at line 22 of file CanonicalIncludes.cpp.

◆ addSystemHeadersMapping()

void clang::clangd::CanonicalIncludes::addSystemHeadersMapping ( const LangOptions &  Language)

Adds mapping for system headers and some special symbols (e.g.

STL symbols in <iosfwd> need to be mapped individually). Approximately, the following system headers are handled:

  • C++ standard library e.g. bits/basic_string.h$ -> <string>
  • Posix library e.g. bits/pthreadtypes.h$ -> <pthread.h>
  • Compiler extensions, e.g. include/avx512bwintrin.h$ -> <immintrin.h> The mapping is hardcoded and hand-maintained, so it might not cover all headers.

Definition at line 84 of file CanonicalIncludes.cpp.

◆ mapHeader()

llvm::StringRef clang::clangd::CanonicalIncludes::mapHeader ( llvm::StringRef  Header) const

Returns the overridden include for for files in Header, or "".

Definition at line 31 of file CanonicalIncludes.cpp.

◆ mapSymbol()

llvm::StringRef clang::clangd::CanonicalIncludes::mapSymbol ( llvm::StringRef  QualifiedName) const

Returns the overridden include for symbol with QualifiedName, or "".

Definition at line 54 of file CanonicalIncludes.cpp.


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