[PATCH] D38773: [Sema] Add support for flexible array members in Obj-C.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 15:50:42 PDT 2017

rjmccall 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<
"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.

Comment at: clang/lib/Sema/SemaDecl.cpp:15055
+          // If it is the last field is checked elsewhere.
"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.


More information about the cfe-commits mailing list