]> granicus.if.org Git - clang/commitdiff
Some refactoring on StmtPrinter to avoid unused function warnings.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Aug 2010 01:15:33 +0000 (01:15 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Aug 2010 01:15:33 +0000 (01:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111088 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtPrinter.cpp

index be7fdb56567b12df5f787ec5b52495cae89eafc1..7f497a3d60f6782a478091611a35d195043c1329 100644 (file)
@@ -82,8 +82,16 @@ namespace  {
           return;
       else StmtVisitor<StmtPrinter>::Visit(S);
     }
+    
+    void VisitStmt(Stmt *Node) ATTRIBUTE_UNUSED {
+      Indent() << "<<unknown stmt type>>\n";
+    }
+    void VisitExpr(Expr *Node) ATTRIBUTE_UNUSED {
+      OS << "<<unknown expr type>>";
+    }
+    void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
 
-    void VisitStmt(Stmt *Node);
+#define ABSTRACT_STMT(CLASS)
 #define STMT(CLASS, PARENT) \
     void Visit##CLASS(CLASS *Node);
 #include "clang/AST/StmtNodes.inc"
@@ -94,10 +102,6 @@ namespace  {
 //  Stmt printing methods.
 //===----------------------------------------------------------------------===//
 
-void StmtPrinter::VisitStmt(Stmt *Node) {
-  Indent() << "<<unknown stmt type>>\n";
-}
-
 /// PrintRawCompoundStmt - Print a compound stmt without indenting the {, and
 /// with no newline after the }.
 void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
@@ -462,10 +466,6 @@ void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
 //  Expr printing methods.
 //===----------------------------------------------------------------------===//
 
-void StmtPrinter::VisitExpr(Expr *Node) {
-  OS << "<<unknown expr type>>";
-}
-
 void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
   if (NestedNameSpecifier *Qualifier = Node->getQualifier())
     Qualifier->print(OS, Policy);
@@ -767,12 +767,6 @@ void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
   OS << ".";
   OS << Node->getAccessor().getName();
 }
-void StmtPrinter::VisitCastExpr(CastExpr *) {
-  assert(0 && "CastExpr is an abstract class");
-}
-void StmtPrinter::VisitExplicitCastExpr(ExplicitCastExpr *) {
-  assert(0 && "ExplicitCastExpr is an abstract class");
-}
 void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
   OS << "(" << Node->getType().getAsString(Policy) << ")";
   PrintExpr(Node->getSubExpr());