PR46255: Fix field diagnostics for C records with anonymous members.
authorErich Keane <erich.keane@intel.com>
Tue, 9 Jun 2020 19:19:35 +0000 (12:19 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 9 Jun 2020 19:27:44 +0000 (12:27 -0700)
commit113b0d7d0bd637743efb050ad619dd0c6d306e96
treee16a0875af135d7db60ef546c6125c4e8f94d3dc
parentb94c9e3b55ab97f6646018dec2c1d3647c04cda3
PR46255: Fix field diagnostics for C records with anonymous members.

The ParseStructUnionBody function was separately keeping track of the
field decls for historical reasons, however the "ActOn" functions add
the field to the RecordDecl anyway.

The "ParseStructDeclaration" function, which handles parsing fields
didn't have a way of handling what happens on an anonymous field, and
changing it would alter a large amount of objc code, so I chose instead
to implement this by just filling the FieldDecls vector with the actual
FieldDecls that were successfully added to the recorddecl .
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Parse/Parser.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Sema/struct-decl.c