Switch StmtVisitor from using dynamic to static dispatch.  This makes it 
significantly faster and actually reduces the amount of code in the system.
This also allows for future visitor changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41211 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp
index 67a6be8..6387f66 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -26,7 +26,7 @@
 //===----------------------------------------------------------------------===//
 
 namespace  {
-  class VISIBILITY_HIDDEN StmtPrinter : public StmtVisitor {
+  class VISIBILITY_HIDDEN StmtPrinter : public StmtVisitor<StmtPrinter> {
     std::ostream &OS;
     unsigned IndentLevel;
   public:
@@ -37,10 +37,10 @@
       if (S && isa<Expr>(S)) {
         // If this is an expr used in a stmt context, indent and newline it.
         Indent();
-        S->visit(*this);
+        Visit(S);
         OS << ";\n";
       } else if (S) {
-        S->visit(*this);
+        Visit(S);
       } else {
         Indent() << "<<<NULL STATEMENT>>>\n";
       }
@@ -53,7 +53,7 @@
     
     void PrintExpr(Expr *E) {
       if (E)
-        E->visit(*this);
+        Visit(E);
       else
         OS << "<null expr>";
     }
@@ -64,9 +64,9 @@
       return OS;
     }
     
-    virtual void VisitStmt(Stmt *Node);
+    void VisitStmt(Stmt *Node);
 #define STMT(N, CLASS, PARENT) \
-    virtual void Visit##CLASS(CLASS *Node);
+    void Visit##CLASS(CLASS *Node);
 #include "clang/AST/StmtNodes.def"
   };
 }
@@ -528,5 +528,5 @@
   }
 
   StmtPrinter P(OS);
-  const_cast<Stmt*>(this)->visit(P);
+  P.Visit(const_cast<Stmt*>(this));
 }