[clang] [clang][analyzer][WIP] Introduce modeling for threading related checkers (PR #109636)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 05:47:14 PDT 2024


Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?Fülöp?= <endre.fulop at sigmatechnology.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/109636 at github.com>


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 898fd396b836600ef857464941220d07894b859b c9219d624a3d3fe2348a7ee926c7a76fa15c6275 --extensions cpp,c,h -- clang/lib/StaticAnalyzer/Checkers/MutexModeling.cpp clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingAPI.h clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDefs.h clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDomain.h clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingGDM.h clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexRegionExtractor.h clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp clang/test/Analysis/analyzer-enabled-checkers.c clang/test/Analysis/block-in-critical-section.cpp clang/test/Analysis/pthreadlock_state.c clang/test/Analysis/pthreadlock_state_nottracked.c clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingAPI.h b/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingAPI.h
index 632670a473..4fc2ddc8ad 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingAPI.h
+++ b/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingAPI.h
@@ -53,9 +53,9 @@ MakeFirstArgExtractor(ArrayRef<StringRef> NameParts, int NumArgsRequired = 1,
       CallDescription{MatchAs, NameParts, NumArgsRequired}};
 }
 
-inline auto MakeMemberExtractor(ArrayRef<StringRef> NameParts,
-                                int NumArgsRequired = 0,
-                                CallDescription::Mode MatchAs = CDM::CXXMethod) {
+inline auto
+MakeMemberExtractor(ArrayRef<StringRef> NameParts, int NumArgsRequired = 0,
+                    CallDescription::Mode MatchAs = CDM::CXXMethod) {
   return MemberMutexExtractor{
       CallDescription{MatchAs, NameParts, NumArgsRequired}};
 }
diff --git a/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDefs.h b/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDefs.h
index d0b2f5957b..48d1bedffb 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDefs.h
+++ b/clang/lib/StaticAnalyzer/Checkers/MutexModeling/MutexModelingDefs.h
@@ -22,8 +22,8 @@ namespace clang::ento::mutex_modeling {
 
 static auto getHandledEvents(){return std::vector<EventDescriptor> {
   // - Pthread
-  EventDescriptor{MakeFirstArgExtractor({"pthread_mutex_init"}), EventKind::Init,
-                  LibraryKind::Pthread},
+  EventDescriptor{MakeFirstArgExtractor({"pthread_mutex_init"}),
+                  EventKind::Init, LibraryKind::Pthread},
 #if 0
              // TODO: pthread_rwlock_init(2 arguments).
              // TODO: lck_mtx_init(3 arguments).

``````````

</details>


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


More information about the cfe-commits mailing list