r183095 - Do not walk through member-accesses on bitfields when looking for the object

Richard Smith richard at metafoo.co.uk
Mon Jun 3 10:01:24 PDT 2013


On Mon, Jun 3, 2013 at 9:41 AM, David Blaikie <dblaikie at gmail.com> wrote:

> On Mon, Jun 3, 2013 at 12:13 AM, Richard Smith
> <richard-llvm at metafoo.co.uk> wrote:
> > Author: rsmith
> > Date: Mon Jun  3 02:13:35 2013
> > New Revision: 183095
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=183095&view=rev
> > Log:
> > Do not walk through member-accesses on bitfields when looking for the
> object
> > which is lifetime-extended by a reference binding. An additional
> temporary is
> > created for such a bitfield access (although we have no explicit AST
> > representation for it).
> >
> > Modified:
> >     cfe/trunk/lib/AST/Expr.cpp
> >     cfe/trunk/test/CodeGenCXX/temporaries.cpp
> >
> > Modified: cfe/trunk/lib/AST/Expr.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=183095&r1=183094&r2=183095&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/AST/Expr.cpp (original)
> > +++ cfe/trunk/lib/AST/Expr.cpp Mon Jun  3 02:13:35 2013
> > @@ -76,9 +76,11 @@ const Expr *Expr::skipRValueSubobjectAdj
> >        if (!ME->isArrow() && ME->getBase()->isRValue()) {
> >          assert(ME->getBase()->getType()->isRecordType());
> >          if (FieldDecl *Field =
> dyn_cast<FieldDecl>(ME->getMemberDecl())) {
> > -          E = ME->getBase();
> > -          Adjustments.push_back(SubobjectAdjustment(Field));
> > -          continue;
> > +          if (!Field->isBitField()) {
> > +            E = ME->getBase();
> > +            Adjustments.push_back(SubobjectAdjustment(Field));
> > +            continue;
> > +          }
> >          }
> >        }
> >      } else if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
> >
> > Modified: cfe/trunk/test/CodeGenCXX/temporaries.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/temporaries.cpp?rev=183095&r1=183094&r2=183095&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGenCXX/temporaries.cpp (original)
> > +++ cfe/trunk/test/CodeGenCXX/temporaries.cpp Mon Jun  3 02:13:35 2013
> > @@ -604,3 +604,15 @@ namespace BindToSubobject {
> >    // CHECK: store i32* {{.*}}, i32** @_ZN15BindToSubobject1dE, align 8
> >    int &&d = (B().a).*h();
> >  }
> > +
> > +namespace Bitfield {
> > +  struct S { int a : 5; ~S(); };
> > +
> > +  // Do not lifetime extend the S() temporary here.
> > +Â  // CHECK: alloca
>
> Did some kind of interesting unicode sneak in here?


Apparently so, thanks! Fixed in r183116.


> > +Â  // CHECK: call {{.*}}memset
> > +Â  // CHECK: store i32 {{.*}}, i32* @_ZGRN8Bitfield1rE, align 4
> > +  // CHECK: call void @_ZN8Bitfield1SD1
> > +Â  // CHECK: store i32* @_ZGRN8Bitfield1rE, i32** @_ZN8Bitfield1rE,
> align 8
> > +  int &&r = S().a;
> > +}
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130603/1a2fca8b/attachment.html>


More information about the cfe-commits mailing list