clang-tools
7.0.0
|
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 | addRegexMapping (llvm::StringRef RE, llvm::StringRef CanonicalPath) |
Maps all files matching RE 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::ArrayRef< std::string > Headers, llvm::StringRef QualifiedName) const |
Returns the canonical include for symbol with QualifiedName . More... | |
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.
|
default |
void clang::clangd::CanonicalIncludes::addMapping | ( | llvm::StringRef | Path, |
llvm::StringRef | CanonicalPath | ||
) |
Adds a string-to-string mapping from Path
to CanonicalPath
.
Definition at line 21 of file CanonicalIncludes.cpp.
References addRegexMapping().
void clang::clangd::CanonicalIncludes::addRegexMapping | ( | llvm::StringRef | RE, |
llvm::StringRef | CanonicalPath | ||
) |
Maps all files matching RE
to CanonicalPath
.
Definition at line 27 of file CanonicalIncludes.cpp.
Referenced by addMapping(), and clang::clangd::addSystemHeadersMapping().
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 32 of file CanonicalIncludes.cpp.
Referenced by clang::clangd::addSystemHeadersMapping().
llvm::StringRef clang::clangd::CanonicalIncludes::mapHeader | ( | llvm::ArrayRef< std::string > | Headers, |
llvm::StringRef | QualifiedName | ||
) | const |
Returns the canonical include for symbol with QualifiedName
.
Headers
is the include stack: Headers.front() is the file declaring the symbol, and Headers.back() is the main file.
Definition at line 38 of file CanonicalIncludes.cpp.