diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-01-15 23:12:25 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-01-16 08:54:07 +0100 |
commit | c99107f6700287fda2be3c7321613cd68b7c404c (patch) | |
tree | 15a84ba9f26bde76e7d31bec2966b02af414d468 /compilerplugins | |
parent | 6b0d5a2aa98f6e201820080eed88f329f6b40cef (diff) |
-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@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/finalclasses.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/mergeclasses.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/methodcycles.cxx | 2 |
3 files changed, 3 insertions, 3 deletions
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())) |