[Mlir-commits] [mlir] [mlir] DistinctAttributeAllocator: fix race (PR #132935)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 25 06:49:26 PDT 2025


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 b24694371c62a71aab3550e983a6bf971ed721ff 7fbb72b897f5d3402cc22dd3c6edf56b46bf3402 --extensions h -- mlir/lib/IR/AttributeDetail.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/IR/AttributeDetail.h b/mlir/lib/IR/AttributeDetail.h
index 08ab3c0114..6a481aad91 100644
--- a/mlir/lib/IR/AttributeDetail.h
+++ b/mlir/lib/IR/AttributeDetail.h
@@ -438,7 +438,7 @@ public:
 
 private:
   DistinctAttrStorage *allocateImpl(Attribute referencedAttr,
-                                    const std::unique_lock<std::mutex>& lock) {
+                                    const std::unique_lock<std::mutex> &lock) {
     assert(lock.owns_lock());
     return new (getAllocatorInUse(lock).Allocate<DistinctAttrStorage>())
         DistinctAttrStorage(referencedAttr);
@@ -448,8 +448,8 @@ private:
   /// thread-local, non-thread safe bump pointer allocator is used instead to
   /// prevent use-after-free errors whenever attribute storage created on a
   /// crash recover thread is accessed after the thread joins.
-  llvm::BumpPtrAllocator &getAllocatorInUse(
-      const std::unique_lock<std::mutex>& lock) {
+  llvm::BumpPtrAllocator &
+  getAllocatorInUse(const std::unique_lock<std::mutex> &lock) {
     assert(lock.owns_lock());
     if (useThreadLocalAllocator)
       return allocatorCache.get();

``````````

</details>


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


More information about the Mlir-commits mailing list