Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170634 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index 572e3d0..4a7344c 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file implements the Decl::dump method, which pretty print the
+// This file implements the Decl::print method, which pretty prints the
 // AST back out to C/Objective-C/C++/Objective-C++ code.
 //
 //===----------------------------------------------------------------------===//
@@ -176,16 +176,6 @@
   Printer.VisitDeclContext(const_cast<DeclContext *>(this), /*Indent=*/false);
 }
 
-void Decl::dump() const {
-  dump(llvm::errs());
-}
-
-void Decl::dump(raw_ostream &Out) const {
-  PrintingPolicy Policy = getASTContext().getPrintingPolicy();
-  Policy.DumpSourceManager = &getASTContext().getSourceManager();
-  print(Out, Policy, /*Indentation*/ 0, /*PrintInstantiation*/ true);
-}
-
 raw_ostream& DeclPrinter::Indent(unsigned Indentation) {
   for (unsigned i = 0; i != Indentation; ++i)
     Out << "  ";
@@ -242,18 +232,18 @@
     if (isa<ObjCIvarDecl>(*D))
       continue;
 
-    if (!Policy.DumpSourceManager) {
-      // Skip over implicit declarations in pretty-printing mode.
-      if (D->isImplicit()) continue;
-      // FIXME: Ugly hack so we don't pretty-print the builtin declaration
-      // of __builtin_va_list or __[u]int128_t.  There should be some other way
-      // to check that.
-      if (NamedDecl *ND = dyn_cast<NamedDecl>(*D)) {
-        if (IdentifierInfo *II = ND->getIdentifier()) {
-          if (II->isStr("__builtin_va_list") ||
-              II->isStr("__int128_t") || II->isStr("__uint128_t"))
-            continue;
-        }
+    // Skip over implicit declarations in pretty-printing mode.
+    if (D->isImplicit())
+      continue;
+
+    // FIXME: Ugly hack so we don't pretty-print the builtin declaration
+    // of __builtin_va_list or __[u]int128_t.  There should be some other way
+    // to check that.
+    if (NamedDecl *ND = dyn_cast<NamedDecl>(*D)) {
+      if (IdentifierInfo *II = ND->getIdentifier()) {
+        if (II->isStr("__builtin_va_list") ||
+            II->isStr("__int128_t") || II->isStr("__uint128_t"))
+          continue;
       }
     }