|
|
@@ -27,6 +27,7 @@ |
|
|
|
#define CARLA_JOIN_MACRO_HELPER(a, b) a ## b |
|
|
|
#define CARLA_JOIN_MACRO(item1, item2) CARLA_JOIN_MACRO_HELPER(item1, item2) |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
/** This macro lets you embed a leak-detecting object inside a class. |
|
|
|
To use it, simply declare a CARLA_LEAK_DETECTOR(YourClassName) inside a private section |
|
|
|
of the class declaration. E.g. |
|
|
@@ -42,14 +43,20 @@ |
|
|
|
}; |
|
|
|
@endcode |
|
|
|
*/ |
|
|
|
#define CARLA_LEAK_DETECTOR(ClassName) \ |
|
|
|
# define CARLA_LEAK_DETECTOR(ClassName) \ |
|
|
|
friend class ::LeakedObjectDetector<ClassName>; \ |
|
|
|
static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \ |
|
|
|
::LeakedObjectDetector<ClassName> CARLA_JOIN_MACRO(leakDetector_, ClassName); |
|
|
|
|
|
|
|
#define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ |
|
|
|
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \ |
|
|
|
# define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ |
|
|
|
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \ |
|
|
|
CARLA_LEAK_DETECTOR(ClassName) |
|
|
|
#else |
|
|
|
/** Don't use leak detection on release builds. */ |
|
|
|
# define CARLA_LEAK_DETECTOR(ClassName) |
|
|
|
# define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ |
|
|
|
CARLA_DECLARE_NON_COPY_CLASS(ClassName) |
|
|
|
#endif |
|
|
|
|
|
|
|
//===================================================================================================================== |
|
|
|
/** |
|
|
|