[Lldb-commits] [lldb] r239752 - Found an issue that was causing types to be completed much more often than they needed to be.
gclayton at apple.com
Mon Jun 15 13:17:18 PDT 2015
Date: Mon Jun 15 15:17:18 2015
New Revision: 239752
Found an issue that was causing types to be completed much more often than they needed to be.
The problem is for lldb_private::Type instances that have encoding types (pointer/reference/const/volatile/restrict/typedef to type with user ID 0x123). If they started out with m_flags.clang_type_resolve_state being set to eResolveStateUnresolved (0), then when we would call Type::ResolveClangType(eResolveStateForward) we would complete the full type due to logic errors in the code.
We now only complete the type if clang_type_resolve_state is eResolveStateLayout or eResolveStateFull and we correctly upgrade the type's current completion state to eResolveStateForward after we make a forward delcaration to the pointer/reference/const/volatile/restrict/typedef type instead of leaving it set to eResolveStateUnresolved.
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Mon Jun 15 15:17:18 2015
@@ -589,16 +589,27 @@ Type::ResolveClangType (ResolveState cla
+ // When we have a EncodingUID, our "m_flags.clang_type_resolve_state" is set to eResolveStateUnresolved
+ // so we need to update it to say that we now have a forward declaration since that is what we created
+ // above.
+ if (m_clang_type.IsValid())
+ m_flags.clang_type_resolve_state = eResolveStateForward;
// Check if we have a forward reference to a class/struct/union/enum?
- if (m_clang_type.IsValid() && m_flags.clang_type_resolve_state < clang_type_resolve_state)
+ if (clang_type_resolve_state == eResolveStateLayout || clang_type_resolve_state == eResolveStateFull)
- m_flags.clang_type_resolve_state = eResolveStateFull;
- if (!m_clang_type.IsDefined ())
+ // Check if we have a forward reference to a class/struct/union/enum?
+ if (m_clang_type.IsValid() && m_flags.clang_type_resolve_state < clang_type_resolve_state)
- // We have a forward declaration, we need to resolve it to a complete definition.
- m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_type);
+ m_flags.clang_type_resolve_state = eResolveStateFull;
+ if (!m_clang_type.IsDefined ())
+ // We have a forward declaration, we need to resolve it to a complete definition.
+ m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_type);
More information about the lldb-commits