]> granicus.if.org Git - clang/commitdiff
Get rid of the CastInfo struct.
authorAnders Carlsson <andersca@mac.com>
Tue, 15 Sep 2009 05:13:45 +0000 (05:13 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 15 Sep 2009 05:13:45 +0000 (05:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81839 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
include/clang/AST/ExprCXX.h
lib/Sema/Sema.cpp
lib/Sema/Sema.h

index 3e122c1f53a6a6946148613a102d582f53f319da..7b60c00d5ba5196bc24f2e11351edb6a08855c89 100644 (file)
@@ -1377,20 +1377,11 @@ public:
     CK_PointerToIntegral
   };
 
-  struct CastInfo {
-    const CastKind Kind;
-
-    // FIXME: This should assert that the CastKind does not require extra
-    // information.
-    CastInfo(CastKind Kind)
-      : Kind(Kind) { }
-  };
-
 private:
   CastKind Kind;
   Stmt *Op;
 protected:
-  CastExpr(StmtClass SC, QualType ty, const CastInfo &info, Expr *op) :
+  CastExpr(StmtClass SC, QualType ty, const CastKind kind, Expr *op) :
     Expr(SC, ty,
          // Cast expressions are type-dependent if the type is
          // dependent (C++ [temp.dep.expr]p3).
@@ -1398,7 +1389,7 @@ protected:
          // Cast expressions are value-dependent if the type is
          // dependent or if the subexpression is value-dependent.
          ty->isDependentType() || (op && op->isValueDependent())),
-    Kind(info.Kind), Op(op) {}
+    Kind(kind), Op(op) {}
 
   /// \brief Construct an empty cast.
   CastExpr(StmtClass SC, EmptyShell Empty)
@@ -1451,8 +1442,8 @@ class ImplicitCastExpr : public CastExpr {
   bool LvalueCast;
 
 public:
-  ImplicitCastExpr(QualType ty, const CastInfo &info, Expr *op, bool Lvalue) :
-    CastExpr(ImplicitCastExprClass, ty, info, op), LvalueCast(Lvalue) { }
+  ImplicitCastExpr(QualType ty, CastKind kind, Expr *op, bool Lvalue) :
+    CastExpr(ImplicitCastExprClass, ty, kind, op), LvalueCast(Lvalue) { }
 
   /// \brief Construct an empty implicit cast.
   explicit ImplicitCastExpr(EmptyShell Shell)
@@ -1497,9 +1488,9 @@ class ExplicitCastExpr : public CastExpr {
   QualType TypeAsWritten;
 
 protected:
-  ExplicitCastExpr(StmtClass SC, QualType exprTy, const CastInfo &info,
+  ExplicitCastExpr(StmtClass SC, QualType exprTy, CastKind kind,
                    Expr *op, QualType writtenTy)
-    : CastExpr(SC, exprTy, info, op), TypeAsWritten(writtenTy) {}
+    : CastExpr(SC, exprTy, kind, op), TypeAsWritten(writtenTy) {}
 
   /// \brief Construct an empty explicit cast.
   ExplicitCastExpr(StmtClass SC, EmptyShell Shell)
index 5e3dec770574bc1854965d372c7877fe1d542c31..0435d21483b0acf6337266ab03cac49d16f00437 100644 (file)
@@ -113,9 +113,9 @@ private:
   SourceLocation Loc; // the location of the casting op
 
 protected:
-  CXXNamedCastExpr(StmtClass SC, QualType ty, const CastInfo &info, Expr *op,
+  CXXNamedCastExpr(StmtClass SC, QualType ty, CastKind kind, Expr *op,
                    QualType writtenTy, SourceLocation l)
-    : ExplicitCastExpr(SC, ty, info, op, writtenTy), Loc(l) {}
+    : ExplicitCastExpr(SC, ty, kind, op, writtenTy), Loc(l) {}
 
 public:
   const char *getCastName() const;
@@ -149,9 +149,9 @@ public:
 /// @c static_cast<int>(1.0).
 class CXXStaticCastExpr : public CXXNamedCastExpr {
 public:
-  CXXStaticCastExpr(QualType ty, const CastInfo &info, Expr *op,
+  CXXStaticCastExpr(QualType ty, CastKind kind, Expr *op,
                     QualType writtenTy, SourceLocation l)
-    : CXXNamedCastExpr(CXXStaticCastExprClass, ty, info, op, writtenTy, l) {}
+    : CXXNamedCastExpr(CXXStaticCastExprClass, ty, kind, op, writtenTy, l) {}
 
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXStaticCastExprClass;
index 080266c75fb65333c1d7af0a535e20ba195587ae..474ea16e57f9fbb145fc2fcd7195ef4e52c80e48 100644 (file)
@@ -210,7 +210,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
 /// If there is already an implicit cast, merge into the existing one.
 /// If isLvalue, the result of the cast is an lvalue.
 void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
-                             const CastExpr::CastInfo &Info, bool isLvalue) {
+                             CastExpr::CastKind Kind, bool isLvalue) {
   QualType ExprTy = Context.getCanonicalType(Expr->getType());
   QualType TypeTy = Context.getCanonicalType(Ty);
 
@@ -233,8 +233,7 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
     ImpCast->setType(Ty);
     ImpCast->setLvalueCast(isLvalue);
   } else
-    Expr = new (Context) ImplicitCastExpr(Ty, Info, Expr,
-                                          isLvalue);
+    Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
 }
 
 void Sema::DeleteExpr(ExprTy *E) {
index d2034ce246e35a372dd23296216571bce85760fc..bb2a5b229c893bf83a5fe790130bfaee688a872b 100644 (file)
@@ -3289,9 +3289,8 @@ public:
   /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
   /// cast.  If there is already an implicit cast, merge into the existing one.
   /// If isLvalue, the result of the cast is an lvalue.
-  void ImpCastExprToType(Expr *&Expr, QualType Type,
-                         const CastExpr::CastInfo &Info =
-                         CastExpr::CastInfo(CastExpr::CK_Unknown),
+  void ImpCastExprToType(Expr *&Expr, QualType Type, 
+                         CastExpr::CastKind Kind = CastExpr::CK_Unknown,
                          bool isLvalue = false);
 
   // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts