[clang-tools-extra] [clang-tidy] Fix bugprone-tagged-union-member-count false-positive (PR #135831)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 12:46:57 PDT 2025


=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?=,=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?=,
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?=
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/135831 at github.com>


================
@@ -28,6 +31,25 @@ Example:
     } Data;
   };
 
+The following example illustrates the exception for unions and enums from
+system header files and the ``std`` namespace.
+
+.. code-block:: c++
+
+  #include <pthread.h>
+
+  struct NotTaggedUnion {
+    enum MyEnum { MyEnumConstant1, MyEnumConstant2 } En;
+    pthread_mutex_t Mutex;
+  };
+
+The ``pthread_mutex_t`` type may be defined as a union behind a typedef,
----------------
vbvictor wrote:

```suggestion
The ``pthread_mutex_t`` type may be defined as a union behind a ``typedef``,
```

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


More information about the cfe-commits mailing list