Fix for The Add Override transform crashes if Google Test is #included

Vane, Edwin edwin.vane at intel.com
Mon May 6 08:19:13 PDT 2013


This fix was actually not correct. A better fix is coming from Guillaume shortly.

> -----Original Message-----
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
> bounces at cs.uiuc.edu] On Behalf Of Rafael EspĂ­ndola
> Sent: Monday, May 06, 2013 11:14 AM
> To: Bernal, Ariel J
> Cc: cfe-commits at cs.uiuc.edu
> Subject: Re: Fix for The Add Override transform crashes if Google Test is
> #included
> 
> Can you include a test?
> 
> On 29 April 2013 14:53, Bernal, Ariel J <ariel.j.bernal at intel.com> wrote:
> > This patch fixes PR15827, add override options was not checking if the
> > method declaration was in the main file.
> >
> >
> >
> >
> >
> >
> >
> > diff --git a/cpp11-migrate/AddOverride/AddOverrideActions.cpp
> > b/cpp11-migrate/AddOverride/AddOverrideActions.cpp
> >
> > index a40f673..3d1f1ff 100644
> >
> > --- a/cpp11-migrate/AddOverride/AddOverrideActions.cpp
> >
> > +++ b/cpp11-migrate/AddOverride/AddOverrideActions.cpp
> >
> > @@ -30,10 +30,14 @@ void AddOverrideFixer::run(const
> > MatchFinder::MatchResult &Result) {
> >
> >    SourceManager &SM = *Result.SourceManager;
> >
> >    const CXXMethodDecl *M =
> > Result.Nodes.getDeclAs<CXXMethodDecl>(MethodId);
> >
> >    assert(M && "Bad Callback. No node provided");
> >
> > +  // Check that the method declaration in the main file
> >
> > +  if (!SM.isFromMainFile(M->getLocStart()))
> >
> > +    return;
> >
> > +
> >
> >    // First check that there isn't already an override attribute.
> >
> >    if (!M->hasAttr<OverrideAttr>()) {
> >
> >      if (M->getLocStart().isFileID()) {
> >
> >        SourceLocation StartLoc;
> >
> >        if (M->hasInlineBody()) {
> >
> >
> > _______________________________________________
> > 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




More information about the cfe-commits mailing list