From 583a7ddc352a8520f8b2e8939b22c266076ca3a6 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 17 Mar 2022 12:25:28 +0100 Subject: [PATCH] netclass: Make pointer to base class const The base class type is not owned by a class and is shared. For this reason it must not be modified. To ensure this mark the base class pointer as const. Signed-off-by: Lars-Peter Clausen --- netclass.cc | 4 ++-- netclass.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/netclass.cc b/netclass.cc index 82be2c55e..3365a8949 100644 --- a/netclass.cc +++ b/netclass.cc @@ -23,8 +23,8 @@ using namespace std; -netclass_t::netclass_t(perm_string name, netclass_t*sup) -: name_(name), super_(sup), class_scope_(0), definition_scope_(0) +netclass_t::netclass_t(perm_string name, const netclass_t*super) +: name_(name), super_(super), class_scope_(0), definition_scope_(0) { } diff --git a/netclass.h b/netclass.h index 7274bd5f7..af473ba71 100644 --- a/netclass.h +++ b/netclass.h @@ -35,7 +35,7 @@ class PExpr; class netclass_t : public ivl_type_s { public: - netclass_t(perm_string class_name, netclass_t*par); + netclass_t(perm_string class_name, const netclass_t*super); ~netclass_t(); // Set the property of the class during elaboration. Set the @@ -120,7 +120,7 @@ class netclass_t : public ivl_type_s { perm_string name_; // If this is derived from another base class, point to it // here. - netclass_t*super_; + const netclass_t*super_; // Map property names to property table index. std::map properties_; // Vector of properties.