systemc: Handle null sc_object names.
authorGabe Black <gabeblack@google.com>
Thu, 23 Aug 2018 04:54:19 +0000 (21:54 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 25 Sep 2018 23:59:32 +0000 (23:59 +0000)
A null pointer for an sc_object name is supposed to be equivalent to
an empty string.

Change-Id: I6094577ad43f13d47a20bc67fa15f4c04d448fe5
Reviewed-on: https://gem5-review.googlesource.com/12257
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/object.cc

index e066a239f41b120b6a7d041879addd30ac68245a..1fb1d4591904267a20cc2d8d2cfe77a6d71b003e 100644 (file)
@@ -72,7 +72,7 @@ popObject(Objects *objects, const std::string &name)
 Object::Object(sc_core::sc_object *_sc_obj) : Object(_sc_obj, "object") {}
 
 Object::Object(sc_core::sc_object *_sc_obj, const char *obj_name) :
-    _sc_obj(_sc_obj), _basename(obj_name), parent(nullptr)
+    _sc_obj(_sc_obj), _basename(obj_name ? obj_name : ""), parent(nullptr)
 {
     if (_basename == "")
         _basename = "object";