[Mlir-commits] [mlir] 50264ff - Adding missing filter check to SourceMgrDiagnosticHandler::EmitDiagnostics
River Riddle
llvmlistbot at llvm.org
Wed Aug 4 16:53:58 PDT 2021
Author: Catherine Payne
Date: 2021-08-04T23:52:00Z
New Revision: 50264ff88ab1ed40119f13d482b0cc8326c1e95d
URL: https://github.com/llvm/llvm-project/commit/50264ff88ab1ed40119f13d482b0cc8326c1e95d
DIFF: https://github.com/llvm/llvm-project/commit/50264ff88ab1ed40119f13d482b0cc8326c1e95d.diff
LOG: Adding missing filter check to SourceMgrDiagnosticHandler::EmitDiagnostics
There is a case in EmitDiagnostics where the filter check is bypassed (when locationStack is empty). Filter might also be bypassed when loc instead of showableLoc is added to the locationStack.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D106522
Added:
Modified:
mlir/lib/IR/Diagnostics.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp
index 4b4add29f6a73..f657d08be8437 100644
--- a/mlir/lib/IR/Diagnostics.cpp
+++ b/mlir/lib/IR/Diagnostics.cpp
@@ -466,7 +466,7 @@ void SourceMgrDiagnosticHandler::emitDiagnostic(Diagnostic &diag) {
SmallVector<std::pair<Location, StringRef>> locationStack;
auto addLocToStack = [&](Location loc, StringRef locContext) {
if (Optional<Location> showableLoc = findLocToShow(loc))
- locationStack.emplace_back(loc, locContext);
+ locationStack.emplace_back(*showableLoc, locContext);
};
// Add locations to display for this diagnostic.
More information about the Mlir-commits
mailing list