Commit d7aa402b authored by Simon Pilgrim's avatar Simon Pilgrim
Browse files

[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
parent c9349135
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment