summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-04-07 00:06:00 +0000
committerSean Callanan <scallanan@apple.com>2012-04-07 00:06:00 +0000
commitbf81ea5a9f9b0607bd35e36b38cebbc7c601d0d2 (patch)
treef8a1977c43e2d219332037bd5d068e46a6523929 /lldb/source/Expression
parent706c2350134301bda7eff396651e3e489a57ca89 (diff)
downloadbcm5719-llvm-bf81ea5a9f9b0607bd35e36b38cebbc7c601d0d2.tar.gz
bcm5719-llvm-bf81ea5a9f9b0607bd35e36b38cebbc7c601d0d2.zip
Hardened the struct layout code to eliminate a
potential crash if the underlying type couldn't be completed. llvm-svn: 154234
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index e1154efa406..5461f1918c7 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -1183,6 +1183,11 @@ ClangASTSource::layoutRecordType(const RecordDecl *record,
BaseOffsetMap origin_base_offsets;
BaseOffsetMap origin_virtual_base_offsets;
+ ClangASTContext::GetCompleteDecl(&origin_record->getASTContext(), const_cast<RecordDecl*>(origin_record.decl));
+
+ if (!origin_record.decl->getDefinition())
+ return false;
+
const ASTRecordLayout &record_layout(origin_record->getASTContext().getASTRecordLayout(origin_record.decl));
int field_idx = 0;
OpenPOWER on IntegriCloud