Skip to content

Commit 290d0db

Browse files
Added Conflicting Global Accesses checker
This checker attempts to detect unsequenced accesses to global variables. It recurses into function calls in the same translation unit, and can handle fields on global structs/unions.
1 parent b01c71b commit 290d0db

File tree

5 files changed

+1060
-0
lines changed

5 files changed

+1060
-0
lines changed

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "CastingThroughVoidCheck.h"
2020
#include "ChainedComparisonCheck.h"
2121
#include "ComparePointerToMemberVirtualFunctionCheck.h"
22+
#include "ConflictingGlobalAccesses.h"
2223
#include "CopyConstructorInitCheck.h"
2324
#include "CrtpConstructorAccessibilityCheck.h"
2425
#include "DanglingHandleCheck.h"
@@ -124,6 +125,8 @@ class BugproneModule : public ClangTidyModule {
124125
"bugprone-chained-comparison");
125126
CheckFactories.registerCheck<ComparePointerToMemberVirtualFunctionCheck>(
126127
"bugprone-compare-pointer-to-member-virtual-function");
128+
CheckFactories.registerCheck<ConflictingGlobalAccesses>(
129+
"bugprone-conflicting-global-accesses");
127130
CheckFactories.registerCheck<CopyConstructorInitCheck>(
128131
"bugprone-copy-constructor-init");
129132
CheckFactories.registerCheck<DanglingHandleCheck>(

clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ add_clang_library(clangTidyBugproneModule STATIC
1515
CastingThroughVoidCheck.cpp
1616
ChainedComparisonCheck.cpp
1717
ComparePointerToMemberVirtualFunctionCheck.cpp
18+
ConflictingGlobalAccesses.cpp
1819
CopyConstructorInitCheck.cpp
1920
CrtpConstructorAccessibilityCheck.cpp
2021
DanglingHandleCheck.cpp

0 commit comments

Comments
 (0)