[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 12 23:09:09 PDT 2025


================
@@ -0,0 +1,414 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify -std=c++23 -Wno-unused-value -Wno-unused-but-set-variable
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify=expected,bitfieldwarnings -std=c++23 -Wno-unused-value -Wno-unused-but-set-variable -Wbitfield-width -Wbitfield-enum-conversion
+
+// This is more complex than the C version because the user can specify the
----------------
ojhunt wrote:

Good call, and this found a bug that I think exists in other enum and/or bitfield cases, specifically I was using `isSignedIntegerType()` instead of `isSignedIntegerOrEnumerationType()`, which I _think_ is the semantically correct thing to use to identify a signed type.

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


More information about the cfe-commits mailing list