Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.

The next step is to print the name directly into the stream, avoiding a temporary std::string copy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101632 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp
index 2d623e3..d67f97a 100644
--- a/tools/CIndex/CIndexUSRs.cpp
+++ b/tools/CIndex/CIndexUSRs.cpp
@@ -137,7 +137,7 @@
 
 void USRGenerator::VisitFunctionDecl(FunctionDecl *D) {
   VisitDeclContext(D->getDeclContext());
-  Out << "@F@" << D->getNameAsString();
+  Out << "@F@" << D;
 }
 
 void USRGenerator::VisitNamedDecl(NamedDecl *D) {
@@ -155,7 +155,7 @@
 
 void USRGenerator::VisitNamespaceDecl(NamespaceDecl *D) {
   VisitDeclContext(D->getDeclContext());
-  Out << "@N@" << D->getNameAsString();
+  Out << "@N@" << D;
 }
 
 void USRGenerator::VisitObjCMethodDecl(ObjCMethodDecl *D) {
@@ -251,7 +251,7 @@
 
   if (s.empty()) {
     if (TD)
-      Out << '@' << TD->getNameAsString();
+      Out << '@' << TD;
   }
   else
     Out << '@' << s;