[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 1 07:43:40 PDT 2025
================
@@ -0,0 +1,72 @@
+.. title:: clang-tidy - bugprone-conflicting-global-accesses
+
+bugprone-conflicting-global-accesses
+====================================
+
+Finds conflicting accesses on global variables.
+
+Modifying twice or reading and modifying a memory location without a
+defined sequence of the operations is either undefined behavior or has
+unspecified order. This checker is similar to the -Wunsequenced clang warning,
+however it only looks at global variables and therefore can find conflicting
+actions recursively inside functions as well.
----------------
vbvictor wrote:
I think you should not explicitly exclude cases that are covered by "-Wunsequenced". It's okay for check to have duplicate functionality with compiler flags. Moreover, for gcc there is "-Wsequence-point" and we don't know to what extent "-Wunsequenced" can find bugs, so It's better just to mention that functionality of this check may overlap with existing compiler flags such as "-Wunsequenced", "-Wsequence-point".
https://github.com/llvm/llvm-project/pull/130421
More information about the cfe-commits
mailing list