From: Aina Niemetz Date: Thu, 2 Sep 2021 19:04:11 +0000 (-0700) Subject: EnvObj: Restrict access. (#7121) X-Git-Tag: cvc5-1.0.0~1286 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ff254480c38b721a506bb0c174bcd8cb34924ef;p=cvc5.git EnvObj: Restrict access. (#7121) This makes all members of EnvObj protected in order to prevent creating EnvObj instances and call member functions. It further uses protected inheritance (instead of public) for derived classes in order to disallow `EnvObj* a = new DerivedObj();`. --- diff --git a/src/preprocessing/preprocessing_pass.h b/src/preprocessing/preprocessing_pass.h index e1c3a5100..cc438e5c6 100644 --- a/src/preprocessing/preprocessing_pass.h +++ b/src/preprocessing/preprocessing_pass.h @@ -49,7 +49,7 @@ class PreprocessingPassContext; */ enum PreprocessingPassResult { CONFLICT, NO_CONFLICT }; -class PreprocessingPass : public EnvObj +class PreprocessingPass : protected EnvObj { public: /* Preprocesses a list of assertions assertionsToPreprocess */ diff --git a/src/preprocessing/util/ite_utilities.h b/src/preprocessing/util/ite_utilities.h index 48408e46e..1d2aa7084 100644 --- a/src/preprocessing/util/ite_utilities.h +++ b/src/preprocessing/util/ite_utilities.h @@ -67,7 +67,7 @@ class ContainsTermITEVisitor NodeBoolMap d_cache; }; -class ITEUtilities : public EnvObj +class ITEUtilities : protected EnvObj { public: ITEUtilities(Env& env); @@ -164,7 +164,7 @@ class TermITEHeightCounter * A routine designed to undo the potentially large blow up * due to expansion caused by the ite simplifier. */ -class ITECompressor : public EnvObj +class ITECompressor : protected EnvObj { public: ITECompressor(Env& env, ContainsTermITEVisitor* contains); @@ -206,7 +206,7 @@ class ITECompressor : public EnvObj Statistics d_statistics; }; /* class ITECompressor */ -class ITESimplifier : public EnvObj +class ITESimplifier : protected EnvObj { public: ITESimplifier(Env& env, ContainsTermITEVisitor* d_containsVisitor); diff --git a/src/smt/env_obj.h b/src/smt/env_obj.h index 69aab7647..bae05874b 100644 --- a/src/smt/env_obj.h +++ b/src/smt/env_obj.h @@ -31,12 +31,12 @@ class Options; class EnvObj { - public: + protected: /** Constructor. */ EnvObj(Env& env); EnvObj() = delete; /** Destructor. */ - ~EnvObj() {} + virtual ~EnvObj() {} /** * Rewrite a node. @@ -44,7 +44,6 @@ class EnvObj */ Node rewrite(TNode node); - protected: /** The associated environment. */ Env& d_env; };