14 #ifndef MLIR_TOOLS_LSPSERVERSUPPORT_SOURCEMGRUTILS_H
15 #define MLIR_TOOLS_LSPSERVERSUPPORT_SOURCEMGRUTILS_H
18 #include "llvm/Support/LSP/Protocol.h"
19 #include "llvm/Support/SourceMgr.h"
41 bool contains(SMRange range, SMLoc loc);
50 const llvm::lsp::Range &
range)
57 llvm::lsp::URIForFile
uri;
void gatherIncludeFiles(llvm::SourceMgr &sourceMgr, SmallVectorImpl< SourceMgrInclude > &includes)
Given a source manager, gather all of the processed include files.
bool contains(SMRange range, SMLoc loc)
Returns true if the given range contains the given source location.
std::optional< std::string > extractSourceDocComment(llvm::SourceMgr &sourceMgr, SMLoc loc)
Extract a documentation comment for the given location within the source manager.
SMRange convertTokenLocToRange(SMLoc loc, StringRef identifierChars="")
Returns the range of a lexical token given a SMLoc corresponding to the start of an token location.
Include the generated interface declarations.
This class represents a single include within a root file.
llvm::lsp::Hover buildHover() const
Build a hover for the current include file.
SourceMgrInclude(const llvm::lsp::URIForFile &uri, const llvm::lsp::Range &range)
llvm::lsp::URIForFile uri
The URI of the file that is included.
llvm::lsp::Range range
The range of the include directive.