Attached is new patch with the curly braces removed.
I also removed the braces a few lines below in the snippet I used as
boilerplate.
Somebody please commit this for me.
Thanks,
Robert
On Mon, 2013-06-24 at 16:02 -0400, Aaron Ballman wrote:
> On Mon, Jun 24, 2013 at 3:51 PM, Robert Wilhelm <[email protected]>
> wrote:
> >
> > I have attached patch for http://llvm.org/bugs/show_bug.cgi?id=16395.
> >
> > Bail out, if HandleMSProperty returns null.
> > While HandleField never returns null, HandleMSProperty does on error.
> >
> > Testcase and bug report by Eli Friedman.
> > Index: lib/Sema/SemaDeclCXX.cpp
> > ===================================================================
> > --- lib/Sema/SemaDeclCXX.cpp (revision 184670)
> > +++ lib/Sema/SemaDeclCXX.cpp (working copy)
> > @@ -1935,12 +1935,15 @@
> > if (MSPropertyAttr) {
> > Member = HandleMSProperty(S, cast<CXXRecordDecl>(CurContext), Loc, D,
> > BitWidth, InitStyle, AS, MSPropertyAttr);
> > + if (!Member) {
> > + return 0;
> > + }
>
> Remove curly braces (single-line if).
>
> > isInstField = false;
> > } else {
> > Member = HandleField(S, cast<CXXRecordDecl>(CurContext), Loc, D,
> > BitWidth, InitStyle, AS);
> > + assert(Member && "HandleField never returns null");
> > }
> > - assert(Member && "HandleField never returns null");
> > } else {
> > assert(InitStyle == ICIS_NoInit ||
> > D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static);
> >
> > Index: test/SemaCXX/MicrosoftExtensions.cpp
> > ===================================================================
> > --- test/SemaCXX/MicrosoftExtensions.cpp (revision 184665)
> > +++ test/SemaCXX/MicrosoftExtensions.cpp (working copy)
> > @@ -361,3 +361,7 @@
> > TakeRef(V);
> > TakeVal(V);
> > }
> > +
> > +struct StructWithUnnamedMember {
> > + __declspec(property(get=GetV)) int : 10; // expected-error {{anonymous
> > property is not supported}}
> > +};
>
> Aside from that, the patch LGTM
>
> ~Aaron
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp (revision 184974)
+++ lib/Sema/SemaDeclCXX.cpp (working copy)
@@ -1957,19 +1957,20 @@
if (MSPropertyAttr) {
Member = HandleMSProperty(S, cast<CXXRecordDecl>(CurContext), Loc, D,
BitWidth, InitStyle, AS, MSPropertyAttr);
+ if (!Member)
+ return 0;
isInstField = false;
} else {
Member = HandleField(S, cast<CXXRecordDecl>(CurContext), Loc, D,
BitWidth, InitStyle, AS);
+ assert(Member && "HandleField never returns null");
}
- assert(Member && "HandleField never returns null");
} else {
assert(InitStyle == ICIS_NoInit || D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static);
Member = HandleDeclarator(S, D, TemplateParameterLists);
- if (!Member) {
+ if (!Member)
return 0;
- }
// Non-instance-fields can't have a bitfield.
if (BitWidth) {
Index: test/SemaCXX/MicrosoftExtensions.cpp
===================================================================
--- test/SemaCXX/MicrosoftExtensions.cpp (revision 184974)
+++ test/SemaCXX/MicrosoftExtensions.cpp (working copy)
@@ -361,3 +361,7 @@
TakeRef(V);
TakeVal(V);
}
+
+struct StructWithUnnamedMember {
+ __declspec(property(get=GetV)) int : 10; // expected-error {{anonymous property is not supported}}
+};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits