diff options
author | John McCall <rjmccall@apple.com> | 2010-11-16 05:46:29 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-11-16 05:46:29 +0000 |
commit | e2b768877b77fa4e00171ee6e6443722e0f3d111 (patch) | |
tree | 725aced6f8c3f08f6a566c42cc480672a0694ead /lib | |
parent | 641ca7d01441c34566756744838abb8faf1356aa (diff) |
Kill CK_Unknown and flesh out the documentation for the existing CastKinds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/Expr.cpp | 2 | ||||
-rw-r--r-- | lib/AST/ExprConstant.cpp | 29 | ||||
-rw-r--r-- | lib/Checker/GRExprEngine.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 2 |
8 files changed, 2 insertions, 44 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 6ae334ed25..e36c02f3a9 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -740,8 +740,6 @@ MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow, const char *CastExpr::getCastKindName() const { switch (getCastKind()) { - case CK_Unknown: - return "Unknown"; case CK_Dependent: return "Dependent"; case CK_BitCast: diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index d0b4c31937..f4685933dc 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -532,35 +532,6 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) { default: break; - case CK_Unknown: { - // FIXME: The handling for CK_Unknown is ugly/shouldn't be necessary! - - // Check for pointer->pointer cast - if (SubExpr->getType()->isPointerType() || - SubExpr->getType()->isObjCObjectPointerType() || - SubExpr->getType()->isNullPtrType() || - SubExpr->getType()->isBlockPointerType()) - return Visit(SubExpr); - - if (SubExpr->getType()->isIntegralOrEnumerationType()) { - APValue Value; - if (!EvaluateIntegerOrLValue(SubExpr, Value, Info)) - break; - - if (Value.isInt()) { - Value.getInt().extOrTrunc((unsigned)Info.Ctx.getTypeSize(E->getType())); - Result.Base = 0; - Result.Offset = CharUnits::fromQuantity(Value.getInt().getZExtValue()); - return true; - } else { - Result.Base = Value.getLValueBase(); - Result.Offset = Value.getLValueOffset(); - return true; - } - } - break; - } - case CK_NoOp: case CK_BitCast: case CK_LValueBitCast: diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index d5c9ffa0af..017a6959cc 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -2541,7 +2541,6 @@ void GRExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, } return; - case CK_Unknown: case CK_Dependent: case CK_ArrayToPointerDecay: case CK_BitCast: diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index ac40f3d580..2ef22b2401 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1804,7 +1804,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { } // Fall through to synthesize a temporary. - case CK_Unknown: case CK_BitCast: case CK_ArrayToPointerDecay: case CK_FunctionToPointerDecay: diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 31ba3373f0..00cfb21447 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -285,8 +285,6 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { break; } - // FIXME: Remove the CK_Unknown check here. - case CK_Unknown: case CK_NoOp: case CK_UserDefinedConversion: case CK_ConstructorConversion: diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 183afbe72b..98676d9ff7 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -999,11 +999,6 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) { switch (Kind) { case CK_Dependent: llvm_unreachable("dependent cast kind in IR gen!"); - case CK_Unknown: - // FIXME: All casts should have a known kind! - //assert(0 && "Unknown cast kind!"); - break; - case CK_LValueBitCast: case CK_ObjCObjectLValueCast: { Value *V = EmitLValue(E).getAddress(); diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index e8e9deddc2..e57e89e4a4 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -526,7 +526,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType, Self.Diag(OpRange.getBegin(), msg) << CT_Static << SrcExpr->getType() << DestType << OpRange; } - else if (Kind == CK_Unknown || Kind == CK_BitCast) + else if (Kind == CK_BitCast) Self.CheckCastAlign(SrcExpr, DestType, OpRange); } @@ -1413,7 +1413,7 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr, << CastExpr->getType() << CastTy << R; } } - else if (Kind == CK_Unknown || Kind == CK_BitCast) + else if (Kind == CK_BitCast) CheckCastAlign(CastExpr, CastTy, R); return tcr != TC_Success; diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index e11d68ca19..83d7c0760e 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2280,8 +2280,6 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) { IntRange OutputTypeRange = IntRange::forValueOfType(C, CE->getType()); bool isIntegerCast = (CE->getCastKind() == CK_IntegralCast); - if (!isIntegerCast && CE->getCastKind() == CK_Unknown) - isIntegerCast = CE->getSubExpr()->getType()->isIntegerType(); // Assume that non-integer casts can span the full range of the type. if (!isIntegerCast) |