Commit d32a61b0 authored by Paul Chaignon's avatar Paul Chaignon Committed by Brenden Blanco

Fix segfault on incomplete types

The bcc rewriter segfaults when it encounters an incomplete type
(missing declaration or declaration after use) in a map declaration.
This commit fixes it by first checking the type and returning an
error if it is incomplete.
parent 574c3ebc
......@@ -621,6 +621,11 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
unsigned i = 0;
for (auto F : RD->fields()) {
if (F->getType().getTypePtr()->isIncompleteType()) {
error(F->getLocStart(), "unknown type");
return false;
}
size_t sz = C.getTypeSize(F->getType()) >> 3;
if (F->getName() == "key") {
if (sz == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment