[DWARFASTParserClang] Complete external record types before using them as a decl context.

Summary:
When in a gmodules-like debugging scenario, you can have a parent decl context
that gets imported from an external AST. When this happens, we must be careful
to complete this type before adding children to it, otherwise it sometimes
results in a crash.

Reviewers: clayborg, jingham

Subscribers: aprantl, JDevlieghere, lldb-commits

Differential Revision: https://reviews.llvm.org/D43592

llvm-svn: 327750
This commit is contained in:
Frederic Riss
2018-03-16 22:12:22 +00:00
parent f6766b0e45
commit cce4af160c
4 changed files with 68 additions and 0 deletions

View File

@@ -69,3 +69,26 @@ class TestWithGmodulesDebugInfo(TestBase):
42,
memberValue.GetValueAsSigned(),
"Member value incorrect")
testValue = frame.EvaluateExpression("bar")
self.assertTrue(
testValue.GetError().Success(),
"Test expression value invalid: %s" %
(testValue.GetError().GetCString()))
self.assertTrue(
testValue.GetTypeName() == "Foo::Bar",
"Test expression type incorrect")
memberValue = testValue.GetChildMemberWithName("i")
self.assertTrue(
memberValue.GetError().Success(),
"Member value missing or invalid: %s" %
(testValue.GetError().GetCString()))
self.assertTrue(
memberValue.GetTypeName() == "int",
"Member type incorrect")
self.assertEqual(
123,
memberValue.GetValueAsSigned(),
"Member value incorrect")