[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-13 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:13069 - // therefore don't strictly fit into a signed bitfield of width 1. - if (FieldWidth == 1 && Value == 1) -return false; aaron.ballman wrote: > aaron.ballman wrote: > >

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-12 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:13069 - // therefore don't strictly fit into a signed bitfield of width 1. - if (FieldWidth == 1 && Value == 1) -return false; ShawnZhong wrote: > ShawnZhong wrote: > >

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-12 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:13069 - // therefore don't strictly fit into a signed bitfield of width 1. - if (FieldWidth == 1 && Value == 1) -return false; aaron.ballman wrote: > thakis wrote: > > This was

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-09 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong marked an inline comment as done. ShawnZhong added a comment. In D131255#3706784 , @aaron.ballman wrote: > LGTM! Do you need someone to commit on your behalf? If so, what name and > email address would you like used for patch attribution?

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-05 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong updated this revision to Diff 450468. ShawnZhong added a comment. - Added CodeGen tests. - Fixed failed tests that assigned 1 to `int:1`. - Modified the Sema test to use `int:` instead of `signed char:1`. - Added release note. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-05 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong added a comment. Thanks for the quick reply and the reference on the C standard! On the C++ side, Section C.1.8 specified that `int` bit-fields are signed: > Change: Bit-fields of type plain int are signed. > Rationale: Leaving the choice of signedness to implementations could lead

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-05 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong updated this revision to Diff 450274. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131255/new/ https://reviews.llvm.org/D131255 Files: clang/lib/Sema/SemaChecking.cpp clang/test/Sema/constant-conversion.c Index:

[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield

2022-08-05 Thread Shawn Zhong via Phabricator via cfe-commits
ShawnZhong created this revision. ShawnZhong added a reviewer: rsmith. ShawnZhong added a project: clang. Herald added a project: All. ShawnZhong requested review of this revision. Herald added a subscriber: cfe-commits. Fix https://github.com/llvm/llvm-project/issues/53253 Repository: rG