Deref of DynTypedNode* must not outlive owning DynTypedNodeList
Change-Id: I8ac4a2f1e442446384b88f38bdef21644409f8a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90303 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -201,9 +201,10 @@ Stmt* Plugin::getParentStmt( Stmt* stmt )
|
|||||||
|
|
||||||
static const Decl* getFunctionDeclContext(ASTContext& context, const Stmt* stmt)
|
static const Decl* getFunctionDeclContext(ASTContext& context, const Stmt* stmt)
|
||||||
{
|
{
|
||||||
auto it = context.getParents(*stmt).begin();
|
auto const parents = context.getParents(*stmt);
|
||||||
|
auto it = parents.begin();
|
||||||
|
|
||||||
if (it == context.getParents(*stmt).end())
|
if (it == parents.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const Decl *decl = it->get<Decl>();
|
const Decl *decl = it->get<Decl>();
|
||||||
|
@@ -1146,9 +1146,10 @@ bool UnusedFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
|
|||||||
|
|
||||||
static const Decl* getFunctionDeclContext(ASTContext& context, const Stmt* stmt)
|
static const Decl* getFunctionDeclContext(ASTContext& context, const Stmt* stmt)
|
||||||
{
|
{
|
||||||
auto it = context.getParents(*stmt).begin();
|
auto const parents = context.getParents(*stmt);
|
||||||
|
auto it = parents.begin();
|
||||||
|
|
||||||
if (it == context.getParents(*stmt).end())
|
if (it == parents.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const Decl *decl = it->get<Decl>();
|
const Decl *decl = it->get<Decl>();
|
||||||
|
Reference in New Issue
Block a user