[PATCH] D71851: Use the first location in the fused location for diagnostic handler

Feng Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 21:34:42 PST 2019


liufengdb created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71851

Files:
  mlir/lib/IR/Diagnostics.cpp


Index: mlir/lib/IR/Diagnostics.cpp
===================================================================
--- mlir/lib/IR/Diagnostics.cpp
+++ mlir/lib/IR/Diagnostics.cpp
@@ -438,6 +438,9 @@
 void SourceMgrDiagnosticHandler::emitDiagnostic(Diagnostic &diag) {
   // Emit the diagnostic.
   auto loc = diag.getLocation();
+  if (auto fusedLoc = loc.dyn_cast<FusedLoc>()) {
+      loc = fusedLoc.getLocations().front();
+  }
   emitDiagnostic(loc, diag.str(), diag.getSeverity());
 
   // If the diagnostic location was a call site location, then print the call


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71851.235199.patch
Type: text/x-patch
Size: 556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191224/e2d40e11/attachment.bin>


More information about the llvm-commits mailing list