MLIR  20.0.0git
Classes | Functions
PDLLServer.cpp File Reference
#include "PDLLServer.h"
#include "Protocol.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Tools/PDLL/AST/Context.h"
#include "mlir/Tools/PDLL/AST/Nodes.h"
#include "mlir/Tools/PDLL/AST/Types.h"
#include "mlir/Tools/PDLL/CodeGen/CPPGen.h"
#include "mlir/Tools/PDLL/CodeGen/MLIRGen.h"
#include "mlir/Tools/PDLL/ODS/Constraint.h"
#include "mlir/Tools/PDLL/ODS/Context.h"
#include "mlir/Tools/PDLL/ODS/Dialect.h"
#include "mlir/Tools/PDLL/ODS/Operation.h"
#include "mlir/Tools/PDLL/Parser/CodeComplete.h"
#include "mlir/Tools/PDLL/Parser/Parser.h"
#include "mlir/Tools/lsp-server-support/CompilationDatabase.h"
#include "mlir/Tools/lsp-server-support/Logging.h"
#include "mlir/Tools/lsp-server-support/SourceMgrUtils.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include <optional>

Go to the source code of this file.

Classes

struct  mlir::lsp::PDLLServer::Impl
 

Functions

static lsp::URIForFile getURIFromLoc (llvm::SourceMgr &mgr, SMRange loc, const lsp::URIForFile &mainFileURI)
 Returns a language server uri for the given source location. More...
 
static bool isMainFileLoc (llvm::SourceMgr &mgr, SMRange loc)
 Returns true if the given location is in the main file of the source manager. More...
 
static lsp::Location getLocationFromLoc (llvm::SourceMgr &mgr, SMRange range, const lsp::URIForFile &uri)
 Returns a language server location from the given source range. More...
 
static std::optional< lsp::DiagnosticgetLspDiagnoticFromDiag (llvm::SourceMgr &sourceMgr, const ast::Diagnostic &diag, const lsp::URIForFile &uri)
 Convert the given MLIR diagnostic to the LSP form. More...
 
static std::optional< std::string > getDocumentationFor (llvm::SourceMgr &sourceMgr, const ast::Decl *decl)
 Get or extract the documentation for the given decl. More...
 
static bool shouldAddHintFor (const ast::Expr *expr, StringRef name)
 Returns true if the given name should be added as a hint for expr. More...
 

Function Documentation

◆ getDocumentationFor()

static std::optional<std::string> getDocumentationFor ( llvm::SourceMgr &  sourceMgr,
const ast::Decl decl 
)
static

Get or extract the documentation for the given decl.

Definition at line 117 of file PDLLServer.cpp.

References mlir::lsp::extractSourceDocComment(), mlir::pdll::ast::Decl::getDocComment(), and mlir::pdll::ast::Node::getLoc().

◆ getLocationFromLoc()

static lsp::Location getLocationFromLoc ( llvm::SourceMgr &  mgr,
SMRange  range,
const lsp::URIForFile uri 
)
static

Returns a language server location from the given source range.

Definition at line 62 of file PDLLServer.cpp.

References getURIFromLoc().

Referenced by getLspDiagnoticFromDiag().

◆ getLspDiagnoticFromDiag()

static std::optional<lsp::Diagnostic> getLspDiagnoticFromDiag ( llvm::SourceMgr &  sourceMgr,
const ast::Diagnostic diag,
const lsp::URIForFile uri 
)
static

◆ getURIFromLoc()

static lsp::URIForFile getURIFromLoc ( llvm::SourceMgr &  mgr,
SMRange  loc,
const lsp::URIForFile mainFileURI 
)
static

Returns a language server uri for the given source location.

mainFileURI corresponds to the uri for the main file of the source manager.

Definition at line 41 of file PDLLServer.cpp.

References mlir::lsp::Logger::error(), mlir::lsp::URIForFile::fromFile(), and toString().

Referenced by getLocationFromLoc().

◆ isMainFileLoc()

static bool isMainFileLoc ( llvm::SourceMgr &  mgr,
SMRange  loc 
)
static

Returns true if the given location is in the main file of the source manager.

Definition at line 57 of file PDLLServer.cpp.

◆ shouldAddHintFor()

static bool shouldAddHintFor ( const ast::Expr expr,
StringRef  name 
)
static

Returns true if the given name should be added as a hint for expr.

Definition at line 1160 of file PDLLServer.cpp.

References mlir::pdll::ast::Name::getName().