Print NamedDecls directly to a raw_ostream where possible.

llvm-svn: 149982
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
index 0bc1532..6678a0b 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -2205,7 +2205,7 @@
     else {
       const FunctionDecl *FD = cast<FunctionDecl>(D);
       os << " is returned from a function whose name ('"
-         << FD->getNameAsString()
+         << *FD
          << "') does not contain 'Copy' or 'Create'.  This violates the naming"
             " convention rules given in the Memory Management Guide for Core"
             " Foundation";
diff --git a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index f769ea6..02ef6dc 100644
--- a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -165,18 +165,18 @@
   
   os << "Call Path : ";
   // Name of current visiting CallExpr.
-  os << CE->getDirectCallee()->getNameAsString();
+  os << *CE->getDirectCallee();
 
   // Name of the CallExpr whose body is current walking.
   if (visitingCallExpr)
-    os << " <-- " << visitingCallExpr->getDirectCallee()->getNameAsString();
+    os << " <-- " << *visitingCallExpr->getDirectCallee();
   // Names of FunctionDecls in worklist with state PostVisited.
   for (SmallVectorImpl<const CallExpr *>::iterator I = WList.end(),
          E = WList.begin(); I != E; --I) {
     const FunctionDecl *FD = (*(I-1))->getDirectCallee();
     assert(FD);
     if (VisitedFunctions[FD] == PostVisited)
-      os << " <-- " << FD->getNameAsString();
+      os << " <-- " << *FD;
   }
 
   PathDiagnosticLocation CELoc =
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 3ea08cd..ad3ac97 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -757,7 +757,7 @@
     if (isa<BlockDecl>(callee))
       Out << "Entering call to block";
     else if (const NamedDecl *ND = dyn_cast<NamedDecl>(callee))
-      Out << "Entering call to '" << ND->getNameAsString() << "'";
+      Out << "Entering call to '" << *ND << "'";
     StringRef msg = Out.str();
     if (msg.empty())
       return 0;
@@ -767,7 +767,7 @@
     const Decl *caller = CExit->getLocationContext()->getParent()->getDecl();
     pos = getLastStmtLoc(PrevN, BRC.getSourceManager());
     if (const NamedDecl *ND = dyn_cast<NamedDecl>(caller))
-      Out << "Returning to '" << ND->getNameAsString() << "'";
+      Out << "Returning to '" << *ND << "'";
     else
       Out << "Returning to caller";
     return new PathDiagnosticCallExitPiece(pos, Out.str());