kristina updated this revision to Diff 173411.
kristina added a comment.
Revised (style/ordering).
https://reviews.llvm.org/D54344
Files:
lib/CodeGen/CGDeclCXX.cpp
Index: lib/CodeGen/CGDeclCXX.cpp
===================================================================
--- lib/CodeGen/CGDeclCXX.cpp
+++ lib/CodeGen/CGDeclCXX.cpp
@@ -64,10 +64,19 @@
/// static storage duration.
static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
ConstantAddress addr) {
- CodeGenModule &CGM = CGF.CGM;
+ // Workaround for a bug that causes a reference to a nonexistent
+ // destructor under odd circumstances, when attribute no_destroy
+ // is used. This code should not be reachable under normal
+ // circumstances, this workaround simply checks for the attribute
+ // again and bails if it's present instead of following a path
+ // that's either going to assert or emit incorrect code if reached.
+ if (D.hasAttr<NoDestroyAttr>())
+ return;
// FIXME: __attribute__((cleanup)) ?
+ CodeGenModule &CGM = CGF.CGM;
+
QualType type = D.getType();
QualType::DestructionKind dtorKind = type.isDestructedType();
Index: lib/CodeGen/CGDeclCXX.cpp
===================================================================
--- lib/CodeGen/CGDeclCXX.cpp
+++ lib/CodeGen/CGDeclCXX.cpp
@@ -64,10 +64,19 @@
/// static storage duration.
static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
ConstantAddress addr) {
- CodeGenModule &CGM = CGF.CGM;
+ // Workaround for a bug that causes a reference to a nonexistent
+ // destructor under odd circumstances, when attribute no_destroy
+ // is used. This code should not be reachable under normal
+ // circumstances, this workaround simply checks for the attribute
+ // again and bails if it's present instead of following a path
+ // that's either going to assert or emit incorrect code if reached.
+ if (D.hasAttr<NoDestroyAttr>())
+ return;
// FIXME: __attribute__((cleanup)) ?
+ CodeGenModule &CGM = CGF.CGM;
+
QualType type = D.getType();
QualType::DestructionKind dtorKind = type.isDestructedType();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits