This patch diagnoses uses of non-trivial C unions in the following contexts:
- function parameters
- function returns
- variables with automatic storage duration
- assignment
- compound literal with automatic storage duration
- block capture except when a __block variable is captured by a non-escaping block
Note that we already reject non-trivial C structs/unions used for variable function arguments. Also this patch doesn't detect non-trivial C unions passed to functions without function prototypes. I think that's okay since clang will reject the function definition's parameters, but if it isn't okay, it's possible to add diagnostics for that too.
See the discussion in https://reviews.llvm.org/D62988 for more background.
rdar://problem/50679094