]> granicus.if.org Git - clang/commit
PR18962: Fix "Unable to find record layout information for type"
authorReid Kleckner <reid@kleckner.net>
Thu, 27 Feb 2014 00:03:39 +0000 (00:03 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 27 Feb 2014 00:03:39 +0000 (00:03 +0000)
commit27618fb7f6737d24da06aed8afe190545b4e0a80
tree574e44fbabe6783aeeef434a6f388aa2d5b0aed4
parent6f83a9e0dcff8f63f19c3c7ba14656d75fcee250
PR18962: Fix "Unable to find record layout information for type"

Clang is using llvm::StructType::isOpaque() as a way of signaling if
we've finished record type conversion in
CodeGenTypes::isRecordLayoutComplete().  However, Clang was setting the
body of the type before it finished laying out the type as a base type.
Laying out the %class.C.base LLVM type attempts to convert more types,
eventually recursively attempting to layout 'C' again, at which point we
would say that layout was complete, even though we were still in the
middle of it.

By not setting the body, we correctly signal that layout is not
complete, and things work as expected.

At some point, it might be worth refactoring this to avoid looking at
the LLVM IR types under construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202320 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGRecordLayoutBuilder.cpp
test/CodeGenCXX/pr18962.cpp [new file with mode: 0644]