clang-tools  9.0.0
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

 CanonicalIncludes ()=default
 
void addMapping (llvm::StringRef Path, llvm::StringRef CanonicalPath)
 Adds a string-to-string mapping from Path to CanonicalPath. More...
 
void addPathSuffixMapping (llvm::StringRef Suffix, llvm::StringRef CanonicalPath)
 Maps files with last path components matching Suffix to CanonicalPath. More...
 
void addSymbolMapping (llvm::StringRef QualifiedName, llvm::StringRef CanonicalPath)
 Sets the canonical include for any symbol with QualifiedName. More...
 
llvm::StringRef mapHeader (llvm::StringRef Header, llvm::StringRef QualifiedName) const
 Returns the canonical include for symbol with QualifiedName. 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 35 of file CanonicalIncludes.h.

Constructor & Destructor Documentation

◆ CanonicalIncludes()

clang::clangd::CanonicalIncludes::CanonicalIncludes ( )
default

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 29 of file CanonicalIncludes.cpp.

◆ addPathSuffixMapping()

void clang::clangd::CanonicalIncludes::addPathSuffixMapping ( llvm::StringRef  Suffix,
llvm::StringRef  CanonicalPath 
)

Maps files with last path components matching Suffix to CanonicalPath.

Definition at line 21 of file CanonicalIncludes.cpp.

◆ addSymbolMapping()

void clang::clangd::CanonicalIncludes::addSymbolMapping ( llvm::StringRef  QualifiedName,
llvm::StringRef  CanonicalPath 
)

Sets the canonical include for any symbol with QualifiedName.

Symbol mappings take precedence over header mappings.

Definition at line 34 of file CanonicalIncludes.cpp.

◆ mapHeader()

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

Returns the canonical include for symbol with QualifiedName.

Header is the file the declaration was reachable from. Header itself will be returned if there is no relevant mapping.

Definition at line 40 of file CanonicalIncludes.cpp.


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