diff options
author | Greg Clayton <gclayton@apple.com> | 2015-06-15 20:17:18 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-06-15 20:17:18 +0000 |
commit | 49e9010ca339099d23c56e768d0b0fcf40929719 (patch) | |
tree | 25f4c7a4186a183f0cbbe89c1e5811fc328242cc | |
parent | c30eae4567374237a942d277e6ff07d3285ca457 (diff) | |
download | bcm5719-llvm-49e9010ca339099d23c56e768d0b0fcf40929719.tar.gz bcm5719-llvm-49e9010ca339099d23c56e768d0b0fcf40929719.zip |
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
-rw-r--r-- | lldb/source/Symbol/Type.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 6e67f4695d9..0927d55f1ee 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -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); + } } } |