[Mlir-commits] [mlir] fix a concurrent destruction issue for FallbackTypeIDResolver::registerImplicitTypeID due to function static variable (PR #85471)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 15 14:45:01 PDT 2024
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 a4610c7182d35093e9e0fde5be91659a8b9da5b8 096ee7bc13234afbd1933aff67a504d61a15ce20 -- mlir/lib/Support/TypeID.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Support/TypeID.cpp b/mlir/lib/Support/TypeID.cpp
index 0cf50bc2f7..9ad877bfb3 100644
--- a/mlir/lib/Support/TypeID.cpp
+++ b/mlir/lib/Support/TypeID.cpp
@@ -81,11 +81,11 @@ struct ImplicitTypeIDRegistry {
} // end namespace
TypeID detail::FallbackTypeIDResolver::registerImplicitTypeID(StringRef name) {
- // To prevent race conditions when one thread is accessing this `static`
- // variable while other threads are destructing it; construct the `registry`
- // on the heap.
- static auto *registry = new ImplicitTypeIDRegistry();
- return registry->lookupOrInsert(name);
+ // To prevent race conditions when one thread is accessing this `static`
+ // variable while other threads are destructing it; construct the `registry`
+ // on the heap.
+ static auto *registry = new ImplicitTypeIDRegistry();
+ return registry->lookupOrInsert(name);
}
//===----------------------------------------------------------------------===//
``````````
</details>
https://github.com/llvm/llvm-project/pull/85471
More information about the Mlir-commits
mailing list