summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Steckelmacher <steckdenis@yahoo.fr>2011-08-07 16:38:03 +0200
committerDenis Steckelmacher <steckdenis@yahoo.fr>2011-08-07 16:38:03 +0200
commit1fe65785d632c909a5ee269a9ee33537b760c75d (patch)
tree2ffa15fc4775d89445520fce93c99c8694c9bff3
parent513d6238f12fdf208edc75465dca72ac056c4899 (diff)
Use Object::isA to check arguments passed to API functions.
-rw-r--r--src/api/api_command.cpp14
-rw-r--r--src/api/api_context.cpp6
-rw-r--r--src/api/api_device.cpp3
-rw-r--r--src/api/api_enqueue.cpp40
-rw-r--r--src/api/api_event.cpp24
-rw-r--r--src/api/api_kernel.cpp14
-rw-r--r--src/api/api_memory.cpp23
-rw-r--r--src/api/api_profiling.cpp2
-rw-r--r--src/api/api_program.cpp14
-rw-r--r--src/core/deviceinterface.h5
-rw-r--r--src/core/object.cpp4
-rw-r--r--src/core/object.h1
12 files changed, 76 insertions, 74 deletions
diff --git a/src/api/api_command.cpp b/src/api/api_command.cpp
index 7990662..4d1bf20 100644
--- a/src/api/api_command.cpp
+++ b/src/api/api_command.cpp
@@ -1,4 +1,6 @@
#include <core/commandqueue.h>
+#include <core/deviceinterface.h>
+#include <core/context.h>
#include <CL/cl.h>
@@ -15,13 +17,13 @@ clCreateCommandQueue(cl_context context,
if (!errcode_ret)
errcode_ret = &default_errcode_ret;
- if (!device)
+ if (!device->isA(Coal::Object::T_Device))
{
*errcode_ret = CL_INVALID_DEVICE;
return 0;
}
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -47,7 +49,7 @@ clCreateCommandQueue(cl_context context,
cl_int
clRetainCommandQueue(cl_command_queue command_queue)
{
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
command_queue->reference();
@@ -58,7 +60,7 @@ clRetainCommandQueue(cl_command_queue command_queue)
cl_int
clReleaseCommandQueue(cl_command_queue command_queue)
{
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
// TODO: Flush command queue
@@ -76,7 +78,7 @@ clGetCommandQueueInfo(cl_command_queue command_queue,
void * param_value,
size_t * param_value_size_ret)
{
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
return command_queue->info(param_name, param_value_size, param_value,
@@ -89,7 +91,7 @@ clSetCommandQueueProperty(cl_command_queue command_queue,
cl_bool enable,
cl_command_queue_properties * old_properties)
{
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
return command_queue->setProperty(properties, enable, old_properties);
diff --git a/src/api/api_context.cpp b/src/api/api_context.cpp
index 4396116..df427ec 100644
--- a/src/api/api_context.cpp
+++ b/src/api/api_context.cpp
@@ -60,7 +60,7 @@ clCreateContextFromType(const cl_context_properties *properties,
cl_int
clRetainContext(cl_context context)
{
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
return CL_INVALID_CONTEXT;
context->reference();
@@ -71,7 +71,7 @@ clRetainContext(cl_context context)
cl_int
clReleaseContext(cl_context context)
{
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
return CL_INVALID_CONTEXT;
if (context->dereference())
@@ -87,7 +87,7 @@ clGetContextInfo(cl_context context,
void * param_value,
size_t * param_value_size_ret)
{
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
return CL_INVALID_CONTEXT;
return context->info(param_name, param_value_size, param_value,
diff --git a/src/api/api_device.cpp b/src/api/api_device.cpp
index 1aa3a4b..f3b6ff9 100644
--- a/src/api/api_device.cpp
+++ b/src/api/api_device.cpp
@@ -44,8 +44,7 @@ clGetDeviceInfo(cl_device_id device,
void * param_value,
size_t * param_value_size_ret)
{
- if (device == 0)
- // NOTE: Check that device is really a pointer to a DeviceInterface ?
+ if (!device->isA(Coal::Object::T_Device))
return CL_INVALID_DEVICE;
Coal::DeviceInterface *iface = (Coal::DeviceInterface *)device;
diff --git a/src/api/api_enqueue.cpp b/src/api/api_enqueue.cpp
index 578f8ab..64574ce 100644
--- a/src/api/api_enqueue.cpp
+++ b/src/api/api_enqueue.cpp
@@ -54,7 +54,7 @@ clEnqueueReadBuffer(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::ReadBufferEvent *command = new Coal::ReadBufferEvent(
@@ -86,7 +86,7 @@ clEnqueueWriteBuffer(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::WriteBufferEvent *command = new Coal::WriteBufferEvent(
@@ -123,7 +123,7 @@ clEnqueueReadBufferRect(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::ReadBufferRectEvent *command = new Coal::ReadBufferRectEvent(
@@ -161,7 +161,7 @@ clEnqueueWriteBufferRect(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::WriteBufferRectEvent *command = new Coal::WriteBufferRectEvent(
@@ -198,7 +198,7 @@ clEnqueueCopyBufferRect(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::CopyBufferRectEvent *command = new Coal::CopyBufferRectEvent(
@@ -232,7 +232,7 @@ clEnqueueCopyBuffer(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::CopyBufferEvent *command = new Coal::CopyBufferEvent(
@@ -267,7 +267,7 @@ clEnqueueReadImage(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
if (!image || (image->type() != Coal::MemObject::Image2D &&
@@ -305,7 +305,7 @@ clEnqueueWriteImage(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::WriteImageEvent *command = new Coal::WriteImageEvent(
@@ -337,7 +337,7 @@ clEnqueueCopyImage(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::CopyImageEvent *command = new Coal::CopyImageEvent(
@@ -369,7 +369,7 @@ clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::CopyImageToBufferEvent *command = new Coal::CopyImageToBufferEvent(
@@ -401,7 +401,7 @@ clEnqueueCopyBufferToImage(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::CopyBufferToImageEvent *command = new Coal::CopyBufferToImageEvent(
@@ -439,7 +439,7 @@ clEnqueueMapBuffer(cl_command_queue command_queue,
*errcode_ret = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
{
*errcode_ret = CL_INVALID_COMMAND_QUEUE;
return 0;
@@ -487,7 +487,7 @@ clEnqueueMapImage(cl_command_queue command_queue,
*errcode_ret = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
{
*errcode_ret = CL_INVALID_COMMAND_QUEUE;
return 0;
@@ -541,7 +541,7 @@ clEnqueueUnmapMemObject(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
{
return CL_INVALID_COMMAND_QUEUE;
}
@@ -575,7 +575,7 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
{
return CL_INVALID_COMMAND_QUEUE;
}
@@ -605,7 +605,7 @@ clEnqueueTask(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
{
return CL_INVALID_COMMAND_QUEUE;
}
@@ -639,7 +639,7 @@ clEnqueueNativeKernel(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::NativeKernelEvent *command = new Coal::NativeKernelEvent(
@@ -664,7 +664,7 @@ clEnqueueMarker(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
// Get the events in command_queue
@@ -699,7 +699,7 @@ clEnqueueWaitForEvents(cl_command_queue command_queue,
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::WaitForEventsEvent *command = new Coal::WaitForEventsEvent(
@@ -720,7 +720,7 @@ clEnqueueBarrier(cl_command_queue command_queue)
{
cl_int rs = CL_SUCCESS;
- if (!command_queue)
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
return CL_INVALID_COMMAND_QUEUE;
Coal::BarrierEvent *command = new Coal::BarrierEvent(
diff --git a/src/api/api_event.cpp b/src/api/api_event.cpp
index e3e44b3..029506c 100644
--- a/src/api/api_event.cpp
+++ b/src/api/api_event.cpp
@@ -2,6 +2,7 @@
#include <core/commandqueue.h>
#include <core/events.h>
+#include <core/context.h>
// Event Object APIs
cl_int
@@ -16,19 +17,13 @@ clWaitForEvents(cl_uint num_events,
for (int i=0; i<num_events; ++i)
{
- if (!event_list[i])
+ if (!event_list[i]->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
if (event_list[i]->status() < 0)
return CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
- cl_context evt_ctx = 0;
- cl_int rs;
-
- rs = event_list[i]->info(CL_EVENT_CONTEXT, sizeof(cl_context), &evt_ctx,
- 0);
-
- if (rs != CL_SUCCESS) return rs;
+ cl_context evt_ctx = (cl_context)event_list[i]->parent()->parent();
if (global_ctx == 0)
global_ctx = evt_ctx;
@@ -52,7 +47,7 @@ clGetEventInfo(cl_event event,
void * param_value,
size_t * param_value_size_ret)
{
- if (!event)
+ if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
return event->info(param_name, param_value_size, param_value,
@@ -67,7 +62,7 @@ clSetEventCallback(cl_event event,
void *user_data),
void *user_data)
{
- if (!event)
+ if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
if (!pfn_event_notify || command_exec_callback_type != CL_COMPLETE)
@@ -81,7 +76,7 @@ clSetEventCallback(cl_event event,
cl_int
clRetainEvent(cl_event event)
{
- if (!event)
+ if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
event->reference();
@@ -92,7 +87,7 @@ clRetainEvent(cl_event event)
cl_int
clReleaseEvent(cl_event event)
{
- if (!event)
+ if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
if (event->dereference())
@@ -110,7 +105,7 @@ clCreateUserEvent(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -137,7 +132,8 @@ clSetUserEventStatus(cl_event event,
{
Coal::Event *command = (Coal::Event *)event;
- if (!command || command->type() != Coal::Event::User)
+ if (!command->isA(Coal::Object::T_Event) ||
+ command->type() != Coal::Event::User)
return CL_INVALID_EVENT;
if (execution_status != CL_COMPLETE)
diff --git a/src/api/api_kernel.cpp b/src/api/api_kernel.cpp
index 9aaf2b0..41332df 100644
--- a/src/api/api_kernel.cpp
+++ b/src/api/api_kernel.cpp
@@ -20,7 +20,7 @@ clCreateKernel(cl_program program,
return 0;
}
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
{
*errcode_ret = CL_INVALID_PROGRAM;
return 0;
@@ -51,7 +51,7 @@ clCreateKernelsInProgram(cl_program program,
{
cl_int rs = CL_SUCCESS;
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
if (program->state() != Coal::Program::Built)
@@ -109,7 +109,7 @@ clCreateKernelsInProgram(cl_program program,
cl_int
clRetainKernel(cl_kernel kernel)
{
- if (!kernel)
+ if (!kernel->isA(Coal::Object::T_Kernel))
return CL_INVALID_KERNEL;
kernel->reference();
@@ -120,7 +120,7 @@ clRetainKernel(cl_kernel kernel)
cl_int
clReleaseKernel(cl_kernel kernel)
{
- if (!kernel)
+ if (!kernel->isA(Coal::Object::T_Kernel))
return CL_INVALID_KERNEL;
if (kernel->dereference())
@@ -135,7 +135,7 @@ clSetKernelArg(cl_kernel kernel,
size_t arg_size,
const void * arg_value)
{
- if (!kernel)
+ if (!kernel->isA(Coal::Object::T_Kernel))
return CL_INVALID_KERNEL;
return kernel->setArg(arg_indx, arg_size, arg_value);
@@ -148,7 +148,7 @@ clGetKernelInfo(cl_kernel kernel,
void * param_value,
size_t * param_value_size_ret)
{
- if (!kernel)
+ if (!kernel->isA(Coal::Object::T_Kernel))
return CL_INVALID_KERNEL;
return kernel->info(param_name, param_value_size, param_value,
@@ -163,7 +163,7 @@ clGetKernelWorkGroupInfo(cl_kernel kernel,
void * param_value,
size_t * param_value_size_ret)
{
- if (!kernel)
+ if (!kernel->isA(Coal::Object::T_Kernel))
return CL_INVALID_KERNEL;
return kernel->workGroupInfo((Coal::DeviceInterface *)device, param_name,
diff --git a/src/api/api_memory.cpp b/src/api/api_memory.cpp
index 9c0134e..05f511f 100644
--- a/src/api/api_memory.cpp
+++ b/src/api/api_memory.cpp
@@ -17,7 +17,7 @@ clCreateBuffer(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -49,7 +49,7 @@ clCreateSubBuffer(cl_mem buffer,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!buffer)
+ if (!buffer->isA(Coal::Object::T_MemObject))
{
*errcode_ret = CL_INVALID_MEM_OBJECT;
return 0;
@@ -107,7 +107,7 @@ clCreateImage2D(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -145,7 +145,7 @@ clCreateImage3D(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -170,7 +170,7 @@ clCreateImage3D(cl_context context,
cl_int
clRetainMemObject(cl_mem memobj)
{
- if (!memobj)
+ if (!memobj->isA(Coal::Object::T_MemObject))
return CL_INVALID_MEM_OBJECT;
memobj->reference();
@@ -181,7 +181,7 @@ clRetainMemObject(cl_mem memobj)
cl_int
clReleaseMemObject(cl_mem memobj)
{
- if (!memobj)
+ if (!memobj->isA(Coal::Object::T_MemObject))
return CL_INVALID_MEM_OBJECT;
if (memobj->dereference())
@@ -316,7 +316,7 @@ clGetSupportedImageFormats(cl_context context,
cl_image_format * image_formats,
cl_uint * num_image_formats)
{
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
return CL_INVALID_CONTEXT;
(void) flags;
@@ -345,7 +345,7 @@ clGetMemObjectInfo(cl_mem memobj,
void * param_value,
size_t * param_value_size_ret)
{
- if (!memobj)
+ if (!memobj->isA(Coal::Object::T_MemObject))
return CL_INVALID_MEM_OBJECT;
return memobj->info(param_name, param_value_size, param_value,
@@ -359,8 +359,9 @@ clGetImageInfo(cl_mem image,
void * param_value,
size_t * param_value_size_ret)
{
- if (!image || (image->type() != Coal::MemObject::Image2D &&
- image->type() != Coal::MemObject::Image3D))
+ if (!image->isA(Coal::Object::T_MemObject) ||
+ (image->type() != Coal::MemObject::Image2D &&
+ image->type() != Coal::MemObject::Image3D))
return CL_INVALID_MEM_OBJECT;
Coal::Image2D *image2d = (Coal::Image2D *)image;
@@ -375,7 +376,7 @@ clSetMemObjectDestructorCallback(cl_mem memobj,
void *user_data),
void * user_data)
{
- if (!memobj)
+ if (!memobj->isA(Coal::Object::T_MemObject))
return CL_INVALID_MEM_OBJECT;
memobj->setDestructorCallback(pfn_notify, user_data);
diff --git a/src/api/api_profiling.cpp b/src/api/api_profiling.cpp
index d4d2e31..516e54f 100644
--- a/src/api/api_profiling.cpp
+++ b/src/api/api_profiling.cpp
@@ -9,7 +9,7 @@ clGetEventProfilingInfo(cl_event event,
void * param_value,
size_t * param_value_size_ret)
{
- if (!event)
+ if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
return event->profilingInfo(param_name, param_value_size, param_value,
diff --git a/src/api/api_program.cpp b/src/api/api_program.cpp
index 24f2f1b..09151bc 100644
--- a/src/api/api_program.cpp
+++ b/src/api/api_program.cpp
@@ -17,7 +17,7 @@ clCreateProgramWithSource(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -57,7 +57,7 @@ clCreateProgramWithBinary(cl_context context,
if (!errcode_ret)
errcode_ret = &dummy_errcode;
- if (!context)
+ if (!context->isA(Coal::Object::T_Context))
{
*errcode_ret = CL_INVALID_CONTEXT;
return 0;
@@ -139,7 +139,7 @@ clCreateProgramWithBinary(cl_context context,
cl_int
clRetainProgram(cl_program program)
{
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
program->reference();
@@ -150,7 +150,7 @@ clRetainProgram(cl_program program)
cl_int
clReleaseProgram(cl_program program)
{
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
if (program->dereference())
@@ -167,7 +167,7 @@ clBuildProgram(cl_program program,
void (*pfn_notify)(cl_program program, void * user_data),
void * user_data)
{
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
if (!device_list && num_devices > 0)
@@ -243,7 +243,7 @@ clGetProgramInfo(cl_program program,
void * param_value,
size_t * param_value_size_ret)
{
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
return program->info(param_name, param_value_size, param_value,
@@ -258,7 +258,7 @@ clGetProgramBuildInfo(cl_program program,
void * param_value,
size_t * param_value_size_ret)
{
- if (!program)
+ if (!program->isA(Coal::Object::T_Program))
return CL_INVALID_PROGRAM;
return program->buildInfo((Coal::DeviceInterface *)device, param_name,
diff --git a/src/core/deviceinterface.h b/src/core/deviceinterface.h
index 361df2e..2df5ace 100644
--- a/src/core/deviceinterface.h
+++ b/src/core/deviceinterface.h
@@ -2,6 +2,7 @@
#define __DEVICEINTERFACE_H__
#include <CL/cl.h>
+#include "object.h"
namespace llvm
{
@@ -22,10 +23,10 @@ class Event;
class Program;
class Kernel;
-class DeviceInterface
+class DeviceInterface : public Object
{
public:
- DeviceInterface() {}
+ DeviceInterface() : Object(Object::T_Device, 0) {}
virtual ~DeviceInterface() {}
virtual cl_int info(cl_device_info param_name,
diff --git a/src/core/object.cpp b/src/core/object.cpp
index 37cdcfe..a04d00a 100644
--- a/src/core/object.cpp
+++ b/src/core/object.cpp
@@ -67,7 +67,9 @@ bool Object::isA(Object::Type type) const
while (it != e)
{
if (*it == this)
- return (*it)->type() == type;
+ return this->type() == type;
+
+ ++it;
}
return false;
diff --git a/src/core/object.h b/src/core/object.h
index 1ec161f..e78b1b3 100644
--- a/src/core/object.h
+++ b/src/core/object.h
@@ -11,6 +11,7 @@ class Object
public:
enum Type
{
+ T_Device,
T_CommandQueue,
T_Event,
T_Context,