Skip to content

Commit 6879af3

Browse files
[clang-tidy] 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 8bc0d4d commit 6879af3

File tree

9 files changed

+1709
-0
lines changed

9 files changed

+1709
-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
@@ -20,6 +20,7 @@
2020
#include "CastingThroughVoidCheck.h"
2121
#include "ChainedComparisonCheck.h"
2222
#include "ComparePointerToMemberVirtualFunctionCheck.h"
23+
#include "ConflictingGlobalAccessesCheck.h"
2324
#include "CopyConstructorInitCheck.h"
2425
#include "CrtpConstructorAccessibilityCheck.h"
2526
#include "DanglingHandleCheck.h"
@@ -127,6 +128,8 @@ class BugproneModule : public ClangTidyModule {
127128
"bugprone-chained-comparison");
128129
CheckFactories.registerCheck<ComparePointerToMemberVirtualFunctionCheck>(
129130
"bugprone-compare-pointer-to-member-virtual-function");
131+
CheckFactories.registerCheck<ConflictingGlobalAccessesCheck>(
132+
"bugprone-conflicting-global-accesses");
130133
CheckFactories.registerCheck<CopyConstructorInitCheck>(
131134
"bugprone-copy-constructor-init");
132135
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
@@ -16,6 +16,7 @@ add_clang_library(clangTidyBugproneModule STATIC
1616
CastingThroughVoidCheck.cpp
1717
ChainedComparisonCheck.cpp
1818
ComparePointerToMemberVirtualFunctionCheck.cpp
19+
ConflictingGlobalAccessesCheck.cpp
1920
CopyConstructorInitCheck.cpp
2021
CrtpConstructorAccessibilityCheck.cpp
2122
DanglingHandleCheck.cpp

0 commit comments

Comments
 (0)