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

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

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 281 of file Protocol.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

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

Definition at line 282 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 286 of file Protocol.h.

References character, and line.

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 316 of file Protocol.h.

References character, and line.

Referenced by mlir::lsp::Range::getAsSMRange().

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 302 of file Protocol.h.

◆ operator<

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

Definition at line 305 of file Protocol.h.

◆ operator<=

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

Definition at line 309 of file Protocol.h.

◆ operator==

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

Definition at line 298 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 296 of file Protocol.h.

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

◆ line

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

Line position in a document (zero-based).

Definition at line 293 of file Protocol.h.

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


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