[clang] 191c60f - [ThreadSafety] Fix C++20 build (#212042)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 25 11:03:05 PDT 2026
Author: Benjamin Kramer
Date: 2026-07-25T18:03:00Z
New Revision: 191c60fe7cee5587ad7f7a6fd7b5bbf7b0042bec
URL: https://github.com/llvm/llvm-project/commit/191c60fe7cee5587ad7f7a6fd7b5bbf7b0042bec
DIFF: https://github.com/llvm/llvm-project/commit/191c60fe7cee5587ad7f7a6fd7b5bbf7b0042bec.diff
LOG: [ThreadSafety] Fix C++20 build (#212042)
In C++20 (P1008R1 https://wg21.link/p1008r1), aggregates are prohibited
from having any user-declared constructors, even if they are = delete or
= default.
Added:
Modified:
clang/lib/Analysis/ThreadSafety.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index 2b394865c5a5e..fe94910e905a3 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1802,9 +1802,13 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> {
public:
enum Point : char { Pre = 0, Post = 1 };
- struct ContextSwitchScope {
+ class ContextSwitchScope {
DualLocalVarContext &DC;
Point LastPoint;
+
+ public:
+ ContextSwitchScope(DualLocalVarContext &DC, Point LastPoint)
+ : DC(DC), LastPoint(LastPoint) {}
ContextSwitchScope(const ContextSwitchScope &) = delete;
ContextSwitchScope &operator=(const ContextSwitchScope &) = delete;
~ContextSwitchScope() { DC.switchContextTo(LastPoint); }
@@ -1814,7 +1818,7 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> {
[[nodiscard]] ContextSwitchScope switchToContextForScope(Point P) {
Point PriorPoint = CurrPoint;
switchContextTo(P);
- return ContextSwitchScope{*this, PriorPoint};
+ return ContextSwitchScope(*this, PriorPoint);
}
/// Update the pre- and post-contexts to be associated with the next Stmt \p
More information about the cfe-commits
mailing list