[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 19:33:56 PDT 2017

rjmccall added inline comments.

Comment at: clang/lib/Sema/SemaDecl.cpp:15055
+          // If it is the last field is checked elsewhere.
vsapsai wrote:
> 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.
Is there a reason to do any of the checking here, then?


More information about the cfe-commits mailing list