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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon May 6 08:13:50 PDT 2013


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
>



More information about the cfe-commits mailing list