[PATCH] PR16395 Crash using Microsoft property declaration without a name
Robert Wilhelm
robert.wilhelm at gmx.net
Wed Jun 26 14:11:01 PDT 2013
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 <robert.wilhelm at gmx.net> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PR16395.patch
Type: text/x-patch
Size: 1467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130626/9a1ab58e/attachment.bin>
More information about the cfe-commits
mailing list