This revision was automatically updated to reflect the committed changes.
Closed by commit rL263639: Fix destructor definition of invalid classes
(authored by ogoffart).
Changed prior to commit:
http://reviews.llvm.org/D17988?vs=50124&id=50822#toc
Repository:
rL LLVM
http://reviews.llvm.org/D17988
Files:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/destructor.cpp
Index: cfe/trunk/test/SemaCXX/destructor.cpp
===
--- cfe/trunk/test/SemaCXX/destructor.cpp
+++ cfe/trunk/test/SemaCXX/destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fsyntax-only
-Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fsyntax-only
-Wnon-virtual-dtor -Wdelete-non-virtual-dtor -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++11 -triple %ms_abi_triple -DMSABI -fsyntax-only
-Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s
class A {
public:
@@ -423,3 +423,11 @@
(s.~S); // expected-error{{reference to destructor must be called}}
}
}
+
+class Invalid {
+~Invalid();
+UnknownType xx; // expected-error{{unknown type name}}
+};
+
+// The constructor definition should not have errors
+Invalid::~Invalid() {}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13862,15 +13862,17 @@
I = CXXRecord->conversion_begin(),
E = CXXRecord->conversion_end(); I != E; ++I)
I.setAccess((*I)->getAccess());
-
-if (!CXXRecord->isDependentType()) {
- if (CXXRecord->hasUserDeclaredDestructor()) {
-// Adjust user-defined destructor exception spec.
-if (getLangOpts().CPlusPlus11)
- AdjustDestructorExceptionSpec(CXXRecord,
-CXXRecord->getDestructor());
- }
+ }
+
+ if (!CXXRecord->isDependentType()) {
+if (CXXRecord->hasUserDeclaredDestructor()) {
+ // Adjust user-defined destructor exception spec.
+ if (getLangOpts().CPlusPlus11)
+AdjustDestructorExceptionSpec(CXXRecord,
+ CXXRecord->getDestructor());
+}
+if (!CXXRecord->isInvalidDecl()) {
// Add any implicitly-declared members to this class.
AddImplicitlyDeclaredMembersToClass(CXXRecord);
Index: cfe/trunk/test/SemaCXX/destructor.cpp
===
--- cfe/trunk/test/SemaCXX/destructor.cpp
+++ cfe/trunk/test/SemaCXX/destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fsyntax-only -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fsyntax-only -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++11 -triple %ms_abi_triple -DMSABI -fsyntax-only -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s
class A {
public:
@@ -423,3 +423,11 @@
(s.~S); // expected-error{{reference to destructor must be called}}
}
}
+
+class Invalid {
+~Invalid();
+UnknownType xx; // expected-error{{unknown type name}}
+};
+
+// The constructor definition should not have errors
+Invalid::~Invalid() {}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13862,15 +13862,17 @@
I = CXXRecord->conversion_begin(),
E = CXXRecord->conversion_end(); I != E; ++I)
I.setAccess((*I)->getAccess());
-
-if (!CXXRecord->isDependentType()) {
- if (CXXRecord->hasUserDeclaredDestructor()) {
-// Adjust user-defined destructor exception spec.
-if (getLangOpts().CPlusPlus11)
- AdjustDestructorExceptionSpec(CXXRecord,
-CXXRecord->getDestructor());
- }
+ }
+
+ if (!CXXRecord->isDependentType()) {
+if (CXXRecord->hasUserDeclaredDestructor()) {
+ // Adjust user-defined destructor exception spec.
+ if (getLangOpts().CPlusPlus11)
+AdjustDestructorExceptionSpec(CXXRecord,
+ CXXRecord->getDestructor());
+}
+if (!CXXRecord->isInvalidDecl()) {
// Add any implicitly-declared members to this class.
AddImplicitlyDeclaredMembersToClass(CXXRecord);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits