[PATCH] D11517: [Sema] Add a note to point to the inaccessible destructor.

Davide Italiano dccitaliano at gmail.com
Sun Jul 26 15:03:02 PDT 2015


Thanks for the review. Are you OK with un-statitcize
DiagnoseAccessPath so that SemaDeclCXX can call it -- or do you prefer
to introduce a wrapper?

On Sun, Jul 26, 2015 at 5:01 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> rsmith added inline comments.
>
> ================
> Comment at: lib/Sema/SemaDeclCXX.cpp:5575-5581
> @@ +5574,9 @@
> +      // Explain the reasons of inaccessibility.
> +      if (Field) {
> +        if (CXXRecordDecl *C = Field->getType()->getAsCXXRecordDecl()) {
> +          CXXDestructorDecl *D = S.LookupDestructor(C);
> +          if (D && !D->isImplicit())
> +            S.Diag(D->getLocStart(), diag::note_destructor_here);
> +        }
> +      }
> +    }
> ----------------
> This doesn't seem right: you're producing a note for a destructor no matter which special member function was found to be inaccessible. The best thing to do would be to ask the SemaAccess code to produce the relevant note (see DiagnoseAccessPath); that way you can produce a note that says "declared private here" or whatever else is relevant (which can sometimes be that a virtual base destructor is inaccessible due to a private access path, for instance).
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11517
>
>
>




More information about the cfe-commits mailing list