]> granicus.if.org Git - clang/commit
CodeGen: Compound literals with funny types shouldn't crash
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 14 Dec 2014 12:16:43 +0000 (12:16 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 14 Dec 2014 12:16:43 +0000 (12:16 +0000)
commit320a846584599c9cfb339b6bb0a7a9634a397414
treed16d450404d41515c6b68de7510201d1eab5b0dc
parente78343bd2b01bdd97388d648c95d794b82d0d971
CodeGen: Compound literals with funny types shouldn't crash

CodeGen assumed that a compound literal with array type should have a
corresponding LLVM IR array type.

We had two bugs in this area:
- Zero sized arrays in compound literals would lead to the creation of
  an opaque type.  This is unnecessary, we should just create an array
  type with a bound of zero.
- Funny record types (like unions) lead to exotic IR types for compound
  literals.  In this case, CodeGen must be prepared to deal with the
  possibility that it might not have an array IR type.

This fixes PR21912.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224219 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
test/CodeGenCXX/compound-literals.cpp
test/CodeGenCXX/lambda-expressions.cpp