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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 27 21:01:21 UTC 2020


 compilerplugins/clang/constfields.cxx        |    7 +++++++
 compilerplugins/clang/constmethod.cxx        |    6 ++++++
 compilerplugins/clang/constparams.cxx        |    6 ++++++
 compilerplugins/clang/constvars.cxx          |    7 +++++++
 compilerplugins/clang/plugin.cxx             |    6 ++++++
 compilerplugins/clang/singlevalfields.cxx    |    7 +++++++
 compilerplugins/clang/unusedfields.cxx       |    7 +++++++
 compilerplugins/clang/unusedvariablemore.cxx |    5 +++++
 compilerplugins/clang/writeonlyvars.cxx      |    7 +++++++
 9 files changed, 58 insertions(+)

New commits:
commit 06111a2661ece65fbc2e8306acb1e26f0e3cdcde
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jan 27 15:00:41 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jan 27 22:00:26 2020 +0100

    Adapt to Clang 11 move of DynTypedNodeList
    
    ...in <https://github.com/llvm/llvm-project/commit/
    8a81daaa8b58aeaa192a47c4ce7f94b4d59ce082> "[AST] Split parent map traversal
    logic into ParentMapContext.h", causing failures like
    
    > compilerplugins/clang/constmethod.cxx: In member function ‘bool {anonymous}::ConstMethod::checkIfCanBeConst(const clang::Stmt*, const clang::CXXMethodDecl*)’:
    > compilerplugins/clang/constmethod.cxx:191:70: error: invalid use of incomplete type ‘class clang::DynTypedNodeList’
    >   191 |         auto parentsRange = compiler.getASTContext().getParents(*stmt);
    >       |                                                                      ^
    > In file included from compilerplugins/clang/plugin.hxx:15,
    >                  from compilerplugins/clang/constmethod.cxx:16:
    > include/clang/AST/ASTContext.h:97:7: note: forward declaration of ‘class clang::DynTypedNodeList’
    >    97 | class DynTypedNodeList;
    >       |       ^~~~~~~~~~~~~~~~
    
    Change-Id: Ib82d04608fa306a715af481422017c24053a01c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87533
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/constfields.cxx b/compilerplugins/clang/constfields.cxx
index 62cd56a54ad7..635774810717 100644
--- a/compilerplugins/clang/constfields.cxx
+++ b/compilerplugins/clang/constfields.cxx
@@ -18,10 +18,17 @@
 #include <algorithm>
 #include <sys/file.h>
 #include <unistd.h>
+
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
 Look for fields that are only assigned to in the constructor using field-init, and can therefore be const.
 
diff --git a/compilerplugins/clang/constmethod.cxx b/compilerplugins/clang/constmethod.cxx
index e6a5dd14069c..45451152dc99 100644
--- a/compilerplugins/clang/constmethod.cxx
+++ b/compilerplugins/clang/constmethod.cxx
@@ -13,11 +13,17 @@
 #include <unordered_map>
 #include <iostream>
 
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 #include "functionaddress.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
    Find methods that can be declared const.
 
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 28179f30abae..95c8184009d7 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -13,11 +13,17 @@
 #include <unordered_map>
 #include <iostream>
 
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 #include "functionaddress.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
    Find pointer and reference params that can be declared const.
 
diff --git a/compilerplugins/clang/constvars.cxx b/compilerplugins/clang/constvars.cxx
index d4a431dc14f0..f89301fed205 100644
--- a/compilerplugins/clang/constvars.cxx
+++ b/compilerplugins/clang/constvars.cxx
@@ -18,10 +18,17 @@
 #include <algorithm>
 #include <sys/file.h>
 #include <unistd.h>
+
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
 Look for static vars that are only assigned to once, and never written to, they can be const.
 */
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index eb4ac24c9743..6b89f3a89494 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -18,9 +18,15 @@
 #include <clang/Basic/FileManager.h>
 #include <clang/Lex/Lexer.h>
 
+#include "config_clang.h"
+
 #include "compat.hxx"
 #include "pluginhandler.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /*
 Base classes for plugin actions.
 */
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx
index 2949ce10ef3c..2efb562473ae 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -12,8 +12,15 @@
 #include <iostream>
 #include <fstream>
 #include <set>
+
+#include "config_clang.h"
+
 #include "plugin.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
 Look for fields that are only ever assigned a single constant value.
 
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 4aafd9cec746..471ecee97410 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -18,10 +18,17 @@
 #include <algorithm>
 #include <sys/file.h>
 #include <unistd.h>
+
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
 This performs two analyses:
  (1) look for unused fields
diff --git a/compilerplugins/clang/unusedvariablemore.cxx b/compilerplugins/clang/unusedvariablemore.cxx
index 8c153164f174..d4b5e40c3e1f 100644
--- a/compilerplugins/clang/unusedvariablemore.cxx
+++ b/compilerplugins/clang/unusedvariablemore.cxx
@@ -9,6 +9,7 @@
  *
  */
 
+#include "config_clang.h"
 #include <config_global.h>
 #include "plugin.hxx"
 #include "compat.hxx"
@@ -16,6 +17,10 @@
 #include <unordered_set>
 #include <unordered_map>
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 namespace loplugin
 {
 /*
diff --git a/compilerplugins/clang/writeonlyvars.cxx b/compilerplugins/clang/writeonlyvars.cxx
index 984f83b2fd80..eb74f494b59e 100644
--- a/compilerplugins/clang/writeonlyvars.cxx
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -18,10 +18,17 @@
 #include <algorithm>
 #include <sys/file.h>
 #include <unistd.h>
+
+#include "config_clang.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
 
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
 /**
   Finds variables that are effectively write-only.
 


More information about the Libreoffice-commits mailing list