[Mlir-commits] [mlir] [mlir] Don't use shared_ptr reference. (PR #202703)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jun 9 08:59:35 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Weiwei C (weiweichen)

<details>
<summary>Changes</summary>

`const std::share_ptr<...>&` doesn't increase ref count which can easily cause downstream user bugs with maintaining the life time of the object. Remove `&` to kick in ref count. 

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


1 Files Affected:

- (modified) mlir/lib/Bytecode/Reader/BytecodeReader.cpp (+1-1) 


``````````diff
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index 00c53dae83ea8..96ead28d0aa40 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -1924,7 +1924,7 @@ class mlir::BytecodeReader::Impl {
 
   /// The optional owning source manager, which when present may be used to
   /// extend the lifetime of the input buffer.
-  const std::shared_ptr<llvm::SourceMgr> &bufferOwnerRef;
+  const std::shared_ptr<llvm::SourceMgr> bufferOwnerRef;
 };
 
 LogicalResult BytecodeReader::Impl::read(

``````````

</details>


https://github.com/llvm/llvm-project/pull/202703


More information about the Mlir-commits mailing list