[cfe-commits] r95176 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/AST/Stmt.h include/clang/AST/StmtNodes.def include/clang/AST/StmtVisitor.h include/clang/Checker/PathSensitive/CheckerVisitor.def include/clang/Checker/PathSensitive/CheckerVisitor.h lib/AST/Expr.cpp lib/AST/Stmt.cpp lib/CodeGen/Mangle.cpp lib/Sema/TreeTransform.h tools/CIndex/CXCursor.cpp

John McCall rjmccall at apple.com
Tue Feb 2 16:55:45 PST 2010


Author: rjmccall
Date: Tue Feb  2 18:55:45 2010
New Revision: 95176

URL: http://llvm.org/viewvc/llvm-project?rev=95176&view=rev
Log:
Remove abstract expression kinds from the StmtClass enum.  Update a few users
appropriately.  Call out a few missing cases in the expression mangler.


Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/include/clang/AST/StmtNodes.def
    cfe/trunk/include/clang/AST/StmtVisitor.h
    cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.def
    cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/AST/Stmt.cpp
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/tools/CIndex/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Tue Feb  2 18:55:45 2010
@@ -1748,7 +1748,7 @@
 
   static bool classof(const Stmt *T) {
     StmtClass SC = T->getStmtClass();
-    if (SC >= ExplicitCastExprClass && SC <= CStyleCastExprClass)
+    if (SC >= CStyleCastExprClass && SC <= CStyleCastExprClass)
       return true;
     if (SC >= CXXNamedCastExprClass && SC <= CXXFunctionalCastExprClass)
       return true;

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Tue Feb  2 18:55:45 2010
@@ -102,6 +102,7 @@
 #define LAST_STMT(CLASS) lastStmtConstant = CLASS##Class,
 #define FIRST_EXPR(CLASS) firstExprConstant = CLASS##Class,
 #define LAST_EXPR(CLASS) lastExprConstant = CLASS##Class
+#define ABSTRACT_EXPR(CLASS, PARENT)
 #include "clang/AST/StmtNodes.def"
 };
 private:

Modified: cfe/trunk/include/clang/AST/StmtNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtNodes.def?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/StmtNodes.def (original)
+++ cfe/trunk/include/clang/AST/StmtNodes.def Tue Feb  2 18:55:45 2010
@@ -68,8 +68,7 @@
 LAST_STMT(CXXTryStmt)
 
 // Expressions.
-ABSTRACT_EXPR(Expr                  , Stmt)
-FIRST_EXPR(Expr)
+ABSTRACT_EXPR(Expr         , Stmt)
 EXPR(PredefinedExpr        , Expr)
 EXPR(DeclRefExpr           , Expr)
 EXPR(IntegerLiteral        , Expr)
@@ -83,12 +82,12 @@
 EXPR(ArraySubscriptExpr    , Expr)
 EXPR(CallExpr              , Expr)
 EXPR(MemberExpr            , Expr)
-EXPR(CastExpr              , Expr)
+ABSTRACT_EXPR(CastExpr     , Expr)
 EXPR(BinaryOperator        , Expr)
 EXPR(CompoundAssignOperator, BinaryOperator)
 EXPR(ConditionalOperator   , Expr)
 EXPR(ImplicitCastExpr      , CastExpr)
-EXPR(ExplicitCastExpr      , CastExpr)
+ABSTRACT_EXPR(ExplicitCastExpr, CastExpr)
 EXPR(CStyleCastExpr        , ExplicitCastExpr)
 EXPR(CompoundLiteralExpr   , Expr)
 EXPR(ExtVectorElementExpr  , Expr)
@@ -153,6 +152,7 @@
 EXPR(BlockExpr            , Expr)
 EXPR(BlockDeclRefExpr     , Expr)
 
+FIRST_EXPR(PredefinedExpr)
 LAST_EXPR(BlockDeclRefExpr)
 
 #undef ABSTRACT_EXPR

Modified: cfe/trunk/include/clang/AST/StmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtVisitor.h?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/StmtVisitor.h (original)
+++ cfe/trunk/include/clang/AST/StmtVisitor.h Tue Feb  2 18:55:45 2010
@@ -105,6 +105,7 @@
     // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
     switch (S->getStmtClass()) {
     default: assert(0 && "Unknown stmt kind!");
+#define ABSTRACT_EXPR(CLASS, PARENT)
 #define STMT(CLASS, PARENT)                              \
     case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS);
 #include "clang/AST/StmtNodes.def"

Modified: cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.def?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.def (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.def Tue Feb  2 18:55:45 2010
@@ -22,7 +22,6 @@
 PREVISIT(ArraySubscriptExpr, Stmt)
 PREVISIT(BinaryOperator, Stmt)
 PREVISIT(CallExpr, Stmt)
-PREVISIT(CastExpr, Stmt)
 PREVISIT(CXXOperatorCallExpr, CallExpr)
 PREVISIT(DeclStmt, Stmt)
 PREVISIT(ObjCMessageExpr, Stmt)

Modified: cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.h?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/CheckerVisitor.h Tue Feb  2 18:55:45 2010
@@ -42,7 +42,6 @@
         return;
 
       case Stmt::ImplicitCastExprClass:
-      case Stmt::ExplicitCastExprClass:
       case Stmt::CStyleCastExprClass:
         static_cast<ImplClass*>(this)->PreVisitCastExpr(C,
                                                static_cast<const CastExpr*>(S));
@@ -82,16 +81,18 @@
 
   void PreVisitStmt(CheckerContext &C, const Stmt *S) {}
   void PostVisitStmt(CheckerContext &C, const Stmt *S) {}
+
+  void PreVisitCastExpr(CheckerContext &C, const CastExpr *E) {
+    static_cast<ImplClass*>(this)->PreVisitStmt(C, E);
+  }
   
 #define PREVISIT(NAME, FALLBACK) \
 void PreVisit ## NAME(CheckerContext &C, const NAME* S) {\
-  PreVisit ## FALLBACK(C, S);\
+  static_cast<ImplClass*>(this)->PreVisit ## FALLBACK(C, S);\
 }
-#include "clang/Checker/PathSensitive/CheckerVisitor.def"
-      
 #define POSTVISIT(NAME, FALLBACK) \
 void PostVisit ## NAME(CheckerContext &C, const NAME* S) {\
-  PostVisit ## FALLBACK(C, S);\
+  static_cast<ImplClass*>(this)->PostVisit ## FALLBACK(C, S);\
 }
 #include "clang/Checker/PathSensitive/CheckerVisitor.def"
 };

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Feb  2 18:55:45 2010
@@ -1616,7 +1616,6 @@
   case Expr::BlockExprClass:
   case Expr::BlockDeclRefExprClass:
   case Expr::NoStmtClass:
-  case Expr::ExprClass:
     return ICEDiag(2, E->getLocStart());
 
   case Expr::GNUNullExprClass:
@@ -1812,9 +1811,7 @@
     }
     }
   }
-  case Expr::CastExprClass:
   case Expr::ImplicitCastExprClass:
-  case Expr::ExplicitCastExprClass:
   case Expr::CStyleCastExprClass:
   case Expr::CXXFunctionalCastExprClass:
   case Expr::CXXNamedCastExprClass:

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Tue Feb  2 18:55:45 2010
@@ -35,6 +35,7 @@
 
   // Intialize the table on the first use.
   Initialized = true;
+#define ABSTRACT_EXPR(CLASS, PARENT)
 #define STMT(CLASS, PARENT) \
   StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS;    \
   StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Tue Feb  2 18:55:45 2010
@@ -1056,21 +1056,38 @@
 
 void CXXNameMangler::mangleExpression(const Expr *E) {
   // <expression> ::= <unary operator-name> <expression>
-	//              ::= <binary operator-name> <expression> <expression>
-	//              ::= <trinary operator-name> <expression> <expression> <expression>
-  //              ::= cl <expression>* E	        # call
+  //              ::= <binary operator-name> <expression> <expression>
+  //              ::= <trinary operator-name> <expression> <expression> <expression>
+  //              ::= cl <expression>* E	     # call
   //              ::= cv <type> expression           # conversion with one argument
   //              ::= cv <type> _ <expression>* E # conversion with a different number of arguments
-  //              ::= st <type>		        # sizeof (a type)
+  //              ::= st <type>		             # sizeof (a type)
   //              ::= at <type>                      # alignof (a type)
   //              ::= <template-param>
   //              ::= <function-param>
   //              ::= sr <type> <unqualified-name>                   # dependent name
   //              ::= sr <type> <unqualified-name> <template-args>   # dependent template-id
   //              ::= sZ <template-param>                            # size of a parameter pack
-	//              ::= <expr-primary>
+  //              ::= <expr-primary>
   switch (E->getStmtClass()) {
-  default: assert(false && "Unhandled expression kind!");
+  default:
+    llvm_unreachable("unexpected statement kind");
+    break;
+
+  case Expr::CallExprClass:
+    // FIXME: implement
+    llvm_unreachable("mangling not implemented for calls");
+    break;
+
+  case Expr::CXXConstructExprClass:
+    // FIXME: implement
+    llvm_unreachable("mangling not implemented for construct exprs");
+    break;    
+
+  case Expr::SizeOfAlignOfExprClass:
+    // FIXME: implement
+    llvm_unreachable("mangling not implemented for sizeof/alignof");
+    break;
 
   case Expr::UnaryOperatorClass: {
     const UnaryOperator *UO = cast<UnaryOperator>(E);

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Feb  2 18:55:45 2010
@@ -1684,6 +1684,7 @@
 
   // Transform expressions by calling TransformExpr.
 #define STMT(Node, Parent)
+#define ABSTRACT_EXPR(Node, Parent)
 #define EXPR(Node, Parent) case Stmt::Node##Class:
 #include "clang/AST/StmtNodes.def"
     {
@@ -1707,6 +1708,7 @@
   switch (E->getStmtClass()) {
     case Stmt::NoStmtClass: break;
 #define STMT(Node, Parent) case Stmt::Node##Class: break;
+#define ABSTRACT_EXPR(Node, Parent)
 #define EXPR(Node, Parent)                                              \
     case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
 #include "clang/AST/StmtNodes.def"
@@ -3829,13 +3831,6 @@
 
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCastExpr(CastExpr *E) {
-  assert(false && "Cannot transform abstract class");
-  return SemaRef.Owned(E->Retain());
-}
-
-template<typename Derived>
-Sema::OwningExprResult
 TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
   OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
   if (LHS.isInvalid())
@@ -3899,13 +3894,6 @@
 
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformExplicitCastExpr(ExplicitCastExpr *E) {
-  assert(false && "Cannot transform abstract class");
-  return SemaRef.Owned(E->Retain());
-}
-
-template<typename Derived>
-Sema::OwningExprResult
 TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
   TypeSourceInfo *OldT;
   TypeSourceInfo *NewT;

Modified: cfe/trunk/tools/CIndex/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.cpp?rev=95176&r1=95175&r2=95176&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.cpp (original)
+++ cfe/trunk/tools/CIndex/CXCursor.cpp Tue Feb  2 18:55:45 2010
@@ -115,7 +115,6 @@
     K = CXCursor_UnexposedStmt;
     break;
       
-  case Stmt::ExprClass:
   case Stmt::PredefinedExprClass:        
   case Stmt::IntegerLiteralClass:        
   case Stmt::FloatingLiteralClass:       
@@ -126,12 +125,10 @@
   case Stmt::UnaryOperatorClass:         
   case Stmt::SizeOfAlignOfExprClass:     
   case Stmt::ArraySubscriptExprClass:    
-  case Stmt::CastExprClass:              
   case Stmt::BinaryOperatorClass:        
   case Stmt::CompoundAssignOperatorClass:
   case Stmt::ConditionalOperatorClass:   
   case Stmt::ImplicitCastExprClass:
-  case Stmt::ExplicitCastExprClass:
   case Stmt::CStyleCastExprClass:
   case Stmt::CompoundLiteralExprClass:   
   case Stmt::ExtVectorElementExprClass:  





More information about the cfe-commits mailing list