-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>
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
|||||||
std::string output;
|
std::string output;
|
||||||
for (const std::string & s : inheritedFromSet)
|
for (const std::string & s : inheritedFromSet)
|
||||||
output += "inherited-from:\t" + s + "\n";
|
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";
|
output += "definition:\t" + s.first + "\t" + s.second + "\n";
|
||||||
std::ofstream myfile;
|
std::ofstream myfile;
|
||||||
myfile.open( WORKDIR "/loplugin.finalclasses.log", std::ios::app | std::ios::out);
|
myfile.open( WORKDIR "/loplugin.finalclasses.log", std::ios::app | std::ios::out);
|
||||||
|
@@ -64,7 +64,7 @@ public:
|
|||||||
output += "instantiated:\t" + s + "\n";
|
output += "instantiated:\t" + s + "\n";
|
||||||
for (const std::pair<std::string,std::string> & s : childToParentClassSet)
|
for (const std::pair<std::string,std::string> & s : childToParentClassSet)
|
||||||
output += "has-subclass:\t" + s.first + "\t" + s.second + "\n";
|
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";
|
output += "definition:\t" + s.first + "\t" + s.second + "\n";
|
||||||
std::ofstream myfile;
|
std::ofstream myfile;
|
||||||
myfile.open( WORKDIR "/loplugin.mergeclasses.log", std::ios::app | std::ios::out);
|
myfile.open( WORKDIR "/loplugin.mergeclasses.log", std::ios::app | std::ios::out);
|
||||||
|
@@ -80,7 +80,7 @@ public:
|
|||||||
for (const MyFuncInfo& s : definitionSet)
|
for (const MyFuncInfo& s : definitionSet)
|
||||||
output += "definition:\t" + s.returnType + "\t" + s.nameAndParams + "\t"
|
output += "definition:\t" + s.returnType + "\t" + s.nameAndParams + "\t"
|
||||||
+ s.sourceLocation + "\n";
|
+ s.sourceLocation + "\n";
|
||||||
for (const std::pair<const FunctionDecl*, const FunctionDecl*>& pair : callMap)
|
for (const auto& pair : callMap)
|
||||||
{
|
{
|
||||||
if (!isLocationMine(pair.first->getLocation())
|
if (!isLocationMine(pair.first->getLocation())
|
||||||
|| !isLocationMine(pair.second->getLocation()))
|
|| !isLocationMine(pair.second->getLocation()))
|
||||||
|
Reference in New Issue
Block a user