diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp --- a/mlir/lib/IR/Diagnostics.cpp +++ b/mlir/lib/IR/Diagnostics.cpp @@ -466,7 +466,7 @@ SmallVector> locationStack; auto addLocToStack = [&](Location loc, StringRef locContext) { if (Optional showableLoc = findLocToShow(loc)) - locationStack.emplace_back(loc, locContext); + locationStack.emplace_back(showableLoc.getValue(), locContext); }; // Add locations to display for this diagnostic.