fix decl attributes cleaning
this plugs the leak of attributes and also fixes a crash in the test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51862 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index eb0abaf..230ea3c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -276,7 +276,6 @@
 static void MergeAttributes(Decl *New, Decl *Old) {
   Attr *attr = const_cast<Attr*>(Old->getAttrs()), *tmp;
 
-// FIXME: fix this code to cleanup the Old attrs correctly
   while (attr) {
      tmp = attr;
      attr = attr->getNext();
@@ -288,6 +287,8 @@
        delete(tmp);
     }
   }
+
+  Old->invalidateAttrs();
 }
 
 /// MergeFunctionDecl - We just parsed a function 'New' from