[PATCH] D80258: Fix SourceMgrDiagnosticHandler::convertLocToSMLoc for unknown line/column scenerio.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 16:36:40 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGeddf4dc869db: Fix SourceMgrDiagnosticHandler::convertLocToSMLoc for unknown line/column… (authored by Jing, committed by rriddle).
Herald added a subscriber: aartbik.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80258/new/

https://reviews.llvm.org/D80258

Files:
  mlir/lib/IR/Diagnostics.cpp


Index: mlir/lib/IR/Diagnostics.cpp
===================================================================
--- mlir/lib/IR/Diagnostics.cpp
+++ mlir/lib/IR/Diagnostics.cpp
@@ -509,6 +509,11 @@
 /// Get a memory buffer for the given file, or the main file of the source
 /// manager if one doesn't exist. This always returns non-null.
 llvm::SMLoc SourceMgrDiagnosticHandler::convertLocToSMLoc(FileLineColLoc loc) {
+  // The column and line may be zero to represent unknown column and/or unknown
+  /// line/column information.
+  if (loc.getLine() == 0 || loc.getColumn() == 0)
+    return llvm::SMLoc();
+
   unsigned bufferId = impl->getSourceMgrBufferIDForFile(mgr, loc.getFilename());
   if (!bufferId)
     return llvm::SMLoc();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80258.270908.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200615/ecd54e29/attachment.bin>


More information about the llvm-commits mailing list