================
@@ -103,14 +103,31 @@ void NonConstParameterCheck::check(const
MatchFinder::MatchResult &Result) {
}
} else if (const auto *VD = Result.Nodes.getNodeAs<VarDecl>("Mark")) {
const QualType T = VD->getType();
- if (T->isDependentType())
- markCanNotBeConst(VD->getInit(), false);
- else if ((T->isPointerType() && !T->getPointeeType().isConstQualified()) ||
- T->isArrayType() || T->isRecordType())
+ if (T->isDependentType()) {
+ const Expr *Init = VD->getInit()->IgnoreParenCasts();
+ if (const auto *U = dyn_cast<UnaryOperator>(Init);
+ U && U->getOpcode() == UO_Deref) {
+ markCanNotBeConst(U->getSubExpr(), true);
+ } else if (const auto *PLE = dyn_cast<ParenListExpr>(Init)) {
+ for (unsigned I = 0; I < PLE->getNumExprs(); ++I) {
----------------
vbvictor wrote:
Add tests with >= 2 Init expr
https://github.com/llvm/llvm-project/pull/186953
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits