File indexing completed on 2024-04-28 05:38:44
0001 #include <QtCore/QString> 0002 #include <QtCore/QList> 0003 #include <QtCore/QVector> 0004 #include <QtCore/QByteArray> 0005 #include <QtCore/QRect> 0006 #include <QtCore/QJsonValue> 0007 #include "other.h" 0008 0009 0010 0011 0012 extern void external(QString); 0013 0014 QString test() 0015 { 0016 QString s; // Warning 0017 QString s1, s2; // Warning for s2 0018 QString s3; // OK 0019 external(s1); 0020 0021 return s3; 0022 return {}; 0023 } 0024 0025 struct MyRAII 0026 { 0027 MyRAII(); 0028 ~MyRAII(); 0029 }; 0030 0031 void testRAII() 0032 { 0033 MyRAII m; // OK, not whitelisted 0034 } 0035 0036 void testFor() 0037 { 0038 QStringList l; 0039 for (QString s : l) // OK 0040 s; 0041 0042 foreach (QString s, l) // OK 0043 s; 0044 } 0045 0046 0047 void test4() 0048 { 0049 QList<int> l; //Warn 0050 QVector<int> v; //Warn 0051 QByteArray b; //Warn 0052 QRect r; // Warn 0053 QJsonValue jsv; // Warn 0054 FOO(QRect) r2; // OK 0055 r2.setX(0); 0056 } 0057 0058 struct MyWhitelistedType 0059 { 0060 MyWhitelistedType(); 0061 ~MyWhitelistedType(); 0062 }; 0063 0064 void testUserWhitelist() 0065 { 0066 MyWhitelistedType m; // OK, whitelisted 0067 }