From b169f559612d4c349939ea27192259d417b4c81f Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 21 Feb 2013 23:35:06 +0000 Subject: [PATCH] Simplify code to use castAs rather than getAs + assert. Post commit review feedback on r175812 from Jordan Rose. llvm-svn: 175826 --- clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index b27a80f..8c6eaec 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/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 ""; -- 2.7.4