Issue |
154907
|
Summary |
[clang-tidy] Add `AllowIteratorDecrementIncrement` option to cppcoreguidelines-pro-bounds-pointer-arithmetic
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
carlosgalvezp
|
The check currently warns at this type of code:
```cpp
while(it != end)
{
// ...
++it; // warning
}
```
This is technically correct as per the guidelines. However, this pattern is widespread and the warning creates a fair amount of noise. Noise which may lead to people disabling the check altogether, which leads to missing warnings on more serious types of pointer arithmetic.
Thus, I propose to introduce an option `AllowIteratorDecrementIncrement` (or similar), off-by-default, to be able to relax the check a bit and allow for these use cases and reduce noise. It can also help enabling the check in different steps, from the more serious cases to the less serious ones.
As an example, the corresponding rule in MISRA C++:2008 does allow these operations as an exception to the rule.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs