|
CIRCT 22.0.0git
|
This class represents a text file containing one or more Verilog documents. More...
#include <VerilogTextFile.h>

Public Member Functions | |
| VerilogTextFile (VerilogServerContext &globalContext, const llvm::lsp::URIForFile &uri, llvm::StringRef fileContents, int64_t version, std::vector< llvm::lsp::Diagnostic > &diagnostics) | |
| Initialize a new VerilogTextFile and its VerilogDocument. | |
| 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) |
| Return position of definition of an object pointed to by pos. | |
| void | findReferencesOf (const llvm::lsp::URIForFile &uri, llvm::lsp::Position pos, std::vector< llvm::lsp::Location > &references) |
| Return all references to an object pointed to by pos. | |
| std::shared_ptr< VerilogDocument > | getDocument () |
| Return document for read access. | |
| void | setDocument (std::shared_ptr< VerilogDocument > newDoc) |
| Override document after update. | |
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. | |
| void | initializeProjectDriver () |
Private Attributes | |
| VerilogServerContext & | context |
| std::string | contents |
| The full string contents of the file. | |
| std::unique_ptr< slang::driver::Driver > | projectDriver |
| The project-scale driver. | |
| std::vector< std::string > | projectIncludeDirectories |
| std::shared_mutex | contentMutex |
| A mutex to control updates of contents. | |
| int64_t | version = 0 |
| The version of this file. | |
| std::shared_ptr< circt::lsp::VerilogDocument > | document |
| The chunks of this file. | |
| std::shared_mutex | docMutex |
| A mutex to control updates of document; Acquire AFTER contentMutex. | |
This class represents a text file containing one or more Verilog documents.
Definition at line 37 of file VerilogTextFile.h.
| VerilogTextFile::VerilogTextFile | ( | VerilogServerContext & | globalContext, |
| const llvm::lsp::URIForFile & | uri, | ||
| llvm::StringRef | fileContents, | ||
| int64_t | version, | ||
| std::vector< llvm::lsp::Diagnostic > & | diagnostics | ||
| ) |
Initialize a new VerilogTextFile and its VerilogDocument.
Thread-safe; acquires contentMutex and docMutex.
Definition at line 41 of file VerilogTextFile.cpp.
References contentMutex, initialize(), initializeProjectDriver(), and version.
| void VerilogTextFile::findReferencesOf | ( | const llvm::lsp::URIForFile & | uri, |
| llvm::lsp::Position | pos, | ||
| std::vector< llvm::lsp::Location > & | references | ||
| ) |
Return all references to an object pointed to by pos.
Thread-safe; acquires docMutex.
Definition at line 153 of file VerilogTextFile.cpp.
References getDocument().
| std::shared_ptr< VerilogDocument > VerilogTextFile::getDocument | ( | ) |
Return document for read access.
Thread-safe; acquires docMutex.
Definition at line 160 of file VerilogTextFile.cpp.
References docMutex, and document.
Referenced by findReferencesOf(), and getLocationsOf().
| void VerilogTextFile::getLocationsOf | ( | const llvm::lsp::URIForFile & | uri, |
| llvm::lsp::Position | defPos, | ||
| std::vector< llvm::lsp::Location > & | locations | ||
| ) |
Return position of definition of an object pointed to by pos.
Thread-safe; acquires docMutex.
Definition at line 146 of file VerilogTextFile.cpp.
References getDocument().
|
inline |
Return the current version of this text file.
Thread-safe.
Definition at line 48 of file VerilogTextFile.h.
References version.
|
private |
Initialize the text file from the given file contents.
NOT thread-safe. ONLY call with contentMutex acquired! Acquires docMutex.
Definition at line 136 of file VerilogTextFile.cpp.
References contents, context, projectDriver, projectIncludeDirectories, setDocument(), and version.
Referenced by update(), and VerilogTextFile().
|
private |
Definition at line 68 of file VerilogTextFile.cpp.
References circt::lsp::VerilogServerOptions::commandFiles, context, circt::lsp::Logger::error(), circt::lsp::VerilogServerContext::options, projectDriver, and projectIncludeDirectories.
Referenced by VerilogTextFile().
| void VerilogTextFile::setDocument | ( | std::shared_ptr< VerilogDocument > | newDoc | ) |
Override document after update.
Thread-safe; acquires docMutex.
Definition at line 165 of file VerilogTextFile.cpp.
References docMutex, and document.
Referenced by initialize().
| 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. Thread-safe; acquires contentMutex and docMutex.
Definition at line 51 of file VerilogTextFile.cpp.
References contentMutex, contents, circt::lsp::Logger::error(), and initialize().
|
private |
A mutex to control updates of contents.
Acquire BEFORE docMutex.
Definition at line 97 of file VerilogTextFile.h.
Referenced by update(), and VerilogTextFile().
|
private |
The full string contents of the file.
Definition at line 90 of file VerilogTextFile.h.
Referenced by initialize(), and update().
|
private |
Definition at line 87 of file VerilogTextFile.h.
Referenced by initialize(), and initializeProjectDriver().
|
private |
A mutex to control updates of document; Acquire AFTER contentMutex.
Definition at line 108 of file VerilogTextFile.h.
Referenced by getDocument(), and setDocument().
|
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 104 of file VerilogTextFile.h.
Referenced by getDocument(), and setDocument().
|
private |
The project-scale driver.
Definition at line 93 of file VerilogTextFile.h.
Referenced by initialize(), and initializeProjectDriver().
|
private |
Definition at line 94 of file VerilogTextFile.h.
Referenced by initialize(), and initializeProjectDriver().
|
private |
The version of this file.
Definition at line 100 of file VerilogTextFile.h.
Referenced by getVersion(), initialize(), and VerilogTextFile().