diff libinterp/corefcn/symrec.h @ 24361:8bcfddad15ec

use shared_ptr to manage symbol_scope objects * symscope.h, symscope.cc (symbol_scope_rep): New class, renamed and adapted from symbol_scope. (symbol_scope): New class to manage symbol_scope_rep with shared_ptr. Change all uses of pointers ot symbol_scope objects to be symbol_scope objects or, in a few cases, pointers to symbol_scope_rep objects instead.
author John W. Eaton <jwe@octave.org>
date Mon, 27 Nov 2017 01:12:05 -0500
parents 8b14ba8296af
children 64a85a19f6e3
line wrap: on
line diff
--- a/libinterp/corefcn/symrec.h	Tue Dec 05 11:35:11 2017 -0800
+++ b/libinterp/corefcn/symrec.h	Mon Nov 27 01:12:05 2017 -0500
@@ -38,7 +38,7 @@
 
 namespace octave
 {
-  class symbol_scope;
+  class symbol_scope_rep;
 
   class symbol_record
   {
@@ -78,8 +78,8 @@
     {
     public:
 
-      symbol_record_rep (const std::string& nm,
-                         const octave_value& v, unsigned int sc)
+      symbol_record_rep (const std::string& nm, const octave_value& v,
+                         unsigned int sc)
         : m_storage_class (sc), m_name (nm), m_fwd_scope (nullptr),
           m_fwd_rep (), m_value_stack (), m_valid (true)
       {
@@ -492,7 +492,7 @@
         m_valid = false;
       }
 
-      void bind_fwd_rep (symbol_scope *fwd_scope,
+      void bind_fwd_rep (symbol_scope_rep *fwd_scope,
                          const std::shared_ptr<symbol_record_rep>& fwd_rep)
       {
         if (auto t_fwd_rep = m_fwd_rep.lock ())
@@ -517,7 +517,7 @@
         m_fwd_rep.reset ();
       }
 
-      symbol_record_rep * dup (symbol_scope *new_scope) const;
+      symbol_record_rep * dup (symbol_scope_rep *new_scope) const;
 
       octave_value dump (context_id context) const;
 
@@ -531,7 +531,7 @@
 
       std::string m_name;
 
-      symbol_scope *m_fwd_scope;
+      symbol_scope_rep *m_fwd_scope;
 
       std::weak_ptr<symbol_record_rep> m_fwd_rep;
 
@@ -554,7 +554,7 @@
 
     ~symbol_record (void) = default;
 
-    symbol_record dup (symbol_scope *sid) const
+    symbol_record dup (symbol_scope_rep *sid) const
     {
       return symbol_record (m_rep->dup (sid));
     }
@@ -662,7 +662,7 @@
 
     unsigned int storage_class (void) const { return m_rep->storage_class (); }
 
-    void bind_fwd_rep (symbol_scope *fwd_scope, const symbol_record& sr)
+    void bind_fwd_rep (symbol_scope_rep *fwd_scope, const symbol_record& sr)
     {
       m_rep->bind_fwd_rep (fwd_scope, sr.m_rep);
     }