Skip to content

Conversation

jansvoboda11
Copy link
Contributor

With #163862, this is not really necessary and causes downstream issues.

With llvm#163862, this is not really necessary and causes downstream issues.
@jansvoboda11 jansvoboda11 requested a review from uenoku October 21, 2025 17:29
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Oct 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 21, 2025

@llvm/pr-subscribers-mlir-core

@llvm/pr-subscribers-mlir

Author: Jan Svoboda (jansvoboda11)

Changes

With #163862, this is not really necessary and causes downstream issues.


Full diff: https://github.com/llvm/llvm-project/pull/164464.diff

1 Files Affected:

  • (modified) mlir/lib/IR/Diagnostics.cpp (+2-4)
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;
   }

Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick fix!

@jansvoboda11 jansvoboda11 enabled auto-merge (squash) October 21, 2025 17:37
@jansvoboda11 jansvoboda11 merged commit e1e4154 into llvm:main Oct 21, 2025
12 of 13 checks passed
@jansvoboda11 jansvoboda11 deleted the mlir-source-mgr-revert branch October 21, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants