From 99bbea1dda8b2f9a13afb35e47b4f21aa8f2519c Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 21 Oct 2025 10:28:18 -0700 Subject: [PATCH] [mlir] Partially revert #162903 With #163862, this is not really necessary and causes downstream issues. --- mlir/lib/IR/Diagnostics.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp index 4d819188fa555..776b5c6588c71 100644 --- a/mlir/lib/IR/Diagnostics.cpp +++ b/mlir/lib/IR/Diagnostics.cpp @@ -378,10 +378,8 @@ struct SourceMgrDiagnosticHandlerImpl { } // Otherwise, try to load the source file. - auto bufferOrErr = llvm::MemoryBuffer::getFile(filename); - if (!bufferOrErr) - return 0; - unsigned id = mgr.AddNewSourceBuffer(std::move(*bufferOrErr), SMLoc()); + std::string ignored; + unsigned id = mgr.AddIncludeFile(std::string(filename), SMLoc(), ignored); filenameToBufId[filename] = id; return id; }