Revert "[Sema] Diagnose default-initialization, destruction, and copying of"
This reverts commit r365985.
Prior to r365985, clang used to mark C union fields that have
non-trivial ObjC ownership qualifiers as unavailable if the union was
declared in a system header. r365985 stopped doing so, which caused the
swift compiler to crash when it tried to import a non-trivial union.
I have a patch that fixes the crash (https://reviews.llvm.org/D65256),
but I'm temporarily reverting the original patch until we can decide on
whether it's taking the right approach.
llvm-svn: 367076
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 11fed28..3941643 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1658,24 +1658,12 @@
// Set the EscapingByref flag of __block variables captured by
// escaping blocks.
for (const BlockDecl *BD : FSI.Blocks) {
+ if (BD->doesNotEscape())
+ continue;
for (const BlockDecl::Capture &BC : BD->captures()) {
VarDecl *VD = BC.getVariable();
- if (VD->hasAttr<BlocksAttr>()) {
- // Nothing to do if this is a __block variable captured by a
- // non-escaping block.
- if (BD->doesNotEscape())
- continue;
+ if (VD->hasAttr<BlocksAttr>())
VD->setEscapingByref();
- }
- // Check whether the captured variable is or contains an object of
- // non-trivial C union type.
- QualType CapType = BC.getVariable()->getType();
- if (CapType.hasNonTrivialToPrimitiveDestructCUnion() ||
- CapType.hasNonTrivialToPrimitiveCopyCUnion())
- S.checkNonTrivialCUnion(BC.getVariable()->getType(),
- BD->getCaretLocation(),
- Sema::NTCUC_BlockCapture,
- Sema::NTCUK_Destruct|Sema::NTCUK_Copy);
}
}