[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 10 19:37:40 UTC 2020


 compilerplugins/clang/plugin.cxx       |    5 +++--
 compilerplugins/clang/unusedfields.cxx |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 11a78fde3bb97d56561cc19a022e2635fdb76dbd
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Mar 10 18:57:36 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Mar 10 20:37:04 2020 +0100

    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 at redhat.com>

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>();
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 5f5101e85af9..e4f3f5ba7983 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -1146,9 +1146,10 @@ bool UnusedFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
 
 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>();


More information about the Libreoffice-commits mailing list