Skip to content

Commit 6ab37e4

Browse files
committed
Add a test case where webkit.pointerconversion annotation is added on a class member function.
1 parent b29b369 commit 6ab37e4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

clang/test/Analysis/Checkers/WebKit/call-args-safe-functions.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
22

3+
#include "mock-types.h"
4+
35
class Base {
46
public:
5-
inline void ref();
6-
inline void deref();
7+
void ref();
8+
void deref();
9+
void doWork();
710
};
811

912
class Derived : public Base {
@@ -20,6 +23,7 @@ class SubDerived final : public Derived {
2023
class OtherObject {
2124
public:
2225
Derived* obj();
26+
Base* base();
2327
};
2428

2529
class String {
@@ -62,3 +66,12 @@ void foo(OtherObject* other)
6266
// expected-warning@-1{{Call argument is uncounted and unsafe}}
6367
toString(other->obj());
6468
}
69+
70+
struct SomeStruct {
71+
Derived* [[clang::annotate_type("webkit.pointerconversion")]] ptrConversion(Base*);
72+
73+
void foo(OtherObject& otherObj) {
74+
RefPtr ptr = otherObj.base();
75+
ptrConversion(ptr.get())->doWork();
76+
}
77+
};

0 commit comments

Comments
 (0)