diff options
Diffstat (limited to 'gdb/common')
-rw-r--r-- | gdb/common/gdb_ref_ptr.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/common/gdb_ref_ptr.h b/gdb/common/gdb_ref_ptr.h index 57d1db96e6c..768c8136928 100644 --- a/gdb/common/gdb_ref_ptr.h +++ b/gdb/common/gdb_ref_ptr.h @@ -149,6 +149,13 @@ class ref_ptr return m_obj; } + /* Acquire a new reference and return a ref_ptr that owns it. */ + static ref_ptr<T, Policy> new_reference (T *obj) + { + Policy::incref (obj); + return ref_ptr<T, Policy> (obj); + } + private: T *m_obj; |