Merge remote-tracking branch 'origin/4.8'

Conflicts:
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I743ea39480cc5c7b6febcd2e93713d15a3ae6d9c
This commit is contained in:
Eike Ziller
2018-12-07 08:53:11 +01:00
17 changed files with 151 additions and 36 deletions

View File

@@ -125,8 +125,9 @@
in the \c {Modules} directory of your CMake installation.
\note If you provide your own libraries, you also need to provide your own
\c {FindFoo.cmake} file. For more information, see
\l{http://vtk.org/Wiki/CMake_FAQ#Writing_FindXXX.cmake_files}{CMake FAQ}.
\c {FindXXX.cmake} file. For more information, see
\l{https://gitlab.kitware.com/cmake/community/wikis/FAQ#writing-findxxxcmake-files}
{Writing FindXXX.cmake files}.
Syntax completion and highlighting work once your project successfully
builds and links against the external library.

View File

@@ -427,6 +427,7 @@
\endlist
\if defined(qtdesignstudio)
\include qtdesignstudio-visual-effects.qdocinc qml visual effects
\include qtdesignstudio-components.qdocinc creating studio components
\include qtdesignstudio-components.qdocinc studio components
\endif

View File

@@ -8,20 +8,31 @@
"__javascriptQt5__"],
"supportedImports": [
"Qt.labs.calendar 1.0",
"Qt.labs.controls 1.0",
"Qt.labs.templates 1.0",
"Qt.labs.folderlistmodel 2.0",
"Qt.labs.folderlistmodel 2.1",
"Qt.labs.folderlistmodel 2.2",
"Qt.labs.folderlistmodel 2.12",
"Qt.labs.settings 1.0",
"Qt.labs.settings 1.1",
"Qt.labs.platform 1.0",
"Qt.WebSockets 1.0",
"Qt.WebSockets 1.1",
"Qt3D.Animation 2.9",
"Qt3D.Animation 2.12",
"Qt3D.Core 2.0",
"Qt3D.Core 2.9",
"Qt3D.Core 2.12",
"Qt3D.Extras 2.0",
"Qt3D.Extras 2.9",
"Qt3D.Extras 2.12",
"Qt3D.Input 2.0",
"Qt3D.Input 2.1",
"Qt3D.Input 2.12",
"Qt3D.Logic 2.0",
"Qt3D.Logic 2.12",
"Qt3D.Render 2.0",
"Qt3D.Render 2.9",
"Qt3D.Render 2.12",
"Qt3D.Scene2D 2.9",
"QtAudioEngine 1.0",
"QtBluetooth 5.0",
@@ -33,7 +44,13 @@
"QtBluetooth 5.7",
"QtBluetooth 5.8",
"QtBluetooth 5.9",
"QtBluetooth 5.11",
"QtBluetooth 5.12",
"QtCanvas3D 1.1",
"QtCharts 2.3",
"QtDataVisualization 1.0",
"QtDataVisualization 1.3",
"QtGamePad 1.12",
"QtGraphicalEffects 1.0",
"QtMultimedia 5.0",
"QtMultimedia 5.2",
@@ -44,6 +61,7 @@
"QtMultimedia 5.7",
"QtMultimedia 5.8",
"QtMultimedia 5.9",
"QtMultimedia 5.12",
"QtNfc 5.0",
"QtNfc 5.2",
"QtNfc 5.3",
@@ -53,6 +71,8 @@
"QtNfc 5.7",
"QtNfc 5.8",
"QtNfc 5.9",
"QtNfc 5.11",
"QtNfc 5.12",
"QtPositioning 5.0",
"QtPositioning 5.2",
"QtPositioning 5.3",
@@ -61,28 +81,33 @@
"QtPositioning 5.6",
"QtPositioning 5.7",
"QtPositioning 5.8",
"QtPositioning 5.11",
"QtPositioning 5.12",
"QtLocation 5.3",
"QtLocation 5.5",
"QtLocation 5.6",
"QtLocation 5.8",
"QtLocation 5.9",
"QtLocation 5.11",
"QtLocation 5.12",
"QtPurchasing 1.0",
"QtPurchasing 1.12",
"QtQml 2.0",
"QtQml 2.1",
"QtQml 2.2",
"QtQml 2.3",
"QtQml 2.12",
"QtQml.Models 2.1",
"QtQml.Models 2.2",
"QtQml.Models 2.3",
"QtQuick.Controls 1.0",
"QtQuick.Controls 1.1",
"QtQuick.Controls 1.2",
"QtQuick.Controls 1.3",
"QtQuick.Controls 1.4",
"QtQml.Models 2.11",
"QtQml.Models 2.12",
"QtQuick.Controls 2.0",
"QtQuick.Controls 2.1",
"QtQuick.Controls 2.2",
"QtQuick.Controls 2.3",
"QtQuick.Controls 2.4",
"QtQuick.Controls 2.5",
"QtQuick.Controls.Material 2.0",
"QtQuick.Controls.Material 2.1",
"QtQuick.Controls.Material 2.2",
@@ -104,18 +129,28 @@
"QtQuick.Layouts 1.1",
"QtQuick.Layouts 1.2",
"QtQuick.Layouts 1.3",
"QtQuick.Layouts 1.12",
"QtQuick.LocalStorage 2.0",
"QtQuick.LocalStorage 2.11",
"QtQuick.LocalStorage 2.12",
"QtQuick.Particles 2.0",
"QtQuick.Particles 2.12",
"QtQuick.Shapes 1.12",
"QtQuick.Templates 2.0",
"QtQuick.Templates 2.1",
"QtQuick.Templates 2.2",
"QtQuick.Templates 2.5",
"QtQuick.Window 2.0",
"QtQuick.Window 2.1",
"QtQuick.Window 2.2",
"QtQuick.Window 2.3",
"QtQuick.Window 2.10",
"QtQuick.Window 2.11",
"QtQuick.Window 2.12",
"QtQuick.XmlListModel 2.0",
"QtQuick.XmlListModel 2.12",
"QtRemoteObjects 5.12",
"QtScxml 5.8",
"QtSensors 5.0",
"QtSensors 5.1",
"QtSensors 5.2",
@@ -126,6 +161,8 @@
"QtSensors 5.7",
"QtSensors 5.8",
"QtSensors 5.9",
"QtSensors 5.11",
"QtSensors 5.12",
"QtQuick 2.0",
"QtQuick 2.1",
"QtQuick 2.2",
@@ -138,7 +175,15 @@
"QtQuick 2.9",
"QtQuick 2.10",
"QtQuick 2.11",
"QtQuick 2.12",
"QtTest 1.0",
"QtTest 1.2",
"QtTest 1.12",
"QtVirtualKeyboard.VirtualKeyboard 2.4",
"QtVirtualKeyboard.Settings 2.2",
"QtVirtualKeyboard.Styles 2.1",
"QtScxml 5.8",
"QtWebChannel 1.0",
"QtWebEngine 1.0",
"QtWebEngine 1.1",
"QtWebEngine 1.2",
@@ -147,7 +192,12 @@
"QtWebEngine 1.5",
"QtWebEngine 1.6",
"QtWebEngine 1.7",
"QtWebEngine 1.8",
"QtWebSockets 1.1",
"QtWebView 1.0",
"QtWebView 1.1",
"QtWebKit 3.0",
"Enginio 1.0"
"QtWinExtras 1.0"
]
}

View File

@@ -223,6 +223,8 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
<< "Before Start ADB cmds:" << m_beforeStartAdbCommands
<< "After finish ADB cmds:" << m_afterFinishAdbCommands;
m_gdbserverPath = AndroidGdbServerKitInformation::gdbServer(target->kit()).toString();
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
m_useAppParamsForQmlDebugger = version->qtVersion() >= QtSupport::QtVersionNumber(5, 12);
}
AndroidRunnerWorker::~AndroidRunnerWorker()
@@ -441,10 +443,18 @@ void AndroidRunnerWorker::asyncStartHelper()
}
m_afterFinishAdbCommands.push_back(removeForward.join(' '));
args << "-e" << "qml_debug" << "true"
<< "-e" << "qmljsdebugger"
<< QString("port:%1,block,services:%2")
const QString qmljsdebugger = QString("port:%1,block,services:%2")
.arg(m_qmlServer.port()).arg(QmlDebug::qmlDebugServices(m_qmlDebugServices));
if (m_useAppParamsForQmlDebugger) {
if (!m_extraAppParams.isEmpty())
m_extraAppParams.prepend(' ');
m_extraAppParams.prepend("-qmljsdebugger=" + qmljsdebugger);
} else {
args << "-e" << "qml_debug" << "true"
<< "-e" << "qmljsdebugger"
<< qmljsdebugger;
}
}

View File

@@ -111,6 +111,7 @@ protected:
QString m_extraAppParams;
Utils::Environment m_extraEnvVars;
QString m_gdbserverPath;
bool m_useAppParamsForQmlDebugger = false;
};
} // namespace Internal

View File

@@ -203,9 +203,12 @@ Replacements replacements(const Utils::FileName &fileName,
extraOffset = Utils::Text::utf8NthLineOffset(
block->document(), buffer, block->blockNumber() - kMaxLinesFromCurrentBlock);
}
buffer = buffer.mid(extraOffset,
std::min(buffer.size(), utf8Offset + kMaxLinesFromCurrentBlock)
- extraOffset);
int endOffset = Utils::Text::utf8NthLineOffset(
block->document(), buffer, block->blockNumber() + kMaxLinesFromCurrentBlock);
if (endOffset == -1)
endOffset = buffer.size();
buffer = buffer.mid(extraOffset, endOffset - extraOffset);
utf8Offset -= extraOffset;
const int emptySpaceLength = previousEmptyLinesLength(*block);

View File

@@ -138,6 +138,8 @@ void ClangToolsUnitTests::testProject_data()
QTest::addColumn<QString>("projectFilePath");
QTest::addColumn<int>("expectedDiagCount");
// For the simple project, we expect the following warning:
// warning: use nullptr [modernize-use-nullptr]
addTestRow("simple/simple.qbs", 1);
addTestRow("simple/simple.pro", 1);
@@ -147,8 +149,12 @@ void ClangToolsUnitTests::testProject_data()
addTestRow("stdc++11-includes/stdc++11-includes.qbs", 0);
addTestRow("stdc++11-includes/stdc++11-includes.pro", 0);
addTestRow("qt-widgets-app/qt-widgets-app.qbs", 0);
addTestRow("qt-widgets-app/qt-widgets-app.pro", 0);
// For qt-widgets-app, we expect the following warning for "a.exec()",
// "a" being the QApplication object:
// warning: static member accessed through instance
// [readability-static-accessed-through-instance]
addTestRow("qt-widgets-app/qt-widgets-app.qbs", 1);
addTestRow("qt-widgets-app/qt-widgets-app.pro", 1);
addTestRow("qt-essential-includes/qt-essential-includes.qbs", 0);
addTestRow("qt-essential-includes/qt-essential-includes.pro", 0);

View File

@@ -504,7 +504,8 @@ static QByteArray msCompatibilityVersionFromDefines(const ProjectExplorer::Macro
void CompilerOptionsBuilder::addMsvcCompatibilityVersion()
{
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID
|| m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) {
const ProjectExplorer::Macros macros = m_projectPart.toolChainMacros
+ m_projectPart.projectMacros;
const QByteArray msvcVersion = msCompatibilityVersionFromDefines(macros);

View File

@@ -205,10 +205,10 @@ void LanguageClientManager::reportFinished(const MessageId &id, BaseClient *byCl
void LanguageClientManager::deleteClient(BaseClient *client)
{
QTC_ASSERT(client, return);
client->disconnect(managerInstance);
client->disconnect();
managerInstance->removeMarks(client->id());
managerInstance->m_clients.removeAll(client);
delete client;
client->deleteLater();
}
void LanguageClientManager::shutdown()

View File

@@ -1083,6 +1083,10 @@ void GccToolChainConfigWidget::applyImpl()
tc->setDisplayName(displayName); // reset display name
tc->setPlatformCodeGenFlags(splitString(m_platformCodeGenFlagsLineEdit->text()));
tc->setPlatformLinkerFlags(splitString(m_platformLinkerFlagsLineEdit->text()));
if (m_macros.isEmpty())
return;
tc->m_predefinedMacrosCache
->insert(tc->platformCodeGenFlags(),
ToolChain::MacroInspectionReport{m_macros,

View File

@@ -598,6 +598,8 @@ QList<Task> QmakeProject::projectIssues(const Kit *k) const
QList<Task> result = Project::projectIssues(k);
if (!QtSupport::QtKitInformation::qtVersion(k))
result.append(createProjectTask(Task::TaskType::Error, tr("No Qt version set in kit.")));
else if (!QtSupport::QtKitInformation::qtVersion(k)->isValid())
result.append(createProjectTask(Task::TaskType::Error, tr("Qt version is invalid.")));
if (!ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID))
result.append(createProjectTask(Task::TaskType::Error, tr("No C++ compiler set in kit.")));
return result;

View File

@@ -89,14 +89,19 @@ QVariant ModelAdapter::data(const QModelIndex &index, int role) const
if (!index.isValid() || index.row() >= m_completionModel->size())
return QVariant();
if (role == Qt::DisplayRole)
return m_completionModel->text(index.row());
else if (role == Qt::DecorationRole)
if (role == Qt::DisplayRole) {
const QString text = m_completionModel->text(index.row());
const int lineBreakPos = text.indexOf('\n');
if (lineBreakPos < 0)
return text;
return QString(text.leftRef(lineBreakPos) + QLatin1String(" (...)"));
} else if (role == Qt::DecorationRole) {
return m_completionModel->icon(index.row());
else if (role == Qt::WhatsThisRole)
} else if (role == Qt::WhatsThisRole) {
return m_completionModel->detail(index.row());
else if (role == Qt::UserRole)
} else if (role == Qt::UserRole) {
return m_completionModel->proposalItem(index.row())->requiresFixIts();
}
return QVariant();
}

View File

@@ -425,14 +425,24 @@ ToolTipInfo ToolTipInfoCollector::qDocInfo(const Cursor &cursor) const
return result;
}
if (cursor.kind() == CXCursor_VarDecl || cursor.kind() == CXCursor_FieldDecl) {
result.qdocMark = typeName(cursor.type());
if (cursor.kind() == CXCursor_VarDecl || cursor.kind() == CXCursor_ParmDecl
|| cursor.kind() == CXCursor_FieldDecl) {
// maybe template instantiation
if (cursor.type().kind() == CXType_Unexposed && cursor.type().canonical().kind() == CXType_Record) {
result.qdocIdCandidates = qDocIdCandidates(cursor.type().canonical().declaration());
result.qdocMark = typeName(cursor.type());
result.qdocCategory = ToolTipInfo::ClassOrNamespace;
return result;
}
Type type = cursor.type();
while (type.pointeeType().isValid())
type = type.pointeeType();
const Cursor typeCursor = type.declaration();
result.qdocIdCandidates = qDocIdCandidates(typeCursor);
result.qdocCategory = qdocCategory(typeCursor);
result.qdocMark = typeName(type);
}
// TODO: Handle also RValueReference()

View File

@@ -25,6 +25,13 @@
source("../../shared/qtcreator.py")
import time
def delayedType(editor, text):
for c in text:
type(editor, c)
time.sleep(0.1)
# entry of test
def main():
for useClang in [False, True]:
@@ -46,15 +53,10 @@ def main():
# Focus "class derived from QObject" in the list and press Tab or Enter to complete the code.
editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
mouseClick(editorWidget, 5, 5, 0, Qt.LeftButton)
jumpToFirstLine(editorWidget)
type(editorWidget, "<Return>")
type(editorWidget, "<Up>")
type(editorWidget, "class")
if useClang and JIRA.isBugStillOpen(18769):
snooze(4)
if platform.system() == "Darwin":
type(editorWidget, "<Meta+Space>")
else:
type(editorWidget, "<Ctrl+Space>")
delayedType(editorWidget, "class")
listView = waitForObject(":popupFrame_Proposal_QListView")
shownProposals = dumpItems(listView.model())
usedProposal = "class derived from QObject"

View File

@@ -584,6 +584,18 @@ TEST_F(ToolTipInfo, AutoTypeBuiltin)
ASSERT_THAT(actual.text, Utf8StringLiteral("int"));
}
TEST_F(ToolTipInfo, PointerToPointerToClass)
{
::ToolTipInfo expected(Utf8StringLiteral("Nuu **"));
expected.qdocIdCandidates = {Utf8StringLiteral("Nuu")};
expected.qdocMark = Utf8StringLiteral("Nuu");
expected.qdocCategory = ::ToolTipInfo::ClassOrNamespace;
const ::ToolTipInfo actual = tooltip(200, 12);
ASSERT_THAT(actual, IsToolTip(expected));
}
// TODO: Test for qdoc entries, too.
TEST_F(ToolTipInfo, AutoTypeEnum)
{

View File

@@ -446,7 +446,9 @@ TEST_F(CompilerOptionsBuilder, BuildAllOptions)
ElementsAre(
"-nostdlibinc", "-c", "-m64", "-target", "x86_64-apple-darwin10",
"-arch", "x86_64", "-x", "c++", "-std=c++17", "-fcxx-exceptions",
"-fexceptions", "-Dfoo=bar", "-DprojectFoo=projectBar", "-undef",
"-fexceptions", "-Dfoo=bar", "-DprojectFoo=projectBar",
"-DBOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING=(39, 1, true, \"T = \")",
"-undef",
"-I", IsPartOfHeader("wrappedQtHeaders"),
"-I", IsPartOfHeader(QDir::toNativeSeparators("wrappedQtHeaders/QtCore").toStdString()),
"-I", QDir::toNativeSeparators("/tmp/path"),

View File

@@ -194,3 +194,8 @@ void constructor()
ExplicitCon();
ExplicitCon(2);
}
Nuu **pointers(Nuu **p1)
{
return p1;
}