[lldb-dev] Extraneous dyn_casts

Filipe Cabecinhas filcab+lldb-dev at gmail.com
Mon Jul 18 14:09:47 PDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110718/18d8007b/attachment.html>


More information about the lldb-dev mailing list