r226382 - DebugInfo: Correct the debug location of non-static data member initializers

David Blaikie dblaikie at gmail.com
Mon Feb 2 13:07:48 PST 2015


Thanks!

On Mon, Feb 2, 2015 at 1:04 PM, Hans Wennborg <hans at chromium.org> wrote:

> I verified that the PR22257 reproducer fails on the branch before your
> patch and passes when I merge it, so this all seems good.
>
> Committed the merge in r227859.
>
> Thanks,
> Hans
>
> On Fri, Jan 30, 2015 at 9:26 PM, David Blaikie <dblaikie at gmail.com> wrote:
> > Hi Hans,
> >
> > I believe this is the missing piece to fix PR22257 for the 3.6 release.
> > Could you try pulling this onto the release branch? (the test case
> probably
> > won't apply cleanly, but hopefully the main patch does) & possibly verify
> > the PR22257 reproduction (I've verified it as best I can, but would be
> good
> > to have something more authoritative).
> >
> > - David
> >
> >
> > On Sat, Jan 17, 2015 at 4:12 PM, David Blaikie <dblaikie at gmail.com>
> wrote:
> >>
> >> Author: dblaikie
> >> Date: Sat Jan 17 18:12:58 2015
> >> New Revision: 226382
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=226382&view=rev
> >> Log:
> >> DebugInfo: Correct the debug location of non-static data member
> >> initializers
> >>
> >> This was causing some trouble for otherwise dead code removed in r225085
> >> (reverted in r225361). The location being set for function arguments was
> >> leaking out to the call which wasn't setting its own location (so a
> >> quality bug turned into a crasher with r225085). Fix this so r225085 can
> >> be recommitted.
> >>
> >> Modified:
> >>     cfe/trunk/lib/AST/DeclCXX.cpp
> >>     cfe/trunk/lib/CodeGen/CGClass.cpp
> >>     cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
> >>
> >> Modified: cfe/trunk/lib/AST/DeclCXX.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=226382&r1=226381&r2=226382&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/lib/AST/DeclCXX.cpp (original)
> >> +++ cfe/trunk/lib/AST/DeclCXX.cpp Sat Jan 17 18:12:58 2015
> >> @@ -1693,12 +1693,12 @@ const Type *CXXCtorInitializer::getBaseC
> >>  }
> >>
> >>  SourceLocation CXXCtorInitializer::getSourceLocation() const {
> >> -  if (isAnyMemberInitializer())
> >> -    return getMemberLocation();
> >> -
> >>    if (isInClassMemberInitializer())
> >>      return getAnyMember()->getLocation();
> >>
> >> +  if (isAnyMemberInitializer())
> >> +    return getMemberLocation();
> >> +
> >>    if (TypeSourceInfo *TSInfo = Initializee.get<TypeSourceInfo*>())
> >>      return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
> >>
> >>
> >> Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=226382&r1=226381&r2=226382&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
> >> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Jan 17 18:12:58 2015
> >> @@ -544,7 +544,7 @@ static void EmitMemberInitializer(CodeGe
> >>                                    CXXCtorInitializer *MemberInit,
> >>                                    const CXXConstructorDecl
> *Constructor,
> >>                                    FunctionArgList &Args) {
> >> -  ApplyDebugLocation Loc(CGF, MemberInit->getMemberLocation());
> >> +  ApplyDebugLocation Loc(CGF, MemberInit->getSourceLocation());
> >>    assert(MemberInit->isAnyMemberInitializer() &&
> >>           "Must have member initializer!");
> >>    assert(MemberInit->getInit() && "Must have initializer!");
> >> @@ -598,7 +598,6 @@ static void EmitMemberInitializer(CodeGe
> >>    ArrayRef<VarDecl *> ArrayIndexes;
> >>    if (MemberInit->getNumArrayIndices())
> >>      ArrayIndexes = MemberInit->getArrayIndexes();
> >> -  ApplyDebugLocation DL(CGF, MemberInit->getMemberLocation());
> >>    CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(),
> >> ArrayIndexes);
> >>  }
> >>
> >>
> >> Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=226382&r1=226381&r2=226382&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
> >> +++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Sat Jan 17 18:12:58
> 2015
> >> @@ -173,12 +173,12 @@ struct f14 {
> >>  // CHECK-LABEL: define
> >>  // CHECK-LABEL: define
> >>  // CHECK-LABEL: define
> >> +struct {
> >>  // CHECK: call {{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]]
> >> -// FIXME: The ctor call should be attributed to the line of the NSDMI,
> >> not the
> >> -// start of this declaration.
> >>  #line 1600
> >> -struct {
> >> -  f14 v = 1;
> >> +  f14 v
> >> +      =
> >> +      1;
> >>  } f14_inst;
> >>
> >>  // CHECK-LABEL: define
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> >
> >
> > _______________________________________________
> > 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/20150202/7d825d5e/attachment.html>


More information about the cfe-commits mailing list