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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 16 07:54:42 UTC 2020


 compilerplugins/clang/finalclasses.cxx |    2 +-
 compilerplugins/clang/mergeclasses.cxx |    2 +-
 compilerplugins/clang/methodcycles.cxx |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit c99107f6700287fda2be3c7321613cd68b7c404c
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jan 15 23:12:25 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jan 16 08:54:07 2020 +0100

    -Werror,-Wrange-loop-analysis
    
    > compilerplugins/clang/finalclasses.cxx:56:57: error: loop variable 's' has type 'const std::pair<std::string, std::string> &' (aka 'const pair<basic_string<char>, basic_string<char> > &') but is initialized with type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' resulting in a copy [-Werror,-Wrange-loop-analysis]
    >         for (const std::pair<std::string,std::string> & s : definitionMap)
    >                                                         ^
    > compilerplugins/clang/finalclasses.cxx:56:14: note: use non-reference type 'std::pair<std::string, std::string>' (aka 'pair<basic_string<char>, basic_string<char> >') to keep the copy or type 'const std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > &' to prevent copying
    >         for (const std::pair<std::string,std::string> & s : definitionMap)
    >              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    etc.
    
    Change-Id: If3f0599ef79d49e4bb4bbd245ca7456c09d13975
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86893
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index 10948790697f..d906c586d1a0 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -53,7 +53,7 @@ public:
         std::string output;
         for (const std::string & s : inheritedFromSet)
             output += "inherited-from:\t" + s + "\n";
-        for (const std::pair<std::string,std::string> & s : definitionMap)
+        for (const auto & s : definitionMap)
             output += "definition:\t" + s.first + "\t" + s.second + "\n";
         std::ofstream myfile;
         myfile.open( WORKDIR "/loplugin.finalclasses.log", std::ios::app | std::ios::out);
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index b3a167ff143e..c7f9a6094a14 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -64,7 +64,7 @@ public:
             output += "instantiated:\t" + s + "\n";
         for (const std::pair<std::string,std::string> & s : childToParentClassSet)
             output += "has-subclass:\t" + s.first + "\t" + s.second + "\n";
-        for (const std::pair<std::string,std::string> & s : definitionMap)
+        for (const auto & s : definitionMap)
             output += "definition:\t" + s.first + "\t" + s.second + "\n";
         std::ofstream myfile;
         myfile.open( WORKDIR "/loplugin.mergeclasses.log", std::ios::app | std::ios::out);
diff --git a/compilerplugins/clang/methodcycles.cxx b/compilerplugins/clang/methodcycles.cxx
index 42e15c91024a..7fd74b10d9ea 100644
--- a/compilerplugins/clang/methodcycles.cxx
+++ b/compilerplugins/clang/methodcycles.cxx
@@ -80,7 +80,7 @@ public:
         for (const MyFuncInfo& s : definitionSet)
             output += "definition:\t" + s.returnType + "\t" + s.nameAndParams + "\t"
                       + s.sourceLocation + "\n";
-        for (const std::pair<const FunctionDecl*, const FunctionDecl*>& pair : callMap)
+        for (const auto& pair : callMap)
         {
             if (!isLocationMine(pair.first->getLocation())
                 || !isLocationMine(pair.second->getLocation()))


More information about the Libreoffice-commits mailing list