diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-13 03:58:31 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-13 03:58:31 +0000 |
commit | 09d272d0254417df61595b83d229297ca5ec7a63 (patch) | |
tree | 100f88618883404bf2c2fcfd8fa68545f4b7b698 /clang/lib/CodeGen | |
parent | dd8fbf572ee98ef793b691dda2dc89eaf38cba2f (diff) | |
download | bcm5719-llvm-09d272d0254417df61595b83d229297ca5ec7a63.tar.gz bcm5719-llvm-09d272d0254417df61595b83d229297ca5ec7a63.zip |
A base subobject type doesn't make sense for unions; don't try to compute it. Based on patch by Yin Ma. Fixes PR11751.
llvm-svn: 148093
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 74fd794ef11..537daf9932e 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -997,7 +997,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, // If we're in C++, compute the base subobject type. llvm::StructType *BaseTy = 0; - if (isa<CXXRecordDecl>(D)) { + if (isa<CXXRecordDecl>(D) && !D->isUnion()) { BaseTy = Builder.BaseSubobjectType; if (!BaseTy) BaseTy = Ty; } |