Add stronger checking
- Add assertions to enforce that objects are of the correct kind and have been allocated. - Make destructors check if objects have been allocated before deleting. - Operations that require a non-NullDevice return failure if given a NullDevice. - Use static_cast rather than reinterpret_cast when cohersing from a base class to a derived class. Change-Id: I02ee0ea9d7982fd7ca29d49c9b02cfae111b7127
This commit is contained in:
@@ -349,6 +349,7 @@ class Program : public NullProgram {
|
||||
|
||||
//! Return a typecasted GPU device
|
||||
gpu::Device& gpuDevice() {
|
||||
assert(!isNull());
|
||||
return const_cast<gpu::Device&>(static_cast<const gpu::Device&>(device()));
|
||||
}
|
||||
|
||||
@@ -476,6 +477,7 @@ class HSAILProgram : public device::Program {
|
||||
|
||||
//! Return a typecasted GPU device. The device must not be the NullDevice.
|
||||
gpu::Device& gpuDevice() {
|
||||
assert(!isNull());
|
||||
return const_cast<gpu::Device&>(static_cast<const gpu::Device&>(device()));
|
||||
}
|
||||
|
||||
|
||||
مرجع در شماره جدید
Block a user