[Mlir-commits] [mlir] 3f70b4e - [mlir-lsp] Avoid empty range diagnostic

Jacques Pienaar llvmlistbot at llvm.org
Wed Jun 2 12:07:33 PDT 2021


Author: Jacques Pienaar
Date: 2021-06-02T12:07:19-07:00
New Revision: 3f70b4e0336001ca379490d1481024ddb87a3501

URL: https://github.com/llvm/llvm-project/commit/3f70b4e0336001ca379490d1481024ddb87a3501
DIFF: https://github.com/llvm/llvm-project/commit/3f70b4e0336001ca379490d1481024ddb87a3501.diff

LOG: [mlir-lsp] Avoid empty range diagnostic

Added: 
    

Modified: 
    mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
index e0bba9e9fc78..3b1dfcc6195e 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
@@ -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();
     }


        


More information about the Mlir-commits mailing list