MLIR  16.0.0git
Public Member Functions | Public Attributes | Friends | List of all members
mlir::lsp::Position Struct Reference

#include "Tools/lsp-server-support/Protocol.h"

+ Collaboration diagram for mlir::lsp::Position:

Public Member Functions

 Position (int line=0, int character=0)
 
 Position (llvm::SourceMgr &mgr, SMLoc loc)
 Construct a position from the given source location. More...
 
SMLoc getAsSMLoc (llvm::SourceMgr &mgr) const
 Convert this position into a source location in the main file of the given source manager. More...
 

Public Attributes

int line = 0
 Line position in a document (zero-based). More...
 
int character = 0
 Character offset on a line in a document (zero-based). More...
 

Friends

bool operator== (const Position &lhs, const Position &rhs)
 
bool operator!= (const Position &lhs, const Position &rhs)
 
bool operator< (const Position &lhs, const Position &rhs)
 
bool operator<= (const Position &lhs, const Position &rhs)
 

Detailed Description

Definition at line 251 of file Protocol.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

mlir::lsp::Position::Position ( int  line = 0,
int  character = 0 
)
inline

Definition at line 252 of file Protocol.h.

◆ Position() [2/2]

mlir::lsp::Position::Position ( llvm::SourceMgr &  mgr,
SMLoc  loc 
)
inline

Construct a position from the given source location.

Definition at line 256 of file Protocol.h.

Member Function Documentation

◆ getAsSMLoc()

SMLoc mlir::lsp::Position::getAsSMLoc ( llvm::SourceMgr &  mgr) const
inline

Convert this position into a source location in the main file of the given source manager.

Definition at line 286 of file Protocol.h.

References mlir::lsp::fromJSON(), mlir::lsp::operator<<(), and mlir::lsp::toJSON().

Referenced by mlir::lsp::Range::getAsSMRange(), and getLspDiagnoticFromDiag().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Position lhs,
const Position rhs 
)
friend

Definition at line 272 of file Protocol.h.

◆ operator<

bool operator< ( const Position lhs,
const Position rhs 
)
friend

Definition at line 275 of file Protocol.h.

◆ operator<=

bool operator<= ( const Position lhs,
const Position rhs 
)
friend

Definition at line 279 of file Protocol.h.

◆ operator==

bool operator== ( const Position lhs,
const Position rhs 
)
friend

Definition at line 268 of file Protocol.h.

Member Data Documentation

◆ character

int mlir::lsp::Position::character = 0

Character offset on a line in a document (zero-based).

Definition at line 266 of file Protocol.h.

Referenced by mlir::lsp::fromJSON(), getLocationFromLoc(), mlir::lsp::operator<<(), and mlir::lsp::toJSON().

◆ line

int mlir::lsp::Position::line = 0

Line position in a document (zero-based).

Definition at line 263 of file Protocol.h.

Referenced by mlir::lsp::fromJSON(), getLocationFromLoc(), mlir::lsp::operator<<(), and mlir::lsp::toJSON().


The documentation for this struct was generated from the following file: