[Mlir-commits] [mlir] [mlir][bytecode] Fix SourceMgr lifetime extension in BytecodeReader (PR #185321)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Mar 9 02:45:38 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Bytecode/Reader/BytecodeReader.cpp mlir/unittests/Bytecode/BytecodeTest.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/unittests/Bytecode/BytecodeTest.cpp b/mlir/unittests/Bytecode/BytecodeTest.cpp
index 25af104f8..25428b068 100644
--- a/mlir/unittests/Bytecode/BytecodeTest.cpp
+++ b/mlir/unittests/Bytecode/BytecodeTest.cpp
@@ -237,8 +237,7 @@ TEST(Bytecode, SourceMgrLifetimeExtendedByReader) {
MLIRContext context;
// Create a trivial module and serialize it to bytecode.
- OwningOpRef<ModuleOp> module =
- ModuleOp::create(UnknownLoc::get(&context));
+ OwningOpRef<ModuleOp> module = ModuleOp::create(UnknownLoc::get(&context));
std::string bytecode;
llvm::raw_string_ostream os(bytecode);
ASSERT_TRUE(succeeded(writeBytecodeToFile(module.get(), os)));
@@ -255,8 +254,8 @@ TEST(Bytecode, SourceMgrLifetimeExtendedByReader) {
llvm::MemoryBufferRef bufRef =
*sourceMgr->getMemoryBuffer(sourceMgr->getMainFileID());
- reader = std::make_shared<BytecodeReader>(
- bufRef, config, /*lazyLoad=*/true, sourceMgr);
+ reader = std::make_shared<BytecodeReader>(bufRef, config, /*lazyLoad=*/true,
+ sourceMgr);
// sourceMgr destroyed here — reader must have extended its lifetime.
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/185321
More information about the Mlir-commits
mailing list