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/lib/Checker/BugReporterVisitors.cpp b/lib/Checker/BugReporterVisitors.cpp
index 06cee5b..544129b 100644
--- a/lib/Checker/BugReporterVisitors.cpp
+++ b/lib/Checker/BugReporterVisitors.cpp
@@ -144,7 +144,7 @@
       if (const DeclStmt *DS = PS->getStmtAs<DeclStmt>()) {
 
         if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
-          os << "Variable '" << VR->getDecl()->getNameAsString() << "' ";
+          os << "Variable '" << VR->getDecl() << "' ";
         }
         else
           return NULL;
@@ -206,7 +206,7 @@
         return NULL;
 
       if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
-        os << '\'' << VR->getDecl()->getNameAsString() << '\'';
+        os << '\'' << VR->getDecl() << '\'';
       }
       else
         return NULL;