Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in 
all-std-headers.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170928 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index 4a7344c..b400522 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -580,10 +580,8 @@
 
 void DeclPrinter::VisitFriendDecl(FriendDecl *D) {
   if (TypeSourceInfo *TSI = D->getFriendType()) {
-    if (CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl()) {
-      Out << "friend ";
-      VisitCXXRecordDecl(FriendD);
-    }
+    Out << "friend ";
+    Out << " " << TSI->getType().getAsString(Policy);
   }
   else if (FunctionDecl *FD =
       dyn_cast<FunctionDecl>(D->getFriendDecl())) {
@@ -598,7 +596,7 @@
   else if (ClassTemplateDecl *CTD =
            dyn_cast<ClassTemplateDecl>(D->getFriendDecl())) {
     Out << "friend ";
-    VisitClassTemplateDecl(CTD);
+    VisitRedeclarableTemplateDecl(CTD);
   }
 }