[PATCH] D142587: [clang-tidy] Improved too-small-loop-variable with bit-field support
Henric Karlsson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 13 02:01:17 PDT 2023
Henric added a comment.
Hi
With this patch, the following code gives me a warning that I don't think is intentional.
typedef struct S {
int x:4;
} S;
void foo(S s) {
for (int i=10; i > s.x; --i) ;
}
loop_var.c:6:22: warning: loop variable has narrower type 'int:4' than iteration's upper bound 'int' [bugprone-too-small-loop-variable]
for (int i=10; i > s.x; --i) ;
^
Looks like the logic i reversed here, so the loop variable gets the bit field type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142587/new/
https://reviews.llvm.org/D142587
More information about the cfe-commits
mailing list