src: clazy compiler warnings
get rid of most clazy warnings (https://github.com/KDE/clazy) * range loop use refs * qcolor ctor with ints * missing Q_OBJECT macro * use .constfirst instead of .first enabled ccache for unix systems for fasterr recompiling * if ccache is in path we use it now
This commit is contained in:
@@ -113,7 +113,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<int>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<float>& values
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(static_cast<float>(atof(valueString.c_str())));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<bool>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()) != 0);
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ void conflicting_options(const boost::program_options::variables_map& vm,
|
||||
std::vector<FilePath> extractPaths(const std::vector<std::string>& vector)
|
||||
{
|
||||
std::vector<FilePath> v;
|
||||
for (std::string s : vector)
|
||||
for (const std::string& s : vector)
|
||||
{
|
||||
std::vector<std::string> temp= utility::splitToVector(s, ',');
|
||||
for (std::string path : temp)
|
||||
for (const std::string& path : temp)
|
||||
{
|
||||
v.push_back(FilePath(path));
|
||||
}
|
||||
}
|
||||
return std::move(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace cmd
|
||||
|
||||
@@ -24,7 +24,7 @@ void FileManager::update(
|
||||
|
||||
m_allSourceFilePaths.clear();
|
||||
|
||||
for (FileInfo fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
{
|
||||
const FilePath& filePath = fileInfo.path;
|
||||
if (isExcluded(filePath))
|
||||
@@ -76,7 +76,7 @@ std::set<FilePath> FileManager::getAllSourceFilePathsRelative(const FilePath& ba
|
||||
std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
std::vector<FilePath> ret;
|
||||
for (const FilePath filePath: filePaths)
|
||||
for (const FilePath& filePath: filePaths)
|
||||
{
|
||||
ret.push_back(filePath.canonical());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& fi
|
||||
|
||||
bool FileManager::isExcluded(const FilePath& filePath) const
|
||||
{
|
||||
for (FilePath path : m_excludePaths)
|
||||
for (const FilePath& path : m_excludePaths)
|
||||
{
|
||||
if (path == filePath || path.contains(filePath))
|
||||
{
|
||||
|
||||
@@ -322,7 +322,7 @@ FilePath FilePath::replaceExtension(const std::string& extension) const
|
||||
bool FilePath::hasExtension(const std::vector<std::string>& extensions) const
|
||||
{
|
||||
std::string e = extension();
|
||||
for (std::string ext : extensions)
|
||||
for (const std::string& ext : extensions)
|
||||
{
|
||||
if (e == ext)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ bool FileRegisterStateData::fileIsIndexed(const FilePath& filePath) const
|
||||
|
||||
void FileRegisterStateData::setIndexedFiles(const std::set<FilePath>& filePaths)
|
||||
{
|
||||
for (auto path : filePaths)
|
||||
for (auto& path : filePaths)
|
||||
{
|
||||
m_filePaths[path] = STATE_INDEXED;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void Tracer::printTraces()
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
size_t unfinishEvents = 0;
|
||||
for (auto p : m_startedEvents)
|
||||
for (auto& p : m_startedEvents)
|
||||
{
|
||||
unfinishEvents += p.second.size();
|
||||
}
|
||||
@@ -67,11 +67,11 @@ void Tracer::printTraces()
|
||||
std::cout << "-----------------------------------------------------------------";
|
||||
std::cout << "------------------------------------------------------------\n";
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
std::cout << "thread: " << p.first << std::endl;
|
||||
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::cout.width(8 + 2 * event->depth);
|
||||
std::cout << std::right << std::setprecision(3) << std::fixed << event->time;
|
||||
@@ -104,9 +104,9 @@ void Tracer::printTraces()
|
||||
|
||||
std::map<std::string, AccumulatedTraceEvent> accumulatedEvents;
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::string name = event->eventName + event->functionName + event->locationName;
|
||||
|
||||
@@ -136,7 +136,7 @@ void Tracer::printTraces()
|
||||
}
|
||||
);
|
||||
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent> p : accumulatedEvents)
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent>& p : accumulatedEvents)
|
||||
{
|
||||
sortedEvents.insert(p.second);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace utility
|
||||
{
|
||||
std::deque<std::string> c;
|
||||
|
||||
for (std::string str : list)
|
||||
for (const std::string& str : list)
|
||||
{
|
||||
if (str.size())
|
||||
{
|
||||
@@ -322,7 +322,7 @@ namespace utility
|
||||
}
|
||||
|
||||
paramPart = "";
|
||||
for (std::string str : paramLines)
|
||||
for (const std::string& str : paramLines)
|
||||
{
|
||||
paramPart += "\n\t" + str;
|
||||
size_t length = tabWidth + str.size();
|
||||
|
||||
Reference in New Issue
Block a user