File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed 
lib/StaticAnalyzer/Checkers/WebKit 
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -163,10 +163,11 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
163163    if  (OCE->getOperator () == OO_Star && OCE->getNumArgs () == 1 )
164164      E = OCE->getArg (0 );
165165  }
166-   auto  *ME = dyn_cast<MemberExpr>(E);
167-   if  (!ME)
168-     return  false ;
169-   auto  *D = ME->getMemberDecl ();
166+   const  ValueDecl *D = nullptr ;
167+   if  (auto  *ME = dyn_cast<MemberExpr>(E))
168+     D = ME->getMemberDecl ();
169+   else  if  (auto  *IVR = dyn_cast<ObjCIvarRefExpr>(E))
170+     D = IVR->getDecl ();
170171  if  (!D)
171172    return  false ;
172173  auto  T = D->getType ();
Original file line number Diff line number Diff line change 11//  RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2- //  expected-no-diagnostics
32
43#import  " mock-types.h" 
54#import  " mock-system-header.h" 
65#import  " ../../Inputs/system-header-simulator-for-objc-dealloc.h" 
76
8- @interface  Foo  : NSObject 
7+ @interface  Foo  : NSObject  {
8+   const  Ref<RefCountable> _obj1;
9+   const  RefPtr<RefCountable> _obj2;
10+   Ref<RefCountable> _obj3;
11+ }
912
1013@property  (nonatomic , readonly ) RefPtr<RefCountable> countable;
1114
@@ -17,6 +20,11 @@ @implementation Foo
1720
1821- (void )execute  {
1922  self._protectedRefCountable ->method ();
23+   _obj1->method ();
24+   _obj1.get ().method ();
25+   (*_obj2).method ();
26+   _obj3->method ();
27+   //  expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
2028}
2129
2230- (RefPtr<RefCountable>)_protectedRefCountable  {
@@ -30,6 +38,7 @@ - (void)execute {
3038  void  ref () const ;
3139  void  deref () const ;
3240  Ref<RefCountedObject> copy () const ;
41+   void  method ();
3342};
3443
3544@interface  WrapperObj  : NSObject 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments