Author: Simon Pilgrim Date: 2022-01-23T15:11:08Z New Revision: d7aa402b4b8a325a68c20d0300ac6bc664766be0
URL: https://github.com/llvm/llvm-project/commit/d7aa402b4b8a325a68c20d0300ac6bc664766be0 DIFF: https://github.com/llvm/llvm-project/commit/d7aa402b4b8a325a68c20d0300ac6bc664766be0.diff LOG: [lldb] PdbAstBuilder - use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp index 9473befa6cc34..dc0969a0ce7c6 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -1081,7 +1081,7 @@ PdbAstBuilder::GetOrCreateFunctionDecl(PdbCompilandSymId func_id) { clang::FunctionDecl *function_decl = nullptr; if (parent->isRecord()) { - clang::QualType parent_qt = llvm::dyn_cast<clang::TypeDecl>(parent) + clang::QualType parent_qt = llvm::cast<clang::TypeDecl>(parent) ->getTypeForDecl() ->getCanonicalTypeInternal(); lldb::opaque_compiler_type_t parent_opaque_ty = @@ -1318,7 +1318,7 @@ void PdbAstBuilder::ParseAllNamespacesPlusChildrenOf( if (!context->isNamespace()) continue; - clang::NamespaceDecl *ns = llvm::dyn_cast<clang::NamespaceDecl>(context); + clang::NamespaceDecl *ns = llvm::cast<clang::NamespaceDecl>(context); std::string actual_ns = ns->getQualifiedNameAsString(); if (llvm::StringRef(actual_ns).startswith(*parent)) { clang::QualType qt = GetOrCreateType(tid); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits