mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-18 05:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
107
build/clang-plugin/tests/TestKungFuDeathGrip.cpp
Normal file
107
build/clang-plugin/tests/TestKungFuDeathGrip.cpp
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
|
||||
|
||||
template <typename T>
|
||||
class already_AddRefed {
|
||||
public:
|
||||
already_AddRefed();
|
||||
T* mPtr;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class RefPtr {
|
||||
public:
|
||||
RefPtr();
|
||||
MOZ_IMPLICIT RefPtr(T* aIn);
|
||||
MOZ_IMPLICIT RefPtr(already_AddRefed<T> aIn);
|
||||
~RefPtr();
|
||||
T* mPtr;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class nsCOMPtr {
|
||||
public:
|
||||
nsCOMPtr();
|
||||
MOZ_IMPLICIT nsCOMPtr(T* aIn);
|
||||
MOZ_IMPLICIT nsCOMPtr(already_AddRefed<T> aIn);
|
||||
~nsCOMPtr();
|
||||
T* mPtr;
|
||||
};
|
||||
|
||||
class Type {
|
||||
public:
|
||||
static nsCOMPtr<Type> someStaticCOMPtr;
|
||||
|
||||
void f(nsCOMPtr<Type> ignoredArgument, Type *param) {
|
||||
nsCOMPtr<Type> never_referenced;
|
||||
nsCOMPtr<Type> kfdg_t1(this);
|
||||
nsCOMPtr<Type> kfdg_t2 = this;
|
||||
|
||||
nsCOMPtr<Type> kfdg_m1(p); // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m1', or explicitly pass 'kfdg_m1' to `mozilla::Unused`}}
|
||||
nsCOMPtr<Type> kfdg_m2 = p; // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m2', or explicitly pass 'kfdg_m2' to `mozilla::Unused`}}
|
||||
nsCOMPtr<Type> kfdg_m3(p);
|
||||
kfdg_m3.mPtr->f(nullptr, nullptr);
|
||||
nsCOMPtr<Type> kfdg_m4 = p;
|
||||
kfdg_m4.mPtr->f(nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<Type> kfdg_a1((already_AddRefed<Type>()));
|
||||
nsCOMPtr<Type> kfdg_a2 = already_AddRefed<Type>();
|
||||
|
||||
nsCOMPtr<Type> kfdg_p1(param);
|
||||
nsCOMPtr<Type> kfdg_p2 = param;
|
||||
|
||||
|
||||
RefPtr<Type> never_referenced2;
|
||||
RefPtr<Type> kfdg_t3(this);
|
||||
RefPtr<Type> kfdg_t4 = this;
|
||||
|
||||
RefPtr<Type> kfdg_m5(p); // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m5', or explicitly pass 'kfdg_m5' to `mozilla::Unused`}}
|
||||
RefPtr<Type> kfdg_m6 = p; // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m6', or explicitly pass 'kfdg_m6' to `mozilla::Unused`}}
|
||||
RefPtr<Type> kfdg_m7(p);
|
||||
kfdg_m7.mPtr->f(nullptr, nullptr);
|
||||
RefPtr<Type> kfdg_m8 = p;
|
||||
kfdg_m8.mPtr->f(nullptr, nullptr);
|
||||
|
||||
RefPtr<Type> kfdg_a3((already_AddRefed<Type>()));
|
||||
RefPtr<Type> kfdg_a4 = already_AddRefed<Type>();
|
||||
|
||||
RefPtr<Type> kfdg_p3(param);
|
||||
RefPtr<Type> kfdg_p4 = param;
|
||||
}
|
||||
|
||||
Type *p;
|
||||
};
|
||||
|
||||
void f(nsCOMPtr<Type> ignoredArgument, Type *param) {
|
||||
nsCOMPtr<Type> never_referenced;
|
||||
Type t;
|
||||
// Type *p = nullptr;
|
||||
nsCOMPtr<Type> kfdg_m1(t.p); // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m1', or explicitly pass 'kfdg_m1' to `mozilla::Unused`}}
|
||||
nsCOMPtr<Type> kfdg_m2 = t.p; // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m2', or explicitly pass 'kfdg_m2' to `mozilla::Unused`}}
|
||||
nsCOMPtr<Type> kfdg_m3(t.p);
|
||||
kfdg_m3.mPtr->f(nullptr, nullptr);
|
||||
nsCOMPtr<Type> kfdg_m4 = t.p;
|
||||
kfdg_m4.mPtr->f(nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<Type> kfdg_a1((already_AddRefed<Type>()));
|
||||
nsCOMPtr<Type> kfdg_a2 = already_AddRefed<Type>();
|
||||
|
||||
nsCOMPtr<Type> kfdg_p1(param);
|
||||
nsCOMPtr<Type> kfdg_p2 = param;
|
||||
|
||||
|
||||
RefPtr<Type> never_referenced2;
|
||||
RefPtr<Type> kfdg_m5(t.p); // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m5', or explicitly pass 'kfdg_m5' to `mozilla::Unused`}}
|
||||
RefPtr<Type> kfdg_m6 = t.p; // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m6', or explicitly pass 'kfdg_m6' to `mozilla::Unused`}}
|
||||
RefPtr<Type> kfdg_m7(t.p);
|
||||
kfdg_m7.mPtr->f(nullptr, nullptr);
|
||||
RefPtr<Type> kfdg_m8 = t.p;
|
||||
kfdg_m8.mPtr->f(nullptr, nullptr);
|
||||
|
||||
RefPtr<Type> kfdg_a3((already_AddRefed<Type>()));
|
||||
RefPtr<Type> kfdg_a4 = already_AddRefed<Type>();
|
||||
|
||||
RefPtr<Type> kfdg_p3(param);
|
||||
RefPtr<Type> kfdg_p4 = param;
|
||||
}
|
||||
|
||||
nsCOMPtr<Type> Type::someStaticCOMPtr(nullptr);
|
||||
Loading…
Add table
Add a link
Reference in a new issue