qt.cfg: Add support and tests for QFile::exists function (#1645)

Found by daca@home
This commit is contained in:
Sebastian 2019-02-06 13:23:05 +01:00 committed by GitHub
parent b6681c2a2e
commit 55ce6d2073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -1137,6 +1137,18 @@
<not-uninit/>
</arg>
</function>
<!-- bool QFile::exists(const QString &fileName) // static -->
<!-- bool QFile::exists() const -->
<function name="QFile::exists">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" default="&quot;&quot;">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- bool QFile::open(OpenMode mode) -->
<!-- bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->
<!-- bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->

View File

@ -10,6 +10,7 @@
#include <QObject>
#include <QString>
#include <QtPlugin>
#include <QFile>
void QString1(QString s)
@ -36,3 +37,18 @@ public:
explicit MacroTest1(QObject *parent = 0);
~MacroTest1();
};
void validCode()
{
if (QFile::exists("test"))
{}
}
void ignoredReturnValue()
{
// cppcheck-suppress ignoredReturnValue
QFile::exists("test");
QFile file1("test");
// cppcheck-suppress ignoredReturnValue
file1.exists();
}