File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,12 @@ class Mangled {
276276 void Encode (DataEncoder &encoder, ConstStringTable &strtab) const ;
277277
278278private:
279+ // /< If \c force is \c false, this function will re-use the previously
280+ // /< demangled name (if any). If \c force is \c true (or the mangled name
281+ // /< on this object was not previously demangled), demangle and cache the
282+ // /< name.
283+ ConstString GetDemangledNameImpl (bool force) const ;
284+
279285 // /< The mangled version of the name.
280286 ConstString m_mangled;
281287
Original file line number Diff line number Diff line change @@ -265,19 +265,24 @@ bool Mangled::GetRichManglingInfo(RichManglingContext &context,
265265 llvm_unreachable (" Fully covered switch above!" );
266266}
267267
268+ ConstString Mangled::GetDemangledName () const {
269+ return GetDemangledNameImpl (/* force=*/ false );
270+ }
271+
268272// Generate the demangled name on demand using this accessor. Code in this
269273// class will need to use this accessor if it wishes to decode the demangled
270274// name. The result is cached and will be kept until a new string value is
271275// supplied to this object, or until the end of the object's lifetime.
272- ConstString Mangled::GetDemangledName ( ) const {
276+ ConstString Mangled::GetDemangledNameImpl ( bool force ) const {
273277 if (!m_mangled)
274278 return m_demangled;
275279
276280 // Re-use previously demangled names.
277- if (!m_demangled.IsNull ())
281+ if (!force && ! m_demangled.IsNull ())
278282 return m_demangled;
279283
280- if (m_mangled.GetMangledCounterpart (m_demangled) && !m_demangled.IsNull ())
284+ if (!force && m_mangled.GetMangledCounterpart (m_demangled) &&
285+ !m_demangled.IsNull ())
281286 return m_demangled;
282287
283288 // We didn't already mangle this name, demangle it and if all goes well
You can’t perform that action at this time.
0 commit comments