summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/plugin.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-03-10 18:57:36 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-03-10 20:37:04 +0100
commit11a78fde3bb97d56561cc19a022e2635fdb76dbd (patch)
treed087f356e6a87906dc5e74991b48e552af97d159 /compilerplugins/clang/plugin.cxx
parent17c467a66d799bda88d6cdb84b7fecbbd7d1fdf5 (diff)
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>
Diffstat (limited to 'compilerplugins/clang/plugin.cxx')
-rw-r--r--compilerplugins/clang/plugin.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index d91acf722f1a..14d8af8d65b3 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -201,9 +201,10 @@ Stmt* Plugin::getParentStmt( 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;
const Decl *decl = it->get<Decl>();