[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / os_object_base.h
blob03e0f5cc580f16afa6cc0beb0dd4c2696fb6bdf0
1 #ifndef _OS_BASE_H
2 #define _OS_BASE_H
4 #define OS_CONSUME __attribute__((os_consumed))
5 #define OS_RETURNS_RETAINED __attribute__((os_returns_retained))
6 #define OS_RETURNS_RETAINED_ON_ZERO __attribute__((os_returns_retained_on_zero))
7 #define OS_RETURNS_RETAINED_ON_NONZERO __attribute__((os_returns_retained_on_non_zero))
8 #define OS_RETURNS_NOT_RETAINED __attribute__((os_returns_not_retained))
9 #define OS_CONSUMES_THIS __attribute__((os_consumes_this))
11 #define OSTypeID(type) (type::metaClass)
13 #define OSDynamicCast(type, inst) \
14 ((type *) OSMetaClassBase::safeMetaCast((inst), OSTypeID(type)))
15 #define OSRequiredCast(type, inst) \
16 ((type *) OSMetaClassBase::requiredMetaCast((inst), OSTypeID(type)))
18 #define OSTypeAlloc(type) ((type *) ((type::metaClass)->alloc()))
20 using size_t = decltype(sizeof(int));
22 typedef int kern_return_t;
23 struct IORPC {};
25 struct OSMetaClass;
27 struct OSMetaClassBase {
28 static OSMetaClassBase *safeMetaCast(const OSMetaClassBase *inst,
29 const OSMetaClass *meta);
30 static OSMetaClassBase *requiredMetaCast(const OSMetaClassBase *inst,
31 const OSMetaClass *meta);
33 OSMetaClassBase *metaCast(const char *toMeta);
35 virtual void retain() const;
36 virtual void release() const;
38 virtual void taggedRetain(const void * tag = nullptr) const;
39 virtual void taggedRelease(const void * tag = nullptr) const;
41 virtual void free();
42 virtual ~OSMetaClassBase(){};
44 kern_return_t Invoke(IORPC invoke);
47 typedef kern_return_t (*OSDispatchMethod)(OSMetaClassBase *self,
48 const IORPC rpc);
50 struct OSObject : public OSMetaClassBase {
51 virtual ~OSObject(){}
53 unsigned int foo() { return 42; }
55 virtual OS_RETURNS_NOT_RETAINED OSObject *identity();
57 static OSObject *generateObject(int);
59 static OSObject *getObject();
60 static OSObject *GetObject();
62 static void * operator new(size_t size);
64 static const OSMetaClass * const metaClass;
67 struct OSMetaClass : public OSMetaClassBase {
68 virtual OSObject * alloc() const;
69 static OSObject * allocClassWithName(const char * name);
70 static const OSMetaClass *copyMetaClassWithName(const char *name);
71 void releaseMetaClass() const;
72 virtual ~OSMetaClass(){}
75 #endif /* _OS_BASE_H */