Fix the valgrind cleanup of automatic array vars
This commit is contained in:
parent
911a20c134
commit
4cc6ae35dd
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2012-2026 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -340,16 +340,22 @@ vpiHandle vpip_make_queue_var(const char*name, vvp_net_t*net)
|
|||
}
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
void darray_delete(vpiHandle item)
|
||||
void array_delete(vpiHandle item)
|
||||
{
|
||||
__vpiDarrayVar*obj = dynamic_cast<__vpiDarrayVar*>(item);
|
||||
if (obj->vals_words) delete [] (obj->vals_words-1);
|
||||
delete obj;
|
||||
}
|
||||
__vpiDarrayVar*dobj = dynamic_cast<__vpiDarrayVar*>(item);
|
||||
if (dobj) {
|
||||
if (dobj->vals_words) delete [] (dobj->vals_words-1);
|
||||
delete dobj;
|
||||
return;
|
||||
}
|
||||
|
||||
void queue_delete(vpiHandle item)
|
||||
{
|
||||
__vpiQueueVar*obj = dynamic_cast<__vpiQueueVar*>(item);
|
||||
delete obj;
|
||||
__vpiQueueVar*qobj = dynamic_cast<__vpiQueueVar*>(item);
|
||||
if (qobj) {
|
||||
delete qobj;
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Need support for deleting array type: %d\n", item->vpi_get(vpiArrayType));
|
||||
assert(0);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2026 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -121,19 +121,7 @@ static void delete_sub_scopes(__vpiScope *scope)
|
|||
class_delete(item);
|
||||
break;
|
||||
case vpiArrayVar:
|
||||
switch(item->vpi_get(vpiArrayType)) {
|
||||
case vpiQueueArray:
|
||||
queue_delete(item);
|
||||
break;
|
||||
case vpiDynamicArray:
|
||||
darray_delete(item);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Need support for array type: %d\n",
|
||||
item->vpi_get(vpiArrayType));
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
array_delete(item);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Need support for type: %d\n",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef IVL_vvp_cleanup_H
|
||||
#define IVL_vvp_cleanup_H
|
||||
/*
|
||||
* Copyright (c) 2009-2015 Cary R. (cygcary@yahoo.com)
|
||||
* Copyright (c) 2009-2026 Cary R. (cygcary@yahoo.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -49,8 +49,7 @@ extern void class_delete(class __vpiHandle *item);
|
|||
extern void class_def_delete(class_type *item);
|
||||
extern void constant_delete(class __vpiHandle *item);
|
||||
extern void contexts_delete(__vpiScope *scope);
|
||||
extern void darray_delete(class __vpiHandle *item);
|
||||
extern void queue_delete(class __vpiHandle *item);
|
||||
extern void array_delete(class __vpiHandle *item);
|
||||
extern void enum_delete(class __vpiHandle *item);
|
||||
extern void memory_delete(class __vpiHandle *item);
|
||||
extern void named_event_delete(class __vpiHandle *item);
|
||||
|
|
|
|||
Loading…
Reference in New Issue