Hi rsmith, rjmccall,
Phab doesn't allow me to reopen closed review or upload a new diff to a closed
review. Anyhow.
This changes the code as Richard proposed. Thank you both for the time spent on
this.
http://reviews.llvm.org/D10626
Files:
lib/CodeGen/CGClass.cpp
Index: lib/CodeGen/CGClass.cpp
===================================================================
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -1297,10 +1297,6 @@
if (BaseClassDecl->hasTrivialDestructor())
return true;
- // Give up if the destructor is not accessible.
- if (!BaseClassDecl->getDestructor())
- return false;
-
if (!BaseClassDecl->getDestructor()->hasTrivialBody())
return false;
@@ -1346,6 +1342,11 @@
return true;
CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
+
+ // The destructor for an implicit anonymous union member is never invoked.
+ if (FieldClassDecl->isUnion() && FieldClassDecl->isAnonymousStructOrUnion())
+ return false;
+
return HasTrivialDestructorBody(Context, FieldClassDecl, FieldClassDecl);
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/CodeGen/CGClass.cpp
===================================================================
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -1297,10 +1297,6 @@
if (BaseClassDecl->hasTrivialDestructor())
return true;
- // Give up if the destructor is not accessible.
- if (!BaseClassDecl->getDestructor())
- return false;
-
if (!BaseClassDecl->getDestructor()->hasTrivialBody())
return false;
@@ -1346,6 +1342,11 @@
return true;
CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
+
+ // The destructor for an implicit anonymous union member is never invoked.
+ if (FieldClassDecl->isUnion() && FieldClassDecl->isAnonymousStructOrUnion())
+ return false;
+
return HasTrivialDestructorBody(Context, FieldClassDecl, FieldClassDecl);
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits