Author: Marco Elver Date: 2025-08-20T12:17:52+02:00 New Revision: e2a077fed977e91e2f4dd0f8e77761982b3a6211
URL: https://github.com/llvm/llvm-project/commit/e2a077fed977e91e2f4dd0f8e77761982b3a6211 DIFF: https://github.com/llvm/llvm-project/commit/e2a077fed977e91e2f4dd0f8e77761982b3a6211.diff LOG: Thread Safety Analysis: Graduate ACQUIRED_BEFORE() and ACQUIRED_AFTER() from beta features (#152853) Both these attributes were introduced in ab1dc2d54db5 ("Thread Safety Analysis: add support for before/after annotations on mutexes") back in 2015 as "beta" features. Anecdotally, we've been using `-Wthread-safety-beta` for years without problems. Furthermore, this feature requires the user to explicitly use these attributes in the first place. After 10 years, let's graduate the feature to the stable feature set, and reserve `-Wthread-safety-beta` for new upcoming features. Added: Modified: clang/docs/ThreadSafetyAnalysis.rst clang/lib/Analysis/ThreadSafety.cpp Removed: ################################################################################ diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index 4fc7ff28e9931..853a8fae4a907 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -825,13 +825,6 @@ doesn't know that munl.mu == mutex. The SCOPED_CAPABILITY attribute handles aliasing for MutexLocker, but does so only for that particular pattern. -ACQUIRED_BEFORE(...) and ACQUIRED_AFTER(...) support is still experimental. ---------------------------------------------------------------------------- - -ACQUIRED_BEFORE(...) and ACQUIRED_AFTER(...) are currently being developed under -the ``-Wthread-safety-beta`` flag. - - .. _mutexheader: mutex.h diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 026d0308921a5..131170df9976e 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -1392,8 +1392,7 @@ void ThreadSafetyAnalyzer::addLock(FactSet &FSet, const FactEntry *Entry, } // Check before/after constraints - if (Handler.issueBetaWarnings() && - !Entry->asserted() && !Entry->declared()) { + if (!Entry->asserted() && !Entry->declared()) { GlobalBeforeSet->checkBeforeAfter(Entry->valueDecl(), FSet, *this, Entry->loc(), Entry->getKind()); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits