Patch to mark destructors when they are used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74359 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index c154ddf..13162d8 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2792,9 +2792,13 @@
                                                  IK_Default);
         if (!Constructor)
           Var->setInvalidDecl();
-        else 
+        else { 
           if (!RD->hasTrivialConstructor())
             InitializeVarWithConstructor(Var, Constructor, InitType, 0, 0);
+          // FIXME. Must do all that is needed to destroy the object
+          // on scope exit. For now, just mark the destructor as used.
+          MarcDestructorReferenced(Var->getLocation(), InitType);
+        }
       }
     }