summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-06-18 03:04:17 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-06-18 03:04:17 +0200
commitfb217099b4e03aaa2893e59470a4fe3ec125c9a7 (patch)
tree1b57bdb2899b507e7d50075b39fbe3fb763edf4a
parent3912157208a91f47274645e3e14a918438816c1d (diff)
parentb987303f9b656e440fd14fffd84287674e4ad226 (diff)
downloadqttools-fb217099b4e03aaa2893e59470a4fe3ec125c9a7.tar.gz
Merge "Merge remote-tracking branch 'origin/5.13' into dev"
-rw-r--r--src/assistant/help/qhelpcollectionhandler.cpp20
-rw-r--r--src/linguist/lupdate/main.cpp4
-rw-r--r--src/linguist/shared/po.cpp18
-rw-r--r--src/qdoc/clangcodeparser.cpp83
4 files changed, 78 insertions, 47 deletions
diff --git a/src/assistant/help/qhelpcollectionhandler.cpp b/src/assistant/help/qhelpcollectionhandler.cpp
index 9884fbcc1..a7bea5494 100644
--- a/src/assistant/help/qhelpcollectionhandler.cpp
+++ b/src/assistant/help/qhelpcollectionhandler.cpp
@@ -294,6 +294,7 @@ bool QHelpCollectionHandler::isTimeStampCorrect(const TimeStamp &timeStamp) cons
return false;
const QString oldFileName = m_query->value(0).toString();
+ m_query->clear();
if (oldFileName != timeStamp.fileName)
return false;
@@ -316,6 +317,7 @@ bool QHelpCollectionHandler::hasTimeStampInfo(const QString &nameSpace) const
if (!m_query->next())
return false;
+ m_query->clear();
return true;
}
@@ -1016,7 +1018,10 @@ bool QHelpCollectionHandler::fileExists(const QUrl &url) const
if (!m_query->exec() || !m_query->next())
return false;
- return m_query->value(0).toInt();
+ const int count = m_query->value(0).toInt();
+ m_query->clear();
+
+ return count;
}
static QString prepareFilterQuery(const QString &filterName)
@@ -1820,7 +1825,10 @@ QString QHelpCollectionHandler::namespaceVersion(const QString &namespaceName) c
if (!m_query->exec() || !m_query->next())
return QString();
- return m_query->value(0).toString();
+ const QString ret = m_query->value(0).toString();
+ m_query->clear();
+
+ return ret;
}
int QHelpCollectionHandler::registerNamespace(const QString &nspace, const QString &fileName)
@@ -1844,8 +1852,10 @@ int QHelpCollectionHandler::registerNamespace(const QString &nspace, const QStri
m_query->bindValue(0, nspace);
m_query->bindValue(1, fi.absoluteDir().relativeFilePath(fileName));
int namespaceId = errorValue;
- if (m_query->exec())
+ if (m_query->exec()) {
namespaceId = m_query->lastInsertId().toInt();
+ m_query->clear();
+ }
if (namespaceId < 1) {
emit error(tr("Cannot register namespace \"%1\".").arg(nspace));
return errorValue;
@@ -1863,8 +1873,10 @@ int QHelpCollectionHandler::registerVirtualFolder(const QString &folderName, int
m_query->bindValue(1, folderName);
int virtualId = -1;
- if (m_query->exec())
+ if (m_query->exec()) {
virtualId = m_query->lastInsertId().toInt();
+ m_query->clear();
+ }
if (virtualId < 1) {
emit error(tr("Cannot register virtual folder '%1'.").arg(folderName));
return -1;
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index d20b4b4df..8bdfff479 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -239,9 +239,9 @@ static void printUsage()
" -no-sort\n"
" Do not sort contexts in TS files.\n"
" -no-recursive\n"
- " Do not recursively scan the following directories.\n"
+ " Do not recursively scan directories.\n"
" -recursive\n"
- " Recursively scan the following directories (default).\n"
+ " Recursively scan directories (default).\n"
" -I <includepath> or -I<includepath>\n"
" Additional location to look for include files.\n"
" May be specified multiple times.\n"
diff --git a/src/linguist/shared/po.cpp b/src/linguist/shared/po.cpp
index a998aa0f6..4e623e6a3 100644
--- a/src/linguist/shared/po.cpp
+++ b/src/linguist/shared/po.cpp
@@ -151,7 +151,7 @@ static QString poEscapedLines(const QString &prefix, bool addSpace, const QStrin
static QString poEscapedLines(const QString &prefix, bool addSpace, const QString &in0)
{
QString in = in0;
- if (in.endsWith(QLatin1Char('\n')))
+ if (in == QString::fromLatin1("\n"))
in.chop(1);
return poEscapedLines(prefix, addSpace, in.split(QLatin1Char('\n')));
}
@@ -321,6 +321,7 @@ premature_eol:
static void slurpComment(QByteArray &msg, const QList<QByteArray> &lines, int & l)
{
+ int firstLine = l;
QByteArray prefix = lines.at(l);
for (int i = 1; ; i++) {
if (prefix.at(i) != ' ') {
@@ -330,11 +331,15 @@ static void slurpComment(QByteArray &msg, const QList<QByteArray> &lines, int &
}
for (; l < lines.size(); ++l) {
const QByteArray &line = lines.at(l);
- if (line.startsWith(prefix))
+ if (line.startsWith(prefix)) {
+ if (l > firstLine)
+ msg += '\n';
msg += line.mid(prefix.size());
- else if (line != "#")
+ } else if (line == "#") {
+ msg += '\n';
+ } else {
break;
- msg += '\n';
+ }
}
--l;
}
@@ -525,9 +530,10 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
}
}
doneho:
- if (lastCmtLine != -1)
+ if (lastCmtLine != -1) {
extras[QLatin1String("po-header_comment")] =
QByteArrayList_join(lines.mid(0, lastCmtLine + 1), '\n');
+ }
for (QHash<QString, QByteArray>::ConstIterator it = extras.constBegin(),
end = extras.constEnd();
it != end; ++it)
@@ -626,7 +632,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
item.id = line.mid(9);
} else {
item.automaticComments += line.mid(3);
- item.automaticComments += '\n';
+
}
break;
case '|':
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index be7bde02f..4eaab69d7 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1259,56 +1259,69 @@ void ClangCodeParser::buildPCH()
header = candidate;
}
if (header.isEmpty()) {
- qWarning() << "(qdoc) Could not find the module header in the include path for module"
+ qWarning() << "(qdoc) Could not find the module header in include paths for module"
<< module << " (include paths: "<< includePaths_ << ")";
- } else {
- args_.push_back("-xc++");
- CXTranslationUnit tu;
- QString tmpHeader = pchFileDir_->path() + "/" + module;
- QFile tmpHeaderFile(tmpHeader);
- if (tmpHeaderFile.open(QIODevice::Text | QIODevice::WriteOnly)) {
+ qWarning() << " Artificial module header built from header dirs in qdocconf file";
+ }
+ args_.push_back("-xc++");
+ CXTranslationUnit tu;
+ QString tmpHeader = pchFileDir_->path() + "/" + module;
+ QFile tmpHeaderFile(tmpHeader);
+ if (tmpHeaderFile.open(QIODevice::Text | QIODevice::WriteOnly)) {
+ QTextStream out(&tmpHeaderFile);
+ if (header.isEmpty()) {
+ QList<QString> keys = allHeaders_.keys();
+ QList<QString> values = allHeaders_.values();
+ for (int i = 0; i < keys.size(); i++) {
+ if (!keys.at(i).endsWith(QLatin1String("_p.h")) &&
+ !keys.at(i).startsWith(QLatin1String("moc_"))) {
+ QString line = QLatin1String("#include \"") + values.at(i) +
+ QLatin1String("/") + keys.at(i) + QLatin1String("\"");
+ out << line << "\n";
+ }
+ }
+ } else {
QFile headerFile(header);
if (!headerFile.open(QFile::ReadOnly)) {
qWarning() << "Could not read module header file" << header;
return;
}
QTextStream in(&headerFile);
- QTextStream out(&tmpHeaderFile);
while (!in.atEnd()) {
QString line = in.readLine().simplified();
if (line.startsWith(QLatin1String("#include")))
out << line << "\n";
}
}
- if (printParsingErrors_ == 0)
- Location::logToStdErrAlways("clang not printing errors; include paths were guessed");
- CXErrorCode err = clang_parseTranslationUnit2(index_,
- tmpHeader.toLatin1().data(),
- args_.data(), static_cast<int>(args_.size()), nullptr, 0,
- flags_ | CXTranslationUnit_ForSerialization, &tu);
- qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
- << tmpHeader << args_ << ") returns" << err;
- if (!err && tu) {
- pchName_ = pchFileDir_->path().toUtf8() + "/" + module + ".pch";
- auto error = clang_saveTranslationUnit(tu, pchName_.constData(), clang_defaultSaveOptions(tu));
- if (error) {
- Location::logToStdErrAlways("Could not save PCH file for " + moduleHeader());
- pchName_.clear();
- }
- else {
- // Visit the header now, as token from pre-compiled header won't be visited later
- CXCursor cur = clang_getTranslationUnitCursor(tu);
- ClangVisitor visitor(qdb_, allHeaders_);
- visitor.visitChildren(cur);
- Location::logToStdErrAlways("PCH built & visited for " + moduleHeader());
- }
- clang_disposeTranslationUnit(tu);
- } else {
- pchFileDir_->remove();
- Location::logToStdErrAlways("Could not create PCH file for " + moduleHeader());
+ }
+ if (printParsingErrors_ == 0)
+ Location::logToStdErrAlways("clang not printing errors; include paths were guessed");
+ CXErrorCode err = clang_parseTranslationUnit2(index_,
+ tmpHeader.toLatin1().data(),
+ args_.data(), static_cast<int>(args_.size()), nullptr, 0,
+ flags_ | CXTranslationUnit_ForSerialization, &tu);
+ qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
+ << tmpHeader << args_ << ") returns" << err;
+ if (!err && tu) {
+ pchName_ = pchFileDir_->path().toUtf8() + "/" + module + ".pch";
+ auto error = clang_saveTranslationUnit(tu, pchName_.constData(), clang_defaultSaveOptions(tu));
+ if (error) {
+ Location::logToStdErrAlways("Could not save PCH file for " + moduleHeader());
+ pchName_.clear();
}
- args_.pop_back(); // remove the "-xc++";
+ else {
+ // Visit the header now, as token from pre-compiled header won't be visited later
+ CXCursor cur = clang_getTranslationUnitCursor(tu);
+ ClangVisitor visitor(qdb_, allHeaders_);
+ visitor.visitChildren(cur);
+ Location::logToStdErrAlways("PCH built & visited for " + moduleHeader());
+ }
+ clang_disposeTranslationUnit(tu);
+ } else {
+ pchFileDir_->remove();
+ Location::logToStdErrAlways("Could not create PCH file for " + moduleHeader());
}
+ args_.pop_back(); // remove the "-xc++";
}
}
}