Introduce reference counting for statements and expressions, using it
to allow sharing of nodes. Simplifies some aspects of template
instantiation, and fixes both PR3444 and <rdar://problem/6757457>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78450 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 021a6ad..1c98fca 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -222,7 +222,8 @@
   if (InstantiatedAssertExpr.isInvalid())
     return 0;
 
-  OwningExprResult Message = SemaRef.Clone(D->getMessage());
+  OwningExprResult Message(SemaRef, D->getMessage());
+  D->getMessage()->Retain();
   Decl *StaticAssert 
     = SemaRef.ActOnStaticAssertDeclaration(D->getLocation(), 
                                            move(InstantiatedAssertExpr),