summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-11-03 22:40:07 +0000
committerGreg Clayton <gclayton@apple.com>2015-11-03 22:40:07 +0000
commit0644900004343cd0eb094eba97a3f2edf61a1cd5 (patch)
tree9ce48e473e479864264de8c61919f8c193cad76b
parente8ed13d94664101410817f4eb09d23b9099f7621 (diff)
downloadbcm5719-llvm-0644900004343cd0eb094eba97a3f2edf61a1cd5.tar.gz
bcm5719-llvm-0644900004343cd0eb094eba97a3f2edf61a1cd5.zip
With the new modules debugging, we have seen cases where clang is not emitting full definitions for types that are member variables of classes. If we try to make a class with a member where the type of the class in a forward declaration, clang will assert and crash and bring down the IDE. This is not acceptable so we need to work around it. We work around it by making sure that if we have a member that is an instance (not a pointer or reference) of a class/struct/union, that it is a complete type. If it isn't then we emit an error to let the user know to file a bug against the compiler, and then we make the class complete, but empty. We also do this for base classes elsewhere. We use the DWARF to help layout the type, so we will get all instance variables correct, but we just won't have visibility into this instance variable.
llvm-svn: 252001
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 64d619521fe..366d65787f2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2777,6 +2777,23 @@ DWARFASTParserClang::ParseChildMembers (const SymbolContext& sc,
}
}
+ if (ClangASTContext::IsCXXClassType(member_clang_type) && member_clang_type.GetCompleteType() == false)
+ {
+ module_sp->ReportError ("DWARF DIE at 0x%8.8x (class %s) has a member variable 0x%8.8x (%s) whose type is a forward declaration, not a complete definition.\nPlease file a bug against the compiler and include the preprocessed output for %s",
+ parent_die.GetOffset(),
+ parent_die.GetName(),
+ die.GetOffset(),
+ name,
+ sc.comp_unit ? sc.comp_unit->GetPath().c_str() : "the source file");
+ // We have no choice other than to pretend that the member class
+ // is complete. If we don't do this, clang will crash when trying
+ // to layout the class. Since we provide layout assistance, all
+ // ivars in this class and other classes will be fine, this is
+ // the best we can do short of crashing.
+ ClangASTContext::StartTagDeclarationDefinition(member_clang_type);
+ ClangASTContext::CompleteTagDeclarationDefinition(member_clang_type);
+ }
+
field_decl = ClangASTContext::AddFieldToRecordType (class_clang_type,
name,
member_clang_type,
OpenPOWER on IntegriCloud