[mlir-lsp] Avoid empty range diagnostic

This commit is contained in:
Jacques Pienaar 2021-06-02 12:07:19 -07:00
parent 0289a2692e
commit 3f70b4e033
1 changed files with 2 additions and 1 deletions
mlir/lib/Tools/mlir-lsp-server

View File

@ -87,7 +87,8 @@ getLocationFromLoc(llvm::SourceMgr &sourceMgr, Location loc,
if (Optional<llvm::SMRange> range =
AsmParserState::convertIdLocToRange(loc)) {
auto lineCol = sourceMgr.getLineAndColumn(range->End);
location->range.end.character = lineCol.second - 1;
location->range.end.character =
std::max(fileLoc.getColumn() + 1, lineCol.second - 1);
}
return WalkResult::interrupt();
}