[clang-tools-extra] [clang-tidy] Keep parentheses when replacing index access in `sizeof` calls (PR #82166)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 18 07:54:41 PST 2024
================
@@ -711,8 +711,12 @@ void LoopConvertCheck::doConversion(
if (const auto *Paren = Parents[0].get<ParenExpr>()) {
// Usage.Expression will be replaced with the new index variable,
// and parenthesis around a simple DeclRefExpr can always be
- // removed.
- Range = Paren->getSourceRange();
+ // removed except in case of a `sizeof` operator call.
+ auto GrandParents = Context->getParents(*Paren);
----------------
EugeneZelenko wrote:
Please do not use `auto` unless type is explicitly spelled in same statement or iterator.
https://github.com/llvm/llvm-project/pull/82166
More information about the cfe-commits
mailing list