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.

llvm-svn: 239752
This commit is contained in:
Greg Clayton 2015-06-15 20:17:18 +00:00
parent c30eae4567
commit 49e9010ca3
1 changed files with 17 additions and 6 deletions

View File

@ -589,16 +589,27 @@ Type::ResolveClangType (ResolveState clang_type_resolve_state)
break;
}
}
// 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);
}
}
}