]> granicus.if.org Git - clang/commitdiff
Remove CK_DynamicToNull.
authorAnders Carlsson <andersca@mac.com>
Mon, 11 Apr 2011 02:03:26 +0000 (02:03 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 11 Apr 2011 02:03:26 +0000 (02:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129265 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
include/clang/AST/OperationKinds.h
lib/AST/Expr.cpp
lib/AST/ExprConstant.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Sema/SemaCXXCast.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp

index 4ef29642d1cc761795a009ad4ddfb5b53a5c3ca5..110c4a73235ae675e92371e5022920f83a660f69 100644 (file)
@@ -2183,7 +2183,6 @@ private:
     // These should not have an inheritance path.
     case CK_BitCast:
     case CK_Dynamic:
-    case CK_DynamicToNull:
     case CK_ToUnion:
     case CK_ArrayToPointerDecay:
     case CK_FunctionToPointerDecay:
index 6e16d2196a311bfc9cd5c1389e52b5d56bc72da0..ab9d97dbb794d4e582f66015075c9663faec6d92 100644 (file)
@@ -82,10 +82,6 @@ enum CastKind {
   /// CK_Dynamic - A C++ dynamic_cast.
   CK_Dynamic,
 
-  /// CK_DynamicToNull - A C++ dynamic_cast that can be proven to
-  /// always yield a null result.
-  CK_DynamicToNull,
-
   /// CK_ToUnion - The GCC cast-to-union extension.
   ///   int   -> union { int x; float y; }
   ///   float -> union { int x; float y; }
index 227d6569ddc74aa063d8369e87866edb4fe919a8..28f42124f984189885af0125283efc60a9741272 100644 (file)
@@ -987,8 +987,6 @@ const char *CastExpr::getCastKindName() const {
     return "UncheckedDerivedToBase";
   case CK_Dynamic:
     return "Dynamic";
-  case CK_DynamicToNull:
-    return "DynamicToNull";
   case CK_ToUnion:
     return "ToUnion";
   case CK_ArrayToPointerDecay:
index aa8d91a6d6d4da46807b3630cee89bedf8d895a2..e0f995829820fc436382917500b451f58b1a53cc 100644 (file)
@@ -1768,7 +1768,6 @@ bool IntExprEvaluator::VisitCastExpr(CastExpr *E) {
   case CK_DerivedToBase:
   case CK_UncheckedDerivedToBase:
   case CK_Dynamic:
-  case CK_DynamicToNull:
   case CK_ToUnion:
   case CK_ArrayToPointerDecay:
   case CK_FunctionToPointerDecay:
@@ -2316,7 +2315,6 @@ bool ComplexExprEvaluator::VisitCastExpr(CastExpr *E) {
   case CK_DerivedToBase:
   case CK_UncheckedDerivedToBase:
   case CK_Dynamic:
-  case CK_DynamicToNull:
   case CK_ToUnion:
   case CK_ArrayToPointerDecay:
   case CK_FunctionToPointerDecay:
index ad51316a1f5c6afeab6d822a3cc99015a904359e..a35f81ca206665c77ad1e0b25dff39f9aa67c8d8 100644 (file)
@@ -1867,8 +1867,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
     return MakeAddrLValue(V, E->getType());
   }
 
-  case CK_Dynamic:
-  case CK_DynamicToNull: {
+  case CK_Dynamic: {
     LValue LV = EmitLValue(E->getSubExpr());
     llvm::Value *V = LV.getAddress();
     const CXXDynamicCastExpr *DCE = cast<CXXDynamicCastExpr>(E);
index 5e1ac3cbacb4dadc6af11dfc0617e32e8f3d1f33..75e3a7879d42046c28642ea38e879e9ac69e3063 100644 (file)
@@ -255,10 +255,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
   }
 
   switch (E->getCastKind()) {
-  case CK_Dynamic:
-  case CK_DynamicToNull: {
-
-    // FIXME: Actually handle DynamicToNull here.
+  case CK_Dynamic: {
     assert(isa<CXXDynamicCastExpr>(E) && "CK_Dynamic without a dynamic_cast?");
     LValue LV = CGF.EmitCheckedLValue(E->getSubExpr());
     // FIXME: Do we also need to handle property references here?
index 578a37f0fcf52e431b8d82165bfb5cf47611e031..822a999b963d6af1a0f17ec14db4e2f2f31d5558 100644 (file)
@@ -552,7 +552,6 @@ public:
     case CK_GetObjCProperty:
     case CK_ToVoid:
     case CK_Dynamic:
-    case CK_DynamicToNull:
     case CK_ResolveUnknownAnyType:
       return 0;
 
index 322b6e0c498ec83911e8294c8c9373dad727f3fe..65aa46fff06de35009449a48e41e041874793bda 100644 (file)
@@ -1053,8 +1053,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
                                      CE->path_begin(), CE->path_end(),
                                      ShouldNullCheckClassCastValue(CE));
   }
-  case CK_Dynamic:
-  case CK_DynamicToNull: {
+  case CK_Dynamic: {
     Value *V = Visit(const_cast<Expr*>(E));
     const CXXDynamicCastExpr *DCE = cast<CXXDynamicCastExpr>(CE);
     return CGF.EmitDynamicCast(V, DCE);
index 52a13ef5b2981bb9e54ed683d18363a2bfc13ef7..31a772a5d8ef7f28cc2084f92b4f21923d399f56 100644 (file)
@@ -522,14 +522,6 @@ CheckDynamicCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
     return;
   }
 
-  // If the source class is marked 'final', and the destination class does not
-  // derive from the source class, then we know that the result is always null.
-  if (SrcRecord->getDecl()->hasAttr<FinalAttr>() &&
-      !Self.IsDerivedFrom(DestPointee, SrcPointee)) {
-    Kind = CK_DynamicToNull;
-    return;
-  }
-
   // C++ 5.2.7p5
   // Upcasts are resolved statically.
   if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) {
index 6a7637097b0c7a67c0967325e340e392cb75680b..0a7f1e93af19d75d66fdd28997c5608a9c2adf77 100644 (file)
@@ -2178,7 +2178,6 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
       // Various C++ casts that are not handled yet.
       case CK_ResolveUnknownAnyType:
       case CK_Dynamic:
-      case CK_DynamicToNull:
       case CK_ToUnion:
       case CK_BaseToDerived:
       case CK_NullToMemberPointer: