vsapsai added inline comments.
================ Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5226 +def err_objc_variable_sized_type_not_at_end : Error< + "field %0 with variable sized type %1 is not at the end of class">; +def note_next_field_declaration : Note< ---------------- rjmccall wrote: > "Variable sized type" is a bit too close to the C99 variably-sized array type > extension. Maybe "unbounded array type" if you're trying to cover both "int > x[];" and "int x[0];"? > > Well, I guess there's some precedent for using this terminology, but ugh. I took "variable sized type" entirely from ``` def ext_variable_sized_type_in_struct : ExtWarn< "field %0 with variable sized type %1 not at the end of a struct or class is" " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>; ``` I'm not covering `int x[0];`. All the changes are for `int x[];` and `struct { int x[]; }` ================ Comment at: clang/lib/Sema/SemaDecl.cpp:15055 } + // If it is the last field is checked elsewhere. } ---------------- rjmccall wrote: > "Whether" rather than "If", please. You should also leave a comment about > *why* we can't check this here — I assume because you also want to complain > about the last explicit ivar if there are synthesized ivars? I think we > could at least still check this for `@interface` ivars. Will change s/If/Whether/ Main reason for checking elsewhere is to check after ivars are synthesized, you are right. At some point I had this check done here but for detecting ivar-after-flexible-array on interface/extension, interface/implementation border I am relying on chained ObjCIvarDecl. But here I have `ArrayRef<Decl *> Fields` so implementation will be different. I decided that it would be cleaner to perform the check only in DiagnoseVariableSizedIvars. https://reviews.llvm.org/D38773 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits