[PATCH] D43741: [Analyzer] More accurate modeling about the increment operator of the operand with type bool.
Henry Wong via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 3 03:22:36 PST 2018
MTC added a comment.
Thank you for your review, @NoQ!
- `isBooleanType()` is used to check `_Bool` in C99/C11 and `bool` in C++. For `_Bool` , there is the same overflow problem.
- In C++98/C++11/C++14, for `++bool` and `bool+`, both sets true directly.
- In C++, `--bool` and `bool--` is illeagal.
- In C99/C11 standard, there is not much information about `_Bool++` and `_Bool--`.
>From the implementation of the compiler, `_Bool++` and `_Bool--` are divided into the following situations.
- _Bool b = 0; b++; // b -> 1
- _Bool b = 1; b++; // b -> 1
- _Bool b = 0; b--; // b -> 1
- _Bool b = 1; b--; // b -> 0
So it's reasonable to set to true if the operand of the increment operator is of type _Bool, just my opinion.
I not familiar with Objective-C++, can you provide a appropriate test about Objective-C++ for me, thank you!
And I'm not a native speaker of English, the grammar of the comments may not be correct. If so, please correct me, thanks!
Repository:
rC Clang
https://reviews.llvm.org/D43741
More information about the cfe-commits
mailing list