[PATCH] Fix recognition of empty structures/unions
Richard Smith
richard at metafoo.co.uk
Fri Jun 7 14:45:40 PDT 2013
LGTM with a couple of minor tweaks.
================
Comment at: lib/Sema/SemaDecl.cpp:11145
@@ +11144,3 @@
+ } else
+ UnnamedOnly = ZeroSize = false;
+ }
----------------
"ZeroSize = false;" is not always correct here. The field type might be of zero size itself. Use "Context.getTypeSizeInChars(I->getType()).isZero()" maybe?
================
Comment at: lib/Sema/SemaDecl.cpp:11138-11139
@@ +11137,4 @@
+ unsigned UnnamedCnt = 0;
+ for (RecordDecl::field_iterator i = Record->field_begin(),
+ e = Record->field_end(); UnnamedOnly && i != e; ++i) {
+ if (i->isUnnamedBitfield()) {
----------------
Capital I / E, please.
http://llvm-reviews.chandlerc.com/D578
More information about the cfe-commits
mailing list