================ @@ -130,6 +140,14 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) { this); } + if (WarnOnSizeOfInLoopTermination) { + Finder->addMatcher(LoopExpr(hasDescendant(binaryOperator( ---------------- ziqingluo-90 wrote:
Since `hasDescendant` is used, it also matches loop bodies, right? Maybe add a test: ``` int A[10]; for(int i = 0; i < sizeof(A); i++) { if (x < sizeof(A)) { ... } // Should this be matched? Will this be matched twice? } ``` Also please add some tests for nested loops. https://github.com/llvm/llvm-project/pull/143205 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits