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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 2 21:40:27 UTC 2020


 compilerplugins/clang/dyncastvisibility.cxx |    2 +-
 compilerplugins/clang/external.cxx          |    2 +-
 compilerplugins/clang/fakebool.cxx          |    8 ++++----
 compilerplugins/clang/salcall.cxx           |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 8dcb43b430a008817821e8cc7c7a3984f18cc473
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 2 21:09:29 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 2 23:39:39 2020 +0200

    -Werror,-Wrange-loop-analysis
    
    Change-Id: I254e1b69f66b985d66c9ce3707614c3b505f2335
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101975
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/dyncastvisibility.cxx b/compilerplugins/clang/dyncastvisibility.cxx
index 788506ee2250..3c54f7cf8929 100644
--- a/compilerplugins/clang/dyncastvisibility.cxx
+++ b/compilerplugins/clang/dyncastvisibility.cxx
@@ -46,7 +46,7 @@ bool isDerivedFrom(
     bool * hidden)
 {
     bool derived = false;
-    for (auto const i: decl->bases()) {
+    for (auto const & i: decl->bases()) {
         auto const bd
             = (cast<CXXRecordDecl>(i.getType()->getAs<RecordType>()->getDecl())
                ->getDefinition());
diff --git a/compilerplugins/clang/external.cxx b/compilerplugins/clang/external.cxx
index bc75237a15fd..e3bc67f19c46 100644
--- a/compilerplugins/clang/external.cxx
+++ b/compilerplugins/clang/external.cxx
@@ -421,7 +421,7 @@ private:
                 {
                     continue;
                 }
-                for (auto const t : affected)
+                for (auto const& t : affected)
                 {
                     auto const tc = t.getCanonicalType();
                     for (auto p = f->param_begin(); p != f->param_end(); ++p)
diff --git a/compilerplugins/clang/fakebool.cxx b/compilerplugins/clang/fakebool.cxx
index 804f1d51afa1..277dd915bf0d 100644
--- a/compilerplugins/clang/fakebool.cxx
+++ b/compilerplugins/clang/fakebool.cxx
@@ -235,7 +235,7 @@ private:
 void FakeBool::run() {
     if (compiler.getLangOpts().CPlusPlus) {
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
-        for (auto const dcl: varDecls_) {
+        for (auto const & dcl: varDecls_) {
             auto const decl = dcl.first; auto const fbk = dcl.second;
             SourceLocation loc { compat::getBeginLoc(decl) };
             TypeSourceInfo * tsi = decl->getTypeSourceInfo();
@@ -277,7 +277,7 @@ void FakeBool::run() {
                     << decl->getSourceRange();
             }
         }
-        for (auto const dcl: fieldDecls_) {
+        for (auto const & dcl: fieldDecls_) {
             auto const decl = dcl.first; auto const fbk = dcl.second;
             SourceLocation loc { compat::getBeginLoc(decl) };
             TypeSourceInfo * tsi = decl->getTypeSourceInfo();
@@ -319,7 +319,7 @@ void FakeBool::run() {
             }
         }
         auto const ignoredFns = getFunctionsWithAddressTaken();
-        for (auto const dcl: parmVarDecls_) {
+        for (auto const & dcl: parmVarDecls_) {
             auto const decl = dcl.first; auto const fbk = dcl.second;
             FunctionDecl const * f = cast<FunctionDecl>(decl->getDeclContext())->getCanonicalDecl();
             if (ignoredFns.find(f) != ignoredFns.end()) {
@@ -393,7 +393,7 @@ void FakeBool::run() {
                     << decl->getSourceRange();
             }
         }
-        for (auto const dcl: functionDecls_) {
+        for (auto const & dcl: functionDecls_) {
             auto const decl = dcl.first; auto const fbk = dcl.second;
             FunctionDecl const * f = decl->getCanonicalDecl();
             if (ignoredFns.find(f) != ignoredFns.end()) {
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index 3c91e76b870a..e70e6477f2b0 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -609,7 +609,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
     }
     ranges.emplace_back(startLoc, endLoc);
 
-    for (auto const range : ranges)
+    for (auto const& range : ranges)
     {
         if (range.isInvalid())
         {


More information about the Libreoffice-commits mailing list