@@ -892,7 +892,7 @@ bool ProjectFile::write(const QString &filename)
892892
893893 if (!mIncludeDirs .isEmpty ()) {
894894 xmlWriter.writeStartElement (CppcheckXml::IncludeDirElementName);
895- for (const QString& incdir : mIncludeDirs ) {
895+ for (const QString& incdir : utils::as_const ( mIncludeDirs ) ) {
896896 xmlWriter.writeStartElement (CppcheckXml::DirElementName);
897897 xmlWriter.writeAttribute (CppcheckXml::DirNameAttrib, incdir);
898898 xmlWriter.writeEndElement ();
@@ -902,7 +902,7 @@ bool ProjectFile::write(const QString &filename)
902902
903903 if (!mDefines .isEmpty ()) {
904904 xmlWriter.writeStartElement (CppcheckXml::DefinesElementName);
905- for (const QString& define : mDefines ) {
905+ for (const QString& define : utils::as_const ( mDefines ) ) {
906906 xmlWriter.writeStartElement (CppcheckXml::DefineName);
907907 xmlWriter.writeAttribute (CppcheckXml::DefineNameAttrib, define);
908908 xmlWriter.writeEndElement ();
@@ -924,7 +924,7 @@ bool ProjectFile::write(const QString &filename)
924924
925925 if (!mPaths .isEmpty ()) {
926926 xmlWriter.writeStartElement (CppcheckXml::PathsElementName);
927- for (const QString& path : mPaths ) {
927+ for (const QString& path : utils::as_const ( mPaths ) ) {
928928 xmlWriter.writeStartElement (CppcheckXml::PathName);
929929 xmlWriter.writeAttribute (CppcheckXml::PathNameAttrib, path);
930930 xmlWriter.writeEndElement ();
@@ -934,7 +934,7 @@ bool ProjectFile::write(const QString &filename)
934934
935935 if (!mExcludedPaths .isEmpty ()) {
936936 xmlWriter.writeStartElement (CppcheckXml::ExcludeElementName);
937- for (const QString& path : mExcludedPaths ) {
937+ for (const QString& path : utils::as_const ( mExcludedPaths ) ) {
938938 xmlWriter.writeStartElement (CppcheckXml::ExcludePathName);
939939 xmlWriter.writeAttribute (CppcheckXml::ExcludePathNameAttrib, path);
940940 xmlWriter.writeEndElement ();
@@ -949,7 +949,7 @@ bool ProjectFile::write(const QString &filename)
949949
950950 if (!mSuppressions .isEmpty ()) {
951951 xmlWriter.writeStartElement (CppcheckXml::SuppressionsElementName);
952- for (const SuppressionList::Suppression &suppression : mSuppressions ) {
952+ for (const SuppressionList::Suppression &suppression : utils::as_const ( mSuppressions ) ) {
953953 xmlWriter.writeStartElement (CppcheckXml::SuppressionElementName);
954954 if (!suppression.fileName .empty ())
955955 xmlWriter.writeAttribute (" fileName" , QString::fromStdString (suppression.fileName ));
@@ -1169,7 +1169,7 @@ QString ProjectFile::getAddonFilePath(QString filesDir, const QString &addon)
11691169#endif
11701170 ;
11711171
1172- for (const QString& path : searchPaths) {
1172+ for (const QString& path : utils::as_const ( searchPaths) ) {
11731173 QString f = path + addon + " .py" ;
11741174 if (QFile (f).exists ())
11751175 return f;
0 commit comments