MLIR  22.0.0git
Classes | Typedefs | Enumerations | Functions
mlir::lsp Namespace Reference

Classes

class  CompilationDatabase
 This class contains a collection of compilation information for files provided to the language server, such as the available include directories. More...
 
struct  SourceMgrInclude
 This class represents a single include within a root file. More...
 
class  MLIRServer
 This class implements all of the MLIR related functionality necessary for a language server. More...
 
class  PDLLServer
 This class implements all of the PDLL related functionality necessary for a language server. More...
 
struct  PDLLViewOutputParams
 Represents the parameters used when viewing the output of a PDLL file. More...
 
struct  PDLLViewOutputResult
 Represents the result of viewing the output of a PDLL file. More...
 
class  TableGenServer
 This class implements all of the TableGen related functionality necessary for a language server. More...
 

Typedefs

using DialectRegistryFn = llvm::function_ref< DialectRegistry &(const llvm::lsp::URIForFile &uri)>
 

Enumerations

enum class  PDLLViewOutputKind { AST , MLIR , CPP }
 The type of output to view from PDLL. More...
 

Functions

SMRange convertTokenLocToRange (SMLoc loc, StringRef identifierChars="")
 Returns the range of a lexical token given a SMLoc corresponding to the start of an token location. More...
 
std::optional< std::string > extractSourceDocComment (llvm::SourceMgr &sourceMgr, SMLoc loc)
 Extract a documentation comment for the given location within the source manager. More...
 
bool contains (SMRange range, SMLoc loc)
 Returns true if the given range contains the given source location. More...
 
void gatherIncludeFiles (llvm::SourceMgr &sourceMgr, SmallVectorImpl< SourceMgrInclude > &includes)
 Given a source manager, gather all of the processed include files. More...
 
llvm::LogicalResult runMlirLSPServer (MLIRServer &server, llvm::lsp::JSONTransport &transport)
 Run the main loop of the LSP server using the given MLIR server and transport. More...
 
llvm::LogicalResult runPdllLSPServer (PDLLServer &server, llvm::lsp::JSONTransport &transport)
 Run the main loop of the LSP server using the given PDLL server and transport. More...
 
bool fromJSON (const llvm::json::Value &value, PDLLViewOutputKind &result, llvm::json::Path path)
 Add support for JSON serialization. More...
 
bool fromJSON (const llvm::json::Value &value, PDLLViewOutputParams &result, llvm::json::Path path)
 
llvm::json::Value toJSON (const PDLLViewOutputResult &value)
 Add support for JSON serialization. More...
 
llvm::LogicalResult runTableGenLSPServer (TableGenServer &server, llvm::lsp::JSONTransport &transport)
 Run the main loop of the LSP server using the given TableGen server and transport. More...
 

Typedef Documentation

◆ DialectRegistryFn

using mlir::lsp::DialectRegistryFn = typedef llvm::function_ref<DialectRegistry &(const llvm::lsp::URIForFile &uri)>

Definition at line 27 of file MlirLspRegistryFunction.h.

Enumeration Type Documentation

◆ PDLLViewOutputKind

The type of output to view from PDLL.

Enumerator
AST 
MLIR 
CPP 

Definition at line 34 of file Protocol.h.

Function Documentation

◆ contains()

bool mlir::lsp::contains ( SMRange  range,
SMLoc  loc 
)

Returns true if the given range contains the given source location.

Note that this has different behavior than SMRange because it is inclusive of the end location.

Definition at line 118 of file SourceMgrUtils.cpp.

Referenced by lexLocStringTok().

◆ convertTokenLocToRange()

SMRange mlir::lsp::convertTokenLocToRange ( SMLoc  loc,
StringRef  identifierChars = "" 
)

Returns the range of a lexical token given a SMLoc corresponding to the start of an token location.

The range is computed heuristically, and supports identifier-like tokens, strings, etc.

Definition at line 51 of file SourceMgrUtils.cpp.

References lexLocStringTok().

Referenced by convertTokenLocToRange().

◆ extractSourceDocComment()

std::optional< std::string > mlir::lsp::extractSourceDocComment ( llvm::SourceMgr &  sourceMgr,
SMLoc  loc 
)

Extract a documentation comment for the given location within the source manager.

Returns std::nullopt if no comment could be computed.

Definition at line 75 of file SourceMgrUtils.cpp.

Referenced by getDocumentationFor().

◆ fromJSON() [1/2]

bool mlir::lsp::fromJSON ( const llvm::json::Value &  value,
PDLLViewOutputKind result,
llvm::json::Path  path 
)

Add support for JSON serialization.

Definition at line 40 of file Protocol.cpp.

References AST, CPP, and MLIR.

Referenced by mapOptOrNull().

◆ fromJSON() [2/2]

bool mlir::lsp::fromJSON ( const llvm::json::Value &  value,
PDLLViewOutputParams result,
llvm::json::Path  path 
)

◆ gatherIncludeFiles()

void mlir::lsp::gatherIncludeFiles ( llvm::SourceMgr &  sourceMgr,
SmallVectorImpl< SourceMgrInclude > &  includes 
)

Given a source manager, gather all of the processed include files.

These are assumed to be all of the files other than the main root file.

Definition at line 137 of file SourceMgrUtils.cpp.

◆ runMlirLSPServer()

llvm::LogicalResult mlir::lsp::runMlirLSPServer ( MLIRServer server,
llvm::lsp::JSONTransport &  transport 
)

Run the main loop of the LSP server using the given MLIR server and transport.

Referenced by mlir::MlirLspServerMain().

◆ runPdllLSPServer()

llvm::LogicalResult mlir::lsp::runPdllLSPServer ( PDLLServer server,
llvm::lsp::JSONTransport &  transport 
)

Run the main loop of the LSP server using the given PDLL server and transport.

Referenced by mlir::MlirPdllLspServerMain().

◆ runTableGenLSPServer()

llvm::LogicalResult mlir::lsp::runTableGenLSPServer ( TableGenServer server,
llvm::lsp::JSONTransport &  transport 
)

Run the main loop of the LSP server using the given TableGen server and transport.

Referenced by mlir::TableGenLspServerMain().

◆ toJSON()

llvm::json::Value mlir::lsp::toJSON ( const PDLLViewOutputResult value)

Add support for JSON serialization.

Definition at line 69 of file Protocol.cpp.

References mlir::lsp::PDLLViewOutputResult::output.