[Lldb-commits] [PATCH] D59314: Fix an invalid static cast in ClangExpressionParser.cpp

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 13 11:46:08 PDT 2019


jingham added a comment.

I think you have to protect against your dyn_cast failing.



================
Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:495
 
-  auto &clang_expr = *static_cast<ClangUserExpression *>(&m_expr);
-  if (clang_expr.DidImportCxxModules()) {
+  auto *clang_expr = dyn_cast<ClangUserExpression>(&m_expr);
+  if (clang_expr->DidImportCxxModules()) {
----------------
Don't you need to check the result of the dyn_cast?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59314/new/

https://reviews.llvm.org/D59314





More information about the lldb-commits mailing list