[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    Re: r242857 - [Sema] Diagnose use of declaration correctly.
From:       Davide Italiano <davide () freebsd ! org>
Date:       2015-07-23 2:56:19
Message-ID: CACYV=-E8HJRqjS32UT2uASwUrVH1vLOH4ajfP3AftaM=RcpD_g () mail ! gmail ! com
[Download RAW message or body]

On Tue, Jul 21, 2015 at 5:37 PM, Richard Smith <richard@metafoo.co.uk> wrote:
> On Tue, Jul 21, 2015 at 5:30 PM, Davide Italiano <davide@freebsd.org> wrote:
> > 
> > Author: davide
> > Date: Tue Jul 21 19:30:58 2015
> > New Revision: 242857
> > 
> > URL: http://llvm.org/viewvc/llvm-project?rev=242857&view=rev
> > Log:
> > [Sema] Diagnose use of declaration correctly.
> > 
> > Before we skipped that for virtual functions not fully qualified (r81507).
> > This commit basically reverts this to the older behaviour, which seems
> > more consistent. We now also correctly consider ill-formed calls to
> > deleted
> > member functions, which were silently passed before in some cases.
> > The review contains the whole discussion.
> > 
> > PR:             20268
> > Differential Revision:   http://reviews.llvm.org/D11334
> > 
> > Added:
> > cfe/trunk/test/SemaCXX/deleted-function-access.cpp
> > Modified:
> > cfe/trunk/lib/Sema/SemaExprMember.cpp
> > cfe/trunk/test/SemaCXX/attr-deprecated.cpp
> > 
> > Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=242857&r1=242856&r2=242857&view=diff
> >  
> > ==============================================================================
> > --- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
> > +++ cfe/trunk/lib/Sema/SemaExprMember.cpp Tue Jul 21 19:30:58 2015
> > @@ -1042,16 +1042,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
> > BaseExpr = new (Context) CXXThisExpr(Loc,
> > BaseExprType,/*isImplicit=*/true);
> > }
> > 
> > -  bool ShouldCheckUse = true;
> > -  if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MemberDecl)) {
> > -    // Don't diagnose the use of a virtual member function unless it's
> > -    // explicitly qualified.
> > -    if (MD->isVirtual() && !SS.isSet())
> > -      ShouldCheckUse = false;
> > -  }
> > -
> > // Check the use of this member.
> > -  if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc))
> > +  if (DiagnoseUseOfDecl(MemberDecl, MemberLoc))
> > return ExprError();
> > 
> > if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl))
> > 
> > Modified: cfe/trunk/test/SemaCXX/attr-deprecated.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-deprecated.cpp?rev=242857&r1=242856&r2=242857&view=diff
> >  
> > ==============================================================================
> > --- cfe/trunk/test/SemaCXX/attr-deprecated.cpp (original)
> > +++ cfe/trunk/test/SemaCXX/attr-deprecated.cpp Tue Jul 21 19:30:58 2015
> > @@ -26,12 +26,12 @@ void A::h(A* a)
> > }
> > 
> > struct B {
> > -  virtual void f() __attribute__((deprecated)); // expected-note 4 {{'f'
> > has been explicitly marked deprecated here}}
> > +  virtual void f() __attribute__((deprecated)); // expected-note 6 {{'f'
> > has been explicitly marked deprecated here}}
> > void g();
> > };
> > 
> > void B::g() {
> > -  f();
> > +  f(); // expected-warning{{'f' is deprecated}}
> > B::f(); // expected-warning{{'f' is deprecated}}
> > }
> > 
> > @@ -47,7 +47,7 @@ void C::g() {
> > }
> > 
> > void f(B* b, C *c) {
> > -  b->f();
> > +  b->f(); // expected-warning{{'f' is deprecated}}
> > b->B::f(); // expected-warning{{'f' is deprecated}}
> > 
> > c->f();
> > @@ -59,10 +59,10 @@ struct D {
> > virtual void f() __attribute__((deprecated));
> > };
> > 
> > -void D::f() { }
> > +void D::f() { } // expected-note{{'f' has been explicitly marked
> > deprecated here}}
> > 
> > void f(D* d) {
> > -  d->f();
> > +  d->f(); // expected-warning{{'f' is deprecated}}
> > }
> 
> 
> Can you also add some tests here for the case where the deprecated virtual
> function is overloaded?
> 

Done in r242980.

--
Davide
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic