Open sebwolf-de opened 1 year ago
@llvm/issue-subscribers-clang-tidy
@llvm/issue-subscribers-bug
Found issue, bug is inside ArraySubscriptExpr class. Here we got:
as Base: DeclRefExpr 0x55905c7cdd48 'typename Range::Size' lvalue Var 0x55905c7cdab0 'index' 'typename Range::Size'
as Index: DeclRefExpr 0x55905c7cdd28 'double *':'double *' lvalue ParmVar 0x55905c7cd6a0 'toFill' 'double *':'double *'
clang/include/clang/AST/Expr.h:
bool lhsIsBase() const { return getRHS()->getType()->isIntegerType(); }
Because unknown type is not integer (template not resolved yet), then its used as Base. Proper way would be to also check if LHS is a pointer., and in worst case assume that LHS is base.
@llvm/issue-subscribers-clang-tidy
@llvm/issue-subscribers-clang-frontend
I find a false positive with clang-tidy's readability-non-const-parameter, if the access to the function parameter is hidden behind a template.
To reproduce:
If I run
clang-tidy test.cpp
, I get:If I replace the for loop above with the version below, clang-tidy won't throw a false positive.
for (size_t index = 0; index < n; index++)
I use clang-tidy from the Fedora repositories: