rjmccall added inline comments.
================ Comment at: lib/Sema/SemaExpr.cpp:6097 + // non-trivial to copy or default-initialize. + checkNonTrivialCUnionInInitList(ILE); + } ---------------- ahatanak wrote: > rjmccall wrote: > > Can we extract a common function that checks the initializer expression of > > a non-trivial C union? I think there are at least three separate places > > that do that in this patch, and it's not too hard to imagine that we might > > want to add more cases to the common analysis. > Do you mean we should have something like `bool > checkNonTrivialCUnionInInitList(const Expr *Init)` so that we don't have to > call `dyn_cast`? If `Init` is an `InitListExpr`, the function diagnoses > non-trivial C unions types and returns true, otherwise it returns false. Well, the goal is not to eliminate a `dyn_cast`, it's to generally perform whatever checking is necessary for an initializer. Currently all of our checking is specific to `InitListExpr`, but there might be other cases we'll want to care about, in which case we'll probably care about them in all three of these places. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63753/new/ https://reviews.llvm.org/D63753 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits