Fix a possible SEGV in SymbolFileDWARF

The iterator pointing to an element of a dense map was used after
the element from was removed from the map what isn't guaranteed to be
valid at that time.

llvm-svn: 247571
This commit is contained in:
Tamas Berghammer 2015-09-14 15:44:29 +00:00
parent 26aca14b15
commit f8fd9b5263
1 changed files with 5 additions and 4 deletions

View File

@ -1513,15 +1513,16 @@ SymbolFileDWARF::CompleteType (CompilerType &clang_type)
// We have already resolved this type...
return true;
}
DWARFDebugInfo* debug_info = DebugInfo();
DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
// Once we start resolving this type, remove it from the forward declaration
// map in case anyone child members or other types require this type to get resolved.
// The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
// are done.
GetForwardDeclClangTypeToDie().erase (clang_type_no_qualifiers.GetOpaqueQualType());
GetForwardDeclClangTypeToDie().erase (die_it);
DWARFDebugInfo* debug_info = DebugInfo();
DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
Type *type = GetDIEToType().lookup (dwarf_die.GetDIE());
Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));