[lldb-dev] Extraneous dyn_casts

Sean Callanan scallanan at apple.com
Mon Jul 18 14:31:20 PDT 2011


Filipe,

thank you for spotting this!  I have fixed the offending code.

Sean

On Jul 18, 2011, at 2:09 PM, Filipe Cabecinhas wrote:

> Hi.
> 
> In file source/Expression/ASTResultSynthesizer.cpp:98, we have:
> 
>     CompoundStmt *compound_stmt = dyn_cast<CompoundStmt>(function_body);
>     
>     bool ret = SynthesizeBodyResult (compound_stmt,
>                                      function_decl);
> 
> And, in the "SynthesizeBodyResult" function:
> 
> 
> bool 
> ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body, 
>                                             DeclContext *DC)
> {
>     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
>     
>     ASTContext &Ctx(*m_ast_context);
> 
>     
>     CompoundStmt *compound_stmt = dyn_cast<CompoundStmt>(Body);
>     
>     if (!compound_stmt)
>         return false;
> 
> 
>> 
> Can't we remove the second cast? (The method is only called in the above snippet) We can maintain the check (or check it before, right after the dyn_cast).
> 
> Regards,nbsp; Filipe
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110718/61859a9f/attachment.html>


More information about the lldb-dev mailing list