From: David Blaikie Date: Thu, 21 Feb 2013 23:35:06 +0000 (+0000) Subject: Simplify code to use castAs rather than getAs + assert. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df1f94ebfac4578e27ad008522c7b333e977e51b;p=clang Simplify code to use castAs rather than getAs + assert. Post commit review feedback on r175812 from Jordan Rose. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175826 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index b27a80f93c..8c6eaec1b5 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -993,11 +993,10 @@ StackHintGenerator::~StackHintGenerator() {} std::string StackHintGeneratorForSymbol::getMessage(const ExplodedNode *N){ ProgramPoint P = N->getLocation(); - Optional CExit = P.getAs(); - assert(CExit && "Stack Hints should be constructed at CallExitEnd points."); + CallExitEnd CExit = P.castAs(); // FIXME: Use CallEvent to abstract this over all calls. - const Stmt *CallSite = CExit->getCalleeContext()->getCallSite(); + const Stmt *CallSite = CExit.getCalleeContext()->getCallSite(); const CallExpr *CE = dyn_cast_or_null(CallSite); if (!CE) return "";