From 7ab9d574d27ecee1f130e5755aa403e5ab529b6b Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 24 Apr 2010 16:34:21 +0000 Subject: [PATCH] Rename InheritancePath to BasePath, rename CastExpr::CXXBaseVector to CXXBaseSpecifierArray. More to come. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102245 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Expr.h | 28 +++++++++++++++------------- lib/AST/Expr.cpp | 4 ++-- lib/Sema/Sema.cpp | 7 +++---- lib/Sema/Sema.h | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 87cfb81d13..fc03bde93a 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -41,6 +41,9 @@ namespace clang { class TemplateArgumentLoc; class TemplateArgumentListInfo; +/// \brief A simple array of base specifiers. +typedef UsuallyTinyPtrVector CXXBaseSpecifierArray; + /// Expr - This represents one expression. Note that Expr's are subclasses of /// Stmt. This allows an expression to be transparently used any place a Stmt /// is required. @@ -1552,8 +1555,6 @@ public: /// classes). class CastExpr : public Expr { public: - typedef UsuallyTinyPtrVector CXXBaseVector; - /// CastKind - the kind of cast this represents. enum CastKind { /// CK_Unknown - Unknown cast kind. @@ -1649,12 +1650,12 @@ public: private: CastKind Kind; Stmt *Op; - - /// InheritancePath - For derived-to-base and base-to-derived casts, the - /// base vector has the inheritance path. - CXXBaseVector *InheritancePath; - void CheckInheritancePath() const { + /// BasePath - For derived-to-base and base-to-derived casts, the base array + /// contains the inheritance path. + CXXBaseSpecifierArray *BasePath; + + void CheckBasePath() const { #ifndef NDEBUG switch (getCastKind()) { // FIXME: We should add inheritance paths for these. @@ -1686,7 +1687,7 @@ private: case CK_MemberPointerToBoolean: case CK_AnyPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: - assert(!InheritancePath && "Cast kind has inheritance path!"); + assert(!BasePath && "Cast kind shoudl not have a base path!"); break; } #endif @@ -1694,7 +1695,7 @@ private: protected: CastExpr(StmtClass SC, QualType ty, const CastKind kind, Expr *op, - CXXBaseVector *path) : + CXXBaseSpecifierArray *BasePath) : Expr(SC, ty, // Cast expressions are type-dependent if the type is // dependent (C++ [temp.dep.expr]p3). @@ -1702,8 +1703,8 @@ protected: // Cast expressions are value-dependent if the type is // dependent or if the subexpression is value-dependent. ty->isDependentType() || (op && op->isValueDependent())), - Kind(kind), Op(op), InheritancePath(path) { - CheckInheritancePath(); + Kind(kind), Op(op), BasePath(BasePath) { + CheckBasePath(); } /// \brief Construct an empty cast. @@ -1768,8 +1769,9 @@ class ImplicitCastExpr : public CastExpr { public: ImplicitCastExpr(QualType ty, CastKind kind, Expr *op, - CXXBaseVector *path, bool Lvalue) : - CastExpr(ImplicitCastExprClass, ty, kind, op, path), LvalueCast(Lvalue) { } + CXXBaseSpecifierArray *BasePath, bool Lvalue) + : CastExpr(ImplicitCastExprClass, ty, kind, op, BasePath), + LvalueCast(Lvalue) { } /// \brief Construct an empty implicit cast. explicit ImplicitCastExpr(EmptyShell Shell) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 370f33fbf3..b342507e70 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -654,8 +654,8 @@ const char *CastExpr::getCastKindName() const { void CastExpr::DoDestroy(ASTContext &C) { - if (InheritancePath) - InheritancePath->Destroy(); + if (BasePath) + BasePath->Destroy(); Expr::DoDestroy(C); } diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 62fbe94746..ad4be1a3ab 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -159,7 +159,7 @@ Sema::~Sema() { /// If isLvalue, the result of the cast is an lvalue. void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, CastExpr::CastKind Kind, - CastExpr::CXXBaseVector *InheritancePath, + CXXBaseSpecifierArray *BasePath, bool isLvalue) { QualType ExprTy = Context.getCanonicalType(Expr->getType()); QualType TypeTy = Context.getCanonicalType(Ty); @@ -180,15 +180,14 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, if (ImplicitCastExpr *ImpCast = dyn_cast(Expr)) { if (ImpCast->getCastKind() == Kind) { - assert(!InheritancePath && "FIXME: Merge paths!"); + assert(!BasePath && "FIXME: Merge paths!"); ImpCast->setType(Ty); ImpCast->setLvalueCast(isLvalue); return; } } - Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, InheritancePath, - isLvalue); + Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, BasePath, isLvalue); } void Sema::DeleteExpr(ExprTy *E) { diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index dffc7126ed..862de98e1b 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -3959,7 +3959,7 @@ public: /// 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, CastExpr::CastKind Kind, - CastExpr::CXXBaseVector *InheritancePath = 0, + CXXBaseSpecifierArray *BasePath = 0, bool isLvalue = false); // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts -- 2.40.0