CIRCT 22.0.0git
|
#include <VerilogDocument.h>
Public Member Functions | |
VerilogDocument (VerilogServerContext &globalContext, const llvm::lsp::URIForFile &uri, llvm::StringRef contents, std::vector< llvm::lsp::Diagnostic > &diagnostics) | |
VerilogDocument (const VerilogDocument &)=delete | |
VerilogDocument & | operator= (const VerilogDocument &)=delete |
const llvm::lsp::URIForFile & | getURI () const |
const slang::SourceManager & | getSlangSourceManager () const |
llvm::lsp::Location | getLspLocation (slang::SourceLocation loc) const |
llvm::lsp::Location | getLspLocation (slang::SourceRange range) const |
slang::BufferID | getMainBufferID () const |
void | getLocationsOf (const llvm::lsp::URIForFile &uri, const llvm::lsp::Position &defPos, std::vector< llvm::lsp::Location > &locations) |
void | findReferencesOf (const llvm::lsp::URIForFile &uri, const llvm::lsp::Position &pos, std::vector< llvm::lsp::Location > &references) |
std::optional< uint32_t > | lspPositionToOffset (const llvm::lsp::Position &pos) |
const char * | getPointerFor (const llvm::lsp::Position &pos) |
Private Member Functions | |
std::optional< std::pair< slang::BufferID, llvm::SmallString< 128 > > > | getOrOpenFile (llvm::StringRef filePath) |
void | computeLineOffsets (std::string_view text) |
Build a vector of line start offsets (0-based). | |
Private Attributes | |
VerilogServerContext & | globalContext |
slang::BufferID | mainBufferId |
llvm::StringMap< std::pair< slang::BufferID, llvm::SmallString< 128 > > > | filePathMap |
llvm::FailureOr< std::unique_ptr< slang::ast::Compilation > > | compilation |
slang::driver::Driver | driver |
std::unique_ptr< circt::lsp::VerilogIndex > | index |
The index of the parsed module. | |
std::vector< uint32_t > | lineOffsets |
The precomputed line offsets for faster lookups. | |
llvm::lsp::URIForFile | uri |
Definition at line 38 of file VerilogDocument.h.
circt::lsp::VerilogDocument::VerilogDocument | ( | VerilogServerContext & | globalContext, |
const llvm::lsp::URIForFile & | uri, | ||
llvm::StringRef | contents, | ||
std::vector< llvm::lsp::Diagnostic > & | diagnostics | ||
) |
|
delete |
|
private |
Build a vector of line start offsets (0-based).
Definition at line 357 of file VerilogDocument.cpp.
References lineOffsets.
void VerilogDocument::findReferencesOf | ( | const llvm::lsp::URIForFile & | uri, |
const llvm::lsp::Position & | pos, | ||
std::vector< llvm::lsp::Location > & | references | ||
) |
Definition at line 465 of file VerilogDocument.cpp.
References getLspLocation(), getPointerFor(), and index.
void VerilogDocument::getLocationsOf | ( | const llvm::lsp::URIForFile & | uri, |
const llvm::lsp::Position & | defPos, | ||
std::vector< llvm::lsp::Location > & | locations | ||
) |
Definition at line 418 of file VerilogDocument.cpp.
References circt::lsp::Logger::error(), getLspLocation(), getOrOpenFile(), getPointerFor(), getRange(), index, and uri.
llvm::lsp::Location VerilogDocument::getLspLocation | ( | slang::SourceLocation | loc | ) | const |
Definition at line 262 of file VerilogDocument.cpp.
References getSlangSourceManager(), mainBufferId, and uri.
Referenced by findReferencesOf(), getLocationsOf(), getLspLocation(), and circt::lsp::LSPDiagnosticClient::report().
llvm::lsp::Location VerilogDocument::getLspLocation | ( | slang::SourceRange | range | ) | const |
Definition at line 295 of file VerilogDocument.cpp.
References getLspLocation().
|
inline |
Definition at line 56 of file VerilogDocument.h.
References mainBufferId.
|
private |
Definition at line 308 of file VerilogDocument.cpp.
References driver, circt::lsp::VerilogServerOptions::extraSourceLocationDirs, filePathMap, globalContext, and circt::lsp::VerilogServerContext::options.
Referenced by getLocationsOf().
const char * VerilogDocument::getPointerFor | ( | const llvm::lsp::Position & | pos | ) |
Definition at line 407 of file VerilogDocument.cpp.
References getSlangSourceManager(), lspPositionToOffset(), and mainBufferId.
Referenced by findReferencesOf(), and getLocationsOf().
|
inline |
Definition at line 48 of file VerilogDocument.h.
References driver.
Referenced by getLspLocation(), getPointerFor(), and lspPositionToOffset().
|
inline |
Definition at line 46 of file VerilogDocument.h.
References uri.
Referenced by circt::lsp::LSPDiagnosticClient::report().
std::optional< uint32_t > VerilogDocument::lspPositionToOffset | ( | const llvm::lsp::Position & | pos | ) |
Definition at line 370 of file VerilogDocument.cpp.
References getSlangSourceManager(), lineOffsets, and mainBufferId.
Referenced by getPointerFor().
|
delete |
|
private |
Definition at line 87 of file VerilogDocument.h.
|
private |
Definition at line 90 of file VerilogDocument.h.
Referenced by getOrOpenFile(), and getSlangSourceManager().
|
private |
Definition at line 84 of file VerilogDocument.h.
Referenced by getOrOpenFile().
|
private |
Definition at line 77 of file VerilogDocument.h.
Referenced by getOrOpenFile().
|
private |
The index of the parsed module.
Definition at line 93 of file VerilogDocument.h.
Referenced by findReferencesOf(), and getLocationsOf().
|
private |
The precomputed line offsets for faster lookups.
Definition at line 96 of file VerilogDocument.h.
Referenced by computeLineOffsets(), and lspPositionToOffset().
|
private |
Definition at line 79 of file VerilogDocument.h.
Referenced by getLspLocation(), getMainBufferID(), getPointerFor(), and lspPositionToOffset().
|
private |
Definition at line 100 of file VerilogDocument.h.
Referenced by getLocationsOf(), getLspLocation(), and getURI().