[llvm-branch-commits] [cfe-branch] r235308 - Merging r231451:

Tom Stellard thomas.stellard at amd.com
Mon Apr 20 08:17:50 PDT 2015


Author: tstellar
Date: Mon Apr 20 10:17:50 2015
New Revision: 235308

URL: http://llvm.org/viewvc/llvm-project?rev=235308&view=rev
Log:
Merging r231451:

------------------------------------------------------------------------
r231451 | nicolasweber | 2015-03-06 01:01:06 -0500 (Fri, 06 Mar 2015) | 5 lines

Don't crash on non-public referenced dtors in toplevel classes.

Fixes PR22793, a bug that caused self-hosting to fail after the innocuous
r231254. See the bug for details.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_36/lib/Sema/SemaExpr.cpp
    cfe/branches/release_36/test/CodeGenCXX/trivial-constructor-init.cpp

Modified: cfe/branches/release_36/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Sema/SemaExpr.cpp?rev=235308&r1=235307&r2=235308&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/release_36/lib/Sema/SemaExpr.cpp Mon Apr 20 10:17:50 2015
@@ -117,7 +117,7 @@ static AvailabilityResult DiagnoseAvaila
     case AR_Available:
     case AR_NotYetIntroduced:
       break;
-            
+
     case AR_Deprecated:
       if (S.getCurContextAvailability() != AR_Deprecated)
         S.EmitAvailabilityWarning(Sema::AD_Deprecation,
@@ -11630,8 +11630,11 @@ void Sema::MarkFunctionReferenced(Source
   } else if (CXXDestructorDecl *Destructor =
                  dyn_cast<CXXDestructorDecl>(Func)) {
     Destructor = cast<CXXDestructorDecl>(Destructor->getFirstDecl());
-    if (Destructor->isDefaulted() && !Destructor->isDeleted())
+    if (Destructor->isDefaulted() && !Destructor->isDeleted()) {
+      if (Destructor->isTrivial() && !Destructor->hasAttr<DLLExportAttr>())
+        return;
       DefineImplicitDestructor(Loc, Destructor);
+    }
     if (Destructor->isVirtual())
       MarkVTableUsed(Loc, Destructor->getParent());
   } else if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(Func)) {

Modified: cfe/branches/release_36/test/CodeGenCXX/trivial-constructor-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/CodeGenCXX/trivial-constructor-init.cpp?rev=235308&r1=235307&r2=235308&view=diff
==============================================================================
--- cfe/branches/release_36/test/CodeGenCXX/trivial-constructor-init.cpp (original)
+++ cfe/branches/release_36/test/CodeGenCXX/trivial-constructor-init.cpp Mon Apr 20 10:17:50 2015
@@ -32,3 +32,17 @@ static C c[4];
 
 int main() {
 }
+
+namespace PR22793 {
+template <typename>
+struct foo {
+protected:
+// CHECK-NOT: _ZN7PR227933fooIiED2Ev
+  ~foo() = default;
+  friend void func();
+};
+
+void func() { foo<int> f; }
+
+template struct foo<int>;
+}





More information about the llvm-branch-commits mailing list