Author: Simon Pilgrim Date: 2022-01-23T15:10:33Z New Revision: c93491352cf3146559de7755283f0dd259392126
URL: https://github.com/llvm/llvm-project/commit/c93491352cf3146559de7755283f0dd259392126 DIFF: https://github.com/llvm/llvm-project/commit/c93491352cf3146559de7755283f0dd259392126.diff LOG: [lldb] CxxModuleHandler - use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp index 74dd04600b4be..fecffd1183f89 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp @@ -138,7 +138,7 @@ getEqualLocalDeclContext(Sema &sema, DeclContext *foreign_ctxt) { // We currently only support building namespaces. if (foreign_ctxt->isNamespace()) { - NamedDecl *ns = llvm::dyn_cast<NamedDecl>(foreign_ctxt); + NamedDecl *ns = llvm::cast<NamedDecl>(foreign_ctxt); llvm::StringRef ns_name = ns->getName(); auto lookup_result = emulateLookupInCtxt(sema, ns_name, *parent); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits