FW: SemaAccess bug (protected members of derived)

Alex L via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 11:15:52 PDT 2017


Thanks,

It looks like your solution isn't quite right as it causes Clang to accept
invalid access to protected members, e.g. as tested by
"test/CXX/class.access/class.protected/p1.cpp".

Do you think there's an alternative solution that you could use?

Alex

On 21 March 2017 at 14:48, Dixon Ryan (ETAS/ERS-PD2) <Ryan.Dixon at etas.com>
wrote:

> From path:
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk
>
> Relative URL: ^/cfe/trunk
>
>
>
> *From:* Alex L [mailto:arphaman at gmail.com]
> *Sent:* 21 March 2017 14:22
> *To:* Dixon Ryan (ETAS/ERS-PD2) <Ryan.Dixon at etas.com>
> *Cc:* cfe-commits at lists.llvm.org
> *Subject:* Re: FW: SemaAccess bug (protected members of derived)
>
>
>
> Thanks, can you please attach a diff that includes both the code change
> and the new test?
>
>
>
> On 21 March 2017 at 14:18, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
> Sending to mailing list.
>
>
>
> *From:* Dixon Ryan (ETAS/ERS-PD2)
> *Sent:* 21 March 2017 14:18
> *To:* 'Alex L' <arphaman at gmail.com>
> *Subject:* RE: SemaAccess bug (protected members of derived)
>
>
>
> Hello, sorry this is the first time I have done this.
>
>
>
> The test case is attached. It should fail without the patch and then
> should pass with the patch.
>
>
>
>
>
> class cl
>
> {
>
> public:
>
>    void myPublic(int x){ }
>
> protected:
>
>    void myProtected(int y){ }
>
> };
>
>
>
> class clChild : public cl
>
> {
>
>    void myPrivate(int z)
>
>    {
>
>       this->
>
>          // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s
> -o - | FileCheck -check-prefix=CHECK-CC1 %s
>
>          // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int
> y#>)
>
>    }
>
> };
>
>
>
>
>
> *From:* Alex L [mailto:arphaman at gmail.com <arphaman at gmail.com>]
> *Sent:* 21 March 2017 12:17
> *To:* Dixon Ryan (ETAS/ERS-PD2) <Ryan.Dixon at etas.com>
> *Cc:* cfe-commits at lists.llvm.org
> *Subject:* Re: SemaAccess bug (protected members of derived)
>
>
>
> Hi,
>
>
>
> Can you please add a suitable test-case? Clang's code-completion tests are
> normally in test/CodeCompletion or test/Index.
>
>
>
> Cheers,
>
> Alex
>
>
>
> On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
> There are a number of users of the clang static analyser back-end for
> intelligent code completion. Irony-Mode for emacs, for example. For a while
> people have been reporting an issue with not getting completions for
> protected members of parent classes and I believe this patch solves the
> bug: simply that the arguments to IsDerivedFromInclusive were the wrong way
> around.
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
>
> Relative URL: ^/cfe/trunk/lib/Sema
>
>
>
> Index: SemaAccess.cpp
>
> ===================================================================
>
> --- SemaAccess.cpp      (revision 297956)
>
> +++ SemaAccess.cpp   (working copy)
>
> @@ -823,7 +823,7 @@
>
>          continue;
>
>        }
>
> -      switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
>
> +      switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
>
>        case AR_accessible: return AR_accessible;
>
>        case AR_inaccessible: continue;
>
>        case AR_dependent: OnFailure = AR_dependent; continue;
>
>
>
> Thank you.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170321/7c47a6f4/attachment.html>


More information about the cfe-commits mailing list