CIRCT 22.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
circt::lsp::VerilogTextFile Class Reference

This class represents a text file containing one or more Verilog documents. More...

#include <VerilogTextFile.h>

Collaboration diagram for circt::lsp::VerilogTextFile:
Collaboration graph
[legend]

Public Member Functions

 VerilogTextFile (VerilogServerContext &globalContext, const llvm::lsp::URIForFile &uri, llvm::StringRef fileContents, int64_t version, std::vector< llvm::lsp::Diagnostic > &diagnostics)
 
int64_t getVersion () const
 Return the current version of this text file.
 
llvm::LogicalResult update (const llvm::lsp::URIForFile &uri, int64_t newVersion, llvm::ArrayRef< llvm::lsp::TextDocumentContentChangeEvent > changes, std::vector< llvm::lsp::Diagnostic > &diagnostics)
 Update the file to the new version using the provided set of content changes.
 
void getLocationsOf (const llvm::lsp::URIForFile &uri, llvm::lsp::Position defPos, std::vector< llvm::lsp::Location > &locations)
 
void findReferencesOf (const llvm::lsp::URIForFile &uri, llvm::lsp::Position pos, std::vector< llvm::lsp::Location > &references)
 

Private Member Functions

void initialize (const llvm::lsp::URIForFile &uri, int64_t newVersion, std::vector< llvm::lsp::Diagnostic > &diagnostics)
 Initialize the text file from the given file contents.
 

Private Attributes

VerilogServerContextcontext
 
std::string contents
 The full string contents of the file.
 
int64_t version = 0
 The version of this file.
 
std::unique_ptr< circt::lsp::VerilogDocumentdocument
 The chunks of this file.
 

Detailed Description

This class represents a text file containing one or more Verilog documents.

Definition at line 37 of file VerilogTextFile.h.

Constructor & Destructor Documentation

◆ VerilogTextFile()

VerilogTextFile::VerilogTextFile ( VerilogServerContext globalContext,
const llvm::lsp::URIForFile &  uri,
llvm::StringRef  fileContents,
int64_t  version,
std::vector< llvm::lsp::Diagnostic > &  diagnostics 
)

Definition at line 37 of file VerilogTextFile.cpp.

References initialize(), and version.

Member Function Documentation

◆ findReferencesOf()

void VerilogTextFile::findReferencesOf ( const llvm::lsp::URIForFile &  uri,
llvm::lsp::Position  pos,
std::vector< llvm::lsp::Location > &  references 
)

Definition at line 75 of file VerilogTextFile.cpp.

References document.

◆ getLocationsOf()

void VerilogTextFile::getLocationsOf ( const llvm::lsp::URIForFile &  uri,
llvm::lsp::Position  defPos,
std::vector< llvm::lsp::Location > &  locations 
)

Definition at line 69 of file VerilogTextFile.cpp.

References document.

◆ getVersion()

int64_t circt::lsp::VerilogTextFile::getVersion ( ) const
inline

Return the current version of this text file.

Definition at line 45 of file VerilogTextFile.h.

References version.

◆ initialize()

void VerilogTextFile::initialize ( const llvm::lsp::URIForFile &  uri,
int64_t  newVersion,
std::vector< llvm::lsp::Diagnostic > &  diagnostics 
)
private

Initialize the text file from the given file contents.

Definition at line 61 of file VerilogTextFile.cpp.

References contents, context, document, and version.

Referenced by update(), and VerilogTextFile().

◆ update()

LogicalResult VerilogTextFile::update ( const llvm::lsp::URIForFile &  uri,
int64_t  newVersion,
llvm::ArrayRef< llvm::lsp::TextDocumentContentChangeEvent >  changes,
std::vector< llvm::lsp::Diagnostic > &  diagnostics 
)

Update the file to the new version using the provided set of content changes.

Returns failure if the update was unsuccessful.

Definition at line 45 of file VerilogTextFile.cpp.

References contents, circt::lsp::Logger::error(), and initialize().

Member Data Documentation

◆ contents

std::string circt::lsp::VerilogTextFile::contents
private

The full string contents of the file.

Definition at line 70 of file VerilogTextFile.h.

Referenced by initialize(), and update().

◆ context

VerilogServerContext& circt::lsp::VerilogTextFile::context
private

Definition at line 67 of file VerilogTextFile.h.

Referenced by initialize().

◆ document

std::unique_ptr<circt::lsp::VerilogDocument> circt::lsp::VerilogTextFile::document
private

The chunks of this file.

The order of these chunks is the order in which they appear in the text file.

Definition at line 77 of file VerilogTextFile.h.

Referenced by findReferencesOf(), getLocationsOf(), and initialize().

◆ version

int64_t circt::lsp::VerilogTextFile::version = 0
private

The version of this file.

Definition at line 73 of file VerilogTextFile.h.

Referenced by getVersion(), initialize(), and VerilogTextFile().


The documentation for this class was generated from the following files: