From 2fdacbc5b07d46b78710574e8817e58899ae8948 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 20 Feb 2013 05:52:05 +0000 Subject: Replace SVal llvm::cast support to be well-defined. See r175462 for another example/more details. llvm-svn: 175594 --- clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp index de73dd7c3e0..69a5052e900 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp @@ -103,8 +103,9 @@ void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S, // Handle the case where the container has no elements. SVal FalseV = svalBuilder.makeTruthVal(0); ProgramStateRef noElems = state->BindExpr(S, LCtx, FalseV); - - if (loc::MemRegionVal *MV = dyn_cast(&elementV)) + + if (llvm::Optional MV = + elementV.getAs()) if (const TypedValueRegion *R = dyn_cast(MV->getRegion())) { // FIXME: The proper thing to do is to really iterate over the @@ -161,8 +162,9 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME, SVal recVal = UpdatedMsg->getReceiverSVal(); if (!recVal.isUndef()) { // Bifurcate the state into nil and non-nil ones. - DefinedOrUnknownSVal receiverVal = cast(recVal); - + DefinedOrUnknownSVal receiverVal = + recVal.castAs(); + ProgramStateRef notNilState, nilState; llvm::tie(notNilState, nilState) = State->assume(receiverVal); -- cgit v1.2.3