NoQ added a comment. I recommend starting with CFG tests for this feature. I.e., do `-analyzer-checker debug.DumpCFG` and make sure that every `CFGStmt` that corresponds to a constructor is a `CFGConstructor` (i.e., has a `ConstructionContext` explained in the dump). Cf. `test/Analysis/cfg-rich-constructors.cpp`.
================ Comment at: clang/test/Analysis/clangsa_unsupported_features/handle_constructors_for_lambda_captures.cpp:11 +void reached_function_from_simple_copy() { + clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}} +} ---------------- This test doesn't test whether the function is inlined. If the function is not inlined, the code will still be reachable when analyzed as top frame. See also `clang_analyzer_checkInlined()`. ================ Comment at: clang/test/Analysis/clangsa_unsupported_features/handle_constructors_for_lambda_captures.cpp:29 + operator=(incr_on_copy_for_simple_usage &&o) = delete; + ~incr_on_copy_for_simple_usage() = default; +}; ---------------- That's the reason why your tests seem to work. If you change it to `~incr_on_copy_for_simple_usage() {}`, we will no longer evaluate the capture correctly. The difference here is that we allow ourselves inline the constructor without a construction context when the destructor is trivial. But when the destructor is non-trivial, our inability to keep track of the object under construction until destruction will have terrible consequences. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69602/new/ https://reviews.llvm.org/D69602 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits