diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/tests/testutil.h')
-rw-r--r-- | sources/shiboken2/ApiExtractor/tests/testutil.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h index 6152793f5..c6ad19d7e 100644 --- a/sources/shiboken2/ApiExtractor/tests/testutil.h +++ b/sources/shiboken2/ApiExtractor/tests/testutil.h @@ -40,20 +40,23 @@ namespace TestUtil { static AbstractMetaBuilder *parse(const char *cppCode, const char *xmlCode, bool silent = true, - const char *apiVersion = Q_NULLPTR, + const QString &apiVersion = QString(), const QStringList &dropTypeEntries = QStringList()) { ReportHandler::setSilent(silent); TypeDatabase* td = TypeDatabase::instance(true); - if (apiVersion && !td->setApiVersion(QLatin1String("*"), QLatin1String(apiVersion))) - return Q_NULLPTR; + if (apiVersion.isEmpty()) + TypeDatabase::clearApiVersions(); + else if (!td->setApiVersion(QLatin1String("*"), apiVersion)) + return nullptr; td->setDropTypeEntries(dropTypeEntries); QBuffer buffer; // parse typesystem buffer.setData(xmlCode); if (!buffer.open(QIODevice::ReadOnly)) return Q_NULLPTR; - td->parseFile(&buffer); + if (!td->parseFile(&buffer)) + return nullptr; buffer.close(); // parse C++ code QTemporaryFile tempSource(QDir::tempPath() + QLatin1String("/st_XXXXXX_main.cpp")); |