From 6eec8e883de118b431e3ead5b1e604a6ac68ff6b Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 28 Oct 2008 15:36:24 +0000 Subject: [PATCH] Rename ExplicitCCastExpr to CStyleCastExpr git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58331 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/RewriteObjC.cpp | 36 ++++++++++++++++----------------- include/clang/AST/Expr.h | 18 ++++++++--------- include/clang/AST/StmtNodes.def | 2 +- lib/AST/Expr.cpp | 8 ++++---- lib/AST/StmtPrinter.cpp | 2 +- lib/AST/StmtSerialization.cpp | 10 ++++----- lib/Analysis/Environment.cpp | 2 +- lib/Analysis/GRExprEngine.cpp | 2 +- lib/Sema/SemaChecking.cpp | 2 +- lib/Sema/SemaDecl.cpp | 6 +++--- lib/Sema/SemaExpr.cpp | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 0796215a06..b5dd1796e3 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -1057,7 +1057,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, SourceLocation(), II); assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); - CastExpr *castExpr = new ExplicitCCastExpr(castT, IV->getBase(), castT, + CastExpr *castExpr = new CStyleCastExpr(castT, IV->getBase(), castT, SourceLocation()); // Don't forget the parens to enforce the proper binding. ParenExpr *PE = new ParenExpr(IV->getBase()->getLocStart(), @@ -1099,7 +1099,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, SourceLocation(), II); assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); - CastExpr *castExpr = new ExplicitCCastExpr(castT, IV->getBase(), castT, + CastExpr *castExpr = new CStyleCastExpr(castT, IV->getBase(), castT, SourceLocation()); // Don't forget the parens to enforce the proper binding. ParenExpr *PE = new ParenExpr(IV->getBase()->getLocStart(), @@ -1238,7 +1238,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { } } - if (ExplicitCCastExpr *CE = dyn_cast(S)) + if (CStyleCastExpr *CE = dyn_cast(S)) RewriteObjCQualifiedInterfaceTypes(CE); if (isa(S) || isa(S) || @@ -1560,7 +1560,7 @@ Stmt *RewriteObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) { buf += " _rethrow = objc_exception_extract(&_stack);\n"; buf += " if (!_rethrow) objc_exception_try_exit(&_stack);\n"; buf += " objc_sync_exit("; - Expr *syncExpr = new ExplicitCCastExpr(Context->getObjCIdType(), + Expr *syncExpr = new CStyleCastExpr(Context->getObjCIdType(), S->getSynchExpr(), Context->getObjCIdType(), SourceLocation()); @@ -2189,7 +2189,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { Context->getPointerType(DRE->getType()), SourceLocation()); // cast to NSConstantString * - CastExpr *cast = new ExplicitCCastExpr(Exp->getType(), Unop, + CastExpr *cast = new CStyleCastExpr(Exp->getType(), Unop, Exp->getType(), SourceLocation()); ReplaceStmt(Exp, cast); delete Exp; @@ -2326,7 +2326,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { ClsExprs.size()); // To turn off a warning, type-cast to 'id' InitExprs.push_back( // set 'super class', using objc_getClass(). - new ExplicitCCastExpr(Context->getObjCIdType(), + new CStyleCastExpr(Context->getObjCIdType(), Cls, Context->getObjCIdType(), SourceLocation())); // struct objc_super @@ -2377,7 +2377,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { llvm::SmallVector InitExprs; InitExprs.push_back( - new ExplicitCCastExpr(Context->getObjCIdType(), + new CStyleCastExpr(Context->getObjCIdType(), new DeclRefExpr(CurMethodDef->getSelfDecl(), Context->getObjCIdType(), SourceLocation()), @@ -2396,7 +2396,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // To turn off a warning, type-cast to 'id' InitExprs.push_back( // set 'super class', using objc_getClass(). - new ExplicitCCastExpr(Context->getObjCIdType(), + new CStyleCastExpr(Context->getObjCIdType(), Cls, Context->getObjCIdType(), SourceLocation())); // struct objc_super QualType superType = getSuperStructType(); @@ -2424,9 +2424,9 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { } else { // Remove all type-casts because it may contain objc-style types; e.g. // Foo *. - while (ExplicitCCastExpr *CE = dyn_cast(recExpr)) + while (CStyleCastExpr *CE = dyn_cast(recExpr)) recExpr = CE->getSubExpr(); - recExpr = new ExplicitCCastExpr(Context->getObjCIdType(), recExpr, + recExpr = new CStyleCastExpr(Context->getObjCIdType(), recExpr, Context->getObjCIdType(), SourceLocation()); MsgExprs.push_back(recExpr); @@ -2452,14 +2452,14 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { QualType type = ICE->getType()->isObjCQualifiedIdType() ? Context->getObjCIdType() : ICE->getType(); - userExpr = new ExplicitCCastExpr(type, userExpr, type, SourceLocation()); + userExpr = new CStyleCastExpr(type, userExpr, type, SourceLocation()); } // Make id cast into an 'id' cast. - else if (ExplicitCCastExpr *CE = dyn_cast(userExpr)) { + else if (CStyleCastExpr *CE = dyn_cast(userExpr)) { if (CE->getType()->isObjCQualifiedIdType()) { - while ((CE = dyn_cast(userExpr))) + while ((CE = dyn_cast(userExpr))) userExpr = CE->getSubExpr(); - userExpr = new ExplicitCCastExpr(Context->getObjCIdType(), + userExpr = new CStyleCastExpr(Context->getObjCIdType(), userExpr, Context->getObjCIdType(), SourceLocation()); } @@ -2504,7 +2504,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // If we don't do this cast, we get the following bizarre warning/note: // xx.m:13: warning: function called through a non-compatible type // xx.m:13: note: if this code is reached, the program will abort - cast = new ExplicitCCastExpr(Context->getPointerType(Context->VoidTy), DRE, + cast = new CStyleCastExpr(Context->getPointerType(Context->VoidTy), DRE, Context->getPointerType(Context->VoidTy), SourceLocation()); @@ -2514,7 +2514,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // If we don't have a method decl, force a variadic cast. Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true, 0); castType = Context->getPointerType(castType); - cast = new ExplicitCCastExpr(castType, cast, castType, SourceLocation()); + cast = new CStyleCastExpr(castType, cast, castType, SourceLocation()); // Don't forget the parens to enforce the proper binding. ParenExpr *PE = new ParenExpr(SourceLocation(), SourceLocation(), cast); @@ -2533,7 +2533,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { DeclRefExpr *STDRE = new DeclRefExpr(MsgSendStretFlavor, msgSendType, SourceLocation()); // Need to cast objc_msgSend_stret to "void *" (see above comment). - cast = new ExplicitCCastExpr(Context->getPointerType(Context->VoidTy), STDRE, + cast = new CStyleCastExpr(Context->getPointerType(Context->VoidTy), STDRE, Context->getPointerType(Context->VoidTy), SourceLocation()); // Now do the "normal" pointer to function cast. @@ -2541,7 +2541,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { &ArgTypes[0], ArgTypes.size(), Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false, 0); castType = Context->getPointerType(castType); - cast = new ExplicitCCastExpr(castType, cast, castType, SourceLocation()); + cast = new CStyleCastExpr(castType, cast, castType, SourceLocation()); // Don't forget the parens to enforce the proper binding. PE = new ParenExpr(SourceLocation(), SourceLocation(), cast); diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 79cb76012e..7acd70411c 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -799,7 +799,7 @@ public: if (SC >= CXXNamedCastExprClass && SC <= CXXFunctionalCastExprClass) return true; - if (SC >= ImplicitCastExprClass && SC <= ExplicitCCastExprClass) + if (SC >= ImplicitCastExprClass && SC <= CStyleCastExprClass) return true; return false; @@ -866,7 +866,7 @@ public: static bool classof(const Stmt *T) { StmtClass SC = T->getStmtClass(); - if (SC >= ExplicitCastExprClass && SC <= ExplicitCCastExprClass) + if (SC >= ExplicitCastExprClass && SC <= CStyleCastExprClass) return true; if (SC >= CXXNamedCastExprClass && SC <= CXXFunctionalCastExprClass) return true; @@ -876,15 +876,15 @@ public: static bool classof(const ExplicitCastExpr *) { return true; } }; -/// ExplicitCCastExpr - An explicit cast in C (C99 6.5.4) or a C-style +/// CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style /// cast in C++ (C++ [expr.cast]), which uses the syntax /// (Type)expr. For example: @c (int)f. -class ExplicitCCastExpr : public ExplicitCastExpr { +class CStyleCastExpr : public ExplicitCastExpr { SourceLocation Loc; // the location of the left paren public: - ExplicitCCastExpr(QualType exprTy, Expr *op, QualType writtenTy, + CStyleCastExpr(QualType exprTy, Expr *op, QualType writtenTy, SourceLocation l) : - ExplicitCastExpr(ExplicitCCastExprClass, exprTy, op, writtenTy), Loc(l) {} + ExplicitCastExpr(CStyleCastExprClass, exprTy, op, writtenTy), Loc(l) {} SourceLocation getLParenLoc() const { return Loc; } @@ -892,12 +892,12 @@ public: return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd()); } static bool classof(const Stmt *T) { - return T->getStmtClass() == ExplicitCCastExprClass; + return T->getStmtClass() == CStyleCastExprClass; } - static bool classof(const ExplicitCCastExpr *) { return true; } + static bool classof(const CStyleCastExpr *) { return true; } virtual void EmitImpl(llvm::Serializer& S) const; - static ExplicitCCastExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C); + static CStyleCastExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C); }; class BinaryOperator : public Expr { diff --git a/include/clang/AST/StmtNodes.def b/include/clang/AST/StmtNodes.def index a1403915c9..33d02703e4 100644 --- a/include/clang/AST/StmtNodes.def +++ b/include/clang/AST/StmtNodes.def @@ -77,7 +77,7 @@ STMT(47, CompoundAssignOperator, BinaryOperator) STMT(48, ConditionalOperator , Expr) STMT(49, ImplicitCastExpr , CastExpr) STMT(50, ExplicitCastExpr , CastExpr) -STMT(51, ExplicitCCastExpr , ExplicitCastExpr) +STMT(51, CStyleCastExpr , ExplicitCastExpr) STMT(52, CompoundLiteralExpr , Expr) STMT(53, ExtVectorElementExpr , Expr) STMT(54, InitListExpr , Expr) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index b2cf6adfc1..30e06a6de5 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -304,7 +304,7 @@ bool Expr::hasLocalSideEffect() const { return E->hasLocalSideEffect(); return false; } - case ExplicitCCastExprClass: + case CStyleCastExprClass: case CXXFunctionalCastExprClass: // If this is a cast to void, check the operand. Otherwise, the result of // the cast is unused. @@ -427,7 +427,7 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const { return cast(this)->getExpr()->isLvalue(Ctx); case CXXConditionDeclExprClass: return LV_Valid; - case ExplicitCCastExprClass: + case CStyleCastExprClass: case CXXFunctionalCastExprClass: case CXXStaticCastExprClass: case CXXDynamicCastExprClass: @@ -657,7 +657,7 @@ bool Expr::isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const { return true; } case ImplicitCastExprClass: - case ExplicitCCastExprClass: + case CStyleCastExprClass: case CXXFunctionalCastExprClass: { const Expr *SubExpr = cast(this)->getSubExpr(); SourceLocation CastLoc = getLocStart(); @@ -975,7 +975,7 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx, break; } case ImplicitCastExprClass: - case ExplicitCCastExprClass: + case CStyleCastExprClass: case CXXFunctionalCastExprClass: { const Expr *SubExpr = cast(this)->getSubExpr(); SourceLocation CastLoc = getLocStart(); diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index fb6fba399e..51f4f51807 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -710,7 +710,7 @@ void StmtPrinter::VisitCastExpr(CastExpr *) { void StmtPrinter::VisitExplicitCastExpr(ExplicitCastExpr *) { assert(0 && "ExplicitCastExpr is an abstract class"); } -void StmtPrinter::VisitExplicitCCastExpr(ExplicitCCastExpr *Node) { +void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) { OS << "(" << Node->getType().getAsString() << ")"; PrintExpr(Node->getSubExpr()); } diff --git a/lib/AST/StmtSerialization.cpp b/lib/AST/StmtSerialization.cpp index bf7cbc5e7b..8aa7e289e4 100644 --- a/lib/AST/StmtSerialization.cpp +++ b/lib/AST/StmtSerialization.cpp @@ -106,8 +106,8 @@ Stmt* Stmt::Create(Deserializer& D, ASTContext& C) { case ImplicitCastExprClass: return ImplicitCastExpr::CreateImpl(D, C); - case ExplicitCCastExprClass: - return ExplicitCCastExpr::CreateImpl(D, C); + case CStyleCastExprClass: + return CStyleCastExpr::CreateImpl(D, C); case IndirectGotoStmtClass: return IndirectGotoStmt::CreateImpl(D, C); @@ -376,19 +376,19 @@ CaseStmt* CaseStmt::CreateImpl(Deserializer& D, ASTContext& C) { return stmt; } -void ExplicitCCastExpr::EmitImpl(Serializer& S) const { +void CStyleCastExpr::EmitImpl(Serializer& S) const { S.Emit(getType()); S.Emit(getTypeAsWritten()); S.Emit(Loc); S.EmitOwnedPtr(getSubExpr()); } -ExplicitCCastExpr* ExplicitCCastExpr::CreateImpl(Deserializer& D, ASTContext& C) { +CStyleCastExpr* CStyleCastExpr::CreateImpl(Deserializer& D, ASTContext& C) { QualType t = QualType::ReadVal(D); QualType writtenTy = QualType::ReadVal(D); SourceLocation Loc = SourceLocation::ReadVal(D); Expr* Op = D.ReadOwnedPtr(C); - return new ExplicitCCastExpr(t,Op,writtenTy,Loc); + return new CStyleCastExpr(t,Op,writtenTy,Loc); } void CharacterLiteral::EmitImpl(Serializer& S) const { diff --git a/lib/Analysis/Environment.cpp b/lib/Analysis/Environment.cpp index a5f158c5d6..b5e5e2189b 100644 --- a/lib/Analysis/Environment.cpp +++ b/lib/Analysis/Environment.cpp @@ -47,7 +47,7 @@ SVal Environment::GetSVal(Expr* E, BasicValueFactory& BasicVals) const { // subexpression that has a value. case Stmt::ImplicitCastExprClass: - case Stmt::ExplicitCCastExprClass: { + case Stmt::CStyleCastExprClass: { CastExpr* C = cast(E); QualType CT = C->getType(); QualType ST = C->getSubExpr()->getType(); diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 41579ac3a7..bbeebd6858 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -345,7 +345,7 @@ void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) { break; case Stmt::ImplicitCastExprClass: - case Stmt::ExplicitCCastExprClass: { + case Stmt::CStyleCastExprClass: { CastExpr* C = cast(S); VisitCast(C, C->getSubExpr(), Pred, Dst); break; diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 3365992ff6..ac41bfc431 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -826,7 +826,7 @@ static DeclRefExpr* EvalAddr(Expr *E) { // For casts, we need to handle conversions from arrays to // pointer values, and pointer-to-pointer conversions. case Stmt::ImplicitCastExprClass: - case Stmt::ExplicitCCastExprClass: + case Stmt::CStyleCastExprClass: case Stmt::CXXFunctionalCastExprClass: { Expr* SubExpr = cast(E)->getSubExpr(); QualType T = SubExpr->getType(); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3e33172c8a..71c0ceb57f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1060,7 +1060,7 @@ bool Sema::CheckAddressConstantExpression(const Expr* Init) { CheckArithmeticConstantExpression(IExp); } case Expr::ImplicitCastExprClass: - case Expr::ExplicitCCastExprClass: { + case Expr::CStyleCastExprClass: { const Expr* SubExpr = cast(Init)->getSubExpr(); if (Init->getStmtClass() == Expr::ImplicitCastExprClass) { // Check for implicit promotion @@ -1190,7 +1190,7 @@ static const Expr* FindExpressionBaseAddress(const Expr* E) { // if we don't, we'll figure it out later return 0; } - case Expr::ExplicitCCastExprClass: { + case Expr::CStyleCastExprClass: { const Expr* SubExpr = cast(E)->getSubExpr(); // Check for pointer->pointer cast @@ -1310,7 +1310,7 @@ bool Sema::CheckArithmeticConstantExpression(const Expr* Init) { return true; } case Expr::ImplicitCastExprClass: - case Expr::ExplicitCCastExprClass: { + case Expr::CStyleCastExprClass: { const Expr *SubExpr = cast(Init)->getSubExpr(); if (SubExpr->getType()->isArithmeticType()) return CheckArithmeticConstantExpression(SubExpr); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 42f9ec727e..a4fae9117e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1327,7 +1327,7 @@ ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty, if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr)) return true; - return new ExplicitCCastExpr(castType, castExpr, castType, LParenLoc); + return new CStyleCastExpr(castType, castExpr, castType, LParenLoc); } /// Note that lex is not null here, even if this is the gnu "x ?: y" extension. -- 2.40.0