MTC added a comment. I didn't test the code, but the code seems correct. Thanks!
================ Comment at: lib/StaticAnalyzer/Core/LoopWidening.cpp:88 + MatchFinder Finder; + Finder.addMatcher(varDecl(hasType(referenceType())).bind("match"), new Callback(LCtx, MRMgr, ITraits)); + Finder.matchAST(ASTCtx); ---------------- The code should fit within 80 columns of text. ================ Comment at: test/Analysis/loop-widening-invalid-type.cpp:1 +// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-max-loop 4 -analyzer-config widen-loops=true -verify %s + ---------------- I think it's better to add more expressive tests. Like: ``` struct A { int x; A(int x) : x(x) {} }; void invalid_type_region_access() { const A &a = A(10); for(int i = 0; i < 10; ++i) {} clang_analyzer_eval(a.x ==10); // expected-warning{{TRUE}} } ``` I think should use more related names instead of `loop-widening-invalid-type.cpp`, like `loop-widening-reference-type`. ================ Comment at: test/Analysis/loop-widening-invalid-type.cpp:8 + +void invalid_type_region_access() { // expected-no-diagnostics + const A &x = B(); ---------------- I don't know what the purpose of the test is, is the comment `no-crash` better? Repository: rC Clang https://reviews.llvm.org/D47044 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits