baloghadamsoftware marked 7 inline comments as done. baloghadamsoftware added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:126-128 + const auto *Body = dyn_cast_or_null<CompoundStmt>(Ctor->getBody()); + if (!Body) + return; ---------------- aaron.ballman wrote: > This can be hoisted into the matcher with `hasBody(anything())` I believe. > One interesting test case that's somewhat related are constructors that use a > function-try-block instead of a compound statement. e.g., > ``` > class C { > int i; > > public: > C() try { > i = 12; > } catch (...) { > } > }; > ``` I think we should skip these cases similarly to initialization inside a try block in a body that is compound statement. Maybe the initialization throws thus it is inappropriate to convert it to member initializer. I also added a test case for this. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits