Merge remote-tracking branch 'origin/3.6'

Conflicts:
	src/plugins/baremetal/gdbserverproviderprocess.cpp

Change-Id: I1ba618db9db6669edada6477c05a1b56b7b5b430
This commit is contained in:
Eike Ziller
2015-12-07 15:55:17 +01:00
41 changed files with 464 additions and 227 deletions

View File

@@ -57,7 +57,7 @@
the QML file). The image appears in \uicontrol Resources. You can also use the QML file). The image appears in \uicontrol Resources. You can also use
any other image or a QML type, instead. any other image or a QML type, instead.
\list a \list 1
\li In the \uicontrol Projects view, double-click the MainForm.ui.qml \li In the \uicontrol Projects view, double-click the MainForm.ui.qml
file to open it in \QMLD. file to open it in \QMLD.

View File

@@ -1,8 +1,8 @@
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included") !isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1 QTCREATOR_PRI_INCLUDED = 1
QTCREATOR_VERSION = 3.5.82 QTCREATOR_VERSION = 3.6.0
QTCREATOR_COMPAT_VERSION = 3.5.82 QTCREATOR_COMPAT_VERSION = 3.6.0
BINARY_ARTIFACTS_BRANCH = 3.6 BINARY_ARTIFACTS_BRANCH = 3.6
# enable c++11 # enable c++11

View File

@@ -5,12 +5,12 @@ Project {
minimumQbsVersion: "1.4.3" minimumQbsVersion: "1.4.3"
property bool withAutotests: qbs.buildVariant === "debug" property bool withAutotests: qbs.buildVariant === "debug"
property string ide_version_major: '3' property string ide_version_major: '3'
property string ide_version_minor: '5' property string ide_version_minor: '6'
property string ide_version_release: '82' property string ide_version_release: '0'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property string ide_compat_version_major: '3' property string ide_compat_version_major: '3'
property string ide_compat_version_minor: '5' property string ide_compat_version_minor: '6'
property string ide_compat_version_release: '82' property string ide_compat_version_release: '0'
property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
property path ide_source_tree: path property path ide_source_tree: path
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin" property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"

View File

@@ -471,7 +471,7 @@ class Dumper(DumperBase):
self.put('type="%s",' % typeName) # str(type.unqualified()) ? self.put('type="%s",' % typeName) # str(type.unqualified()) ?
if self.currentValue.value is None: if self.currentValue.value is None:
self.put('value="",encoding="%d","numchild="0",' self.put('value="",encoding="%d",numchild="0",'
% SpecialNotAccessibleValue) % SpecialNotAccessibleValue)
else: else:
if not self.currentValue.encoding is None: if not self.currentValue.encoding is None:
@@ -1633,7 +1633,11 @@ class Dumper(DumperBase):
symtab = sal.symtab symtab = sal.symtab
if not symtab is None: if not symtab is None:
objfile = fromNativePath(symtab.objfile.filename) objfile = fromNativePath(symtab.objfile.filename)
fileName = fromNativePath(symtab.fullname()) fullname = symtab.fullname()
if fullname is None:
fileName = ""
else:
fileName = fromNativePath(fullname)
if self.nativeMixed and functionName == "qt_qmlDebugMessageAvailable": if self.nativeMixed and functionName == "qt_qmlDebugMessageAvailable":
interpreterStack = self.extractInterpreterStack() interpreterStack = self.extractInterpreterStack()

View File

@@ -1123,14 +1123,15 @@ class Dumper(DumperBase):
self.value = value self.value = value
baseObjects = [] baseObjects = []
# GetNumberOfDirectBaseClasses() includes(!) GetNumberOfVirtualBaseClasses()
# so iterating over .GetNumberOfDirectBaseClasses() is correct.
for i in xrange(value.GetType().GetNumberOfDirectBaseClasses()): for i in xrange(value.GetType().GetNumberOfDirectBaseClasses()):
baseClass = value.GetType().GetDirectBaseClassAtIndex(i).GetType() baseClass = value.GetType().GetDirectBaseClassAtIndex(i).GetType()
baseChildCount = baseClass.GetNumberOfFields() \ baseChildCount = baseClass.GetNumberOfFields() \
+ baseClass.GetNumberOfDirectBaseClasses() \ + baseClass.GetNumberOfDirectBaseClasses()
+ baseClass.GetNumberOfVirtualBaseClasses()
if baseChildCount: if baseChildCount:
baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(memberBase)))
memberBase += 1 memberBase += 1
baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(i)))
else: else:
# This base object is empty, but exists and will *not* be reported # This base object is empty, but exists and will *not* be reported
# by value.GetChildCount(). So manually report the empty base class. # by value.GetChildCount(). So manually report the empty base class.

View File

@@ -3744,29 +3744,6 @@ For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</sou
<translation>Определяет, получает ли флажок фокус при нажатии или нет.</translation> <translation>Определяет, получает ли флажок фокус при нажатии или нет.</translation>
</message> </message>
</context> </context>
<context>
<name>ClangCodeModel::Diagnostic</name>
<message>
<source>ignored</source>
<translation>пропущено</translation>
</message>
<message>
<source>note</source>
<translation>замечание</translation>
</message>
<message>
<source>warning</source>
<translation>предупреждение</translation>
</message>
<message>
<source>error</source>
<translation>ошибка</translation>
</message>
<message>
<source>fatal</source>
<translation>фатальная ошибка</translation>
</message>
</context>
<context> <context>
<name>ClangCodeModel::Internal::ClangCompletionAssistProcessor</name> <name>ClangCodeModel::Internal::ClangCompletionAssistProcessor</name>
<message> <message>
@@ -3775,13 +3752,6 @@ For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</sou
<translation>Находится в %1</translation> <translation>Находится в %1</translation>
</message> </message>
</context> </context>
<context>
<name>ClangCodeModel::Internal::ClangIndexer</name>
<message>
<source>Parsing C/C++/ObjC Files</source>
<translation>Разбор С/С++/ObjC файлов</translation>
</message>
</context>
<context> <context>
<name>ClangCodeModel::Internal::ClangProjectSettingsPropertiesPage</name> <name>ClangCodeModel::Internal::ClangProjectSettingsPropertiesPage</name>
<message> <message>
@@ -3815,14 +3785,6 @@ For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</sou
<source>Clang Settings</source> <source>Clang Settings</source>
<translation>Настройки Clang</translation> <translation>Настройки Clang</translation>
</message> </message>
<message>
<source>Header Files (*.h)</source>
<translation>Заголовочные файлы (*.h)</translation>
</message>
<message>
<source>All Files (*)</source>
<translation>Все файлы (*)</translation>
</message>
</context> </context>
<context> <context>
<name>ClangCodeModel::Internal::ModelManagerSupport</name> <name>ClangCodeModel::Internal::ModelManagerSupport</name>
@@ -3832,21 +3794,6 @@ For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</sou
<translation>Clang</translation> <translation>Clang</translation>
</message> </message>
</context> </context>
<context>
<name>ClangCodeModel::Internal::PchManager</name>
<message>
<source>Successfully generated PCH file &quot;%1&quot;.</source>
<translation>Успешно создан PCH-файл «%1».</translation>
</message>
<message>
<source>Failed to generate PCH file &quot;%1&quot;.</source>
<translation>Не удалось создать PCH-файл «%1».</translation>
</message>
<message>
<source>Precompiling</source>
<translation>Прекомпиляция</translation>
</message>
</context>
<context> <context>
<name>ClangFormatSettings</name> <name>ClangFormatSettings</name>
<message> <message>
@@ -17574,6 +17521,37 @@ You can choose between stashing the changes or discarding them.</source>
<translation>GLSL</translation> <translation>GLSL</translation>
</message> </message>
</context> </context>
<context>
<name>GridLayoutSpecifics</name>
<message>
<source>GridLayout</source>
<translation>GridLayout</translation>
</message>
<message>
<source>Columns</source>
<translation>Столбцы</translation>
</message>
<message>
<source>Rows</source>
<translation>Строки</translation>
</message>
<message>
<source>Flow</source>
<translation>Перетекание</translation>
</message>
<message>
<source>Layout Direction</source>
<translation>Направление компоновки</translation>
</message>
<message>
<source>Row Spacing</source>
<translation>Межстрочный интервал</translation>
</message>
<message>
<source>Column Spacing</source>
<translation>Межстолбцовый интервал</translation>
</message>
</context>
<context> <context>
<name>GridSpecifics</name> <name>GridSpecifics</name>
<message> <message>
@@ -24194,7 +24172,7 @@ Preselects a desktop Qt for building the application if available.</source>
</message> </message>
<message> <message>
<source>Stacked</source> <source>Stacked</source>
<translation type="unfinished">Уложеная</translation> <translation>Уложеная</translation>
</message> </message>
<message> <message>
<source>Make the new branch depend on the availability of the source branch.</source> <source>Make the new branch depend on the availability of the source branch.</source>
@@ -24218,11 +24196,11 @@ Preselects a desktop Qt for building the application if available.</source>
</message> </message>
<message> <message>
<source>Switch checkout</source> <source>Switch checkout</source>
<translation type="unfinished">Сменить выгружаемый каталог</translation> <translation>Сменить выгружаемый каталог</translation>
</message> </message>
<message> <message>
<source>Switch the checkout in the current directory to the new branch.</source> <source>Switch the checkout in the current directory to the new branch.</source>
<translation type="unfinished">Переключить выгружаемый каталог текущего каталога на новую.</translation> <translation>Переключить выгружаемый каталог текущего каталога на новую.</translation>
</message> </message>
<message> <message>
<source>Hardlink</source> <source>Hardlink</source>
@@ -24266,7 +24244,7 @@ Preselects a desktop Qt for building the application if available.</source>
</message> </message>
<message> <message>
<source>Bazaar Clone (Or Branch)</source> <source>Bazaar Clone (Or Branch)</source>
<translation type="unfinished">Клонирование Bazaar</translation> <translation>Клонирование Bazaar</translation>
</message> </message>
<message> <message>
<source>Module:</source> <source>Module:</source>

View File

@@ -39,10 +39,10 @@ namespace ClangBackEnd {
SourceLocationContainer::SourceLocationContainer(const Utf8String &filePath, SourceLocationContainer::SourceLocationContainer(const Utf8String &filePath,
uint line, uint line,
uint offset) uint column)
: filePath_(filePath), : filePath_(filePath),
line_(line), line_(line),
offset_(offset) column_(column)
{ {
} }
@@ -57,16 +57,16 @@ uint SourceLocationContainer::line() const
} }
uint SourceLocationContainer::offset() const uint SourceLocationContainer::column() const
{ {
return offset_; return column_;
} }
QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container) QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container)
{ {
out << container.filePath_; out << container.filePath_;
out << container.line_; out << container.line_;
out << container.offset_; out << container.column_;
return out; return out;
} }
@@ -75,7 +75,7 @@ QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container)
{ {
in >> container.filePath_; in >> container.filePath_;
in >> container.line_; in >> container.line_;
in >> container.offset_; in >> container.column_;
return in; return in;
} }
@@ -87,14 +87,16 @@ bool operator==(const SourceLocationContainer &first, const SourceLocationContai
bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second) bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second)
{ {
return first.offset_ != second.offset_ return first.line_ != second.line_
|| first.column_ != second.column_
|| first.filePath_ != second.filePath_; || first.filePath_ != second.filePath_;
} }
bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second) bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second)
{ {
return first.filePath_ < second.filePath_ return first.filePath_ < second.filePath_
|| (first.filePath_ == second.filePath_ && first.offset_ < second.offset_); || (first.filePath_ == second.filePath_ && first.line_ < second.line_)
|| (first.filePath_ == second.filePath_ && first.line_ == second.line_ && first.column_ < second.column_);
} }
QDebug operator<<(QDebug debug, const SourceLocationContainer &container) QDebug operator<<(QDebug debug, const SourceLocationContainer &container)
@@ -102,7 +104,7 @@ QDebug operator<<(QDebug debug, const SourceLocationContainer &container)
debug.nospace() << "SourceLocationContainer(" debug.nospace() << "SourceLocationContainer("
<< container.filePath() << ", " << container.filePath() << ", "
<< container.line() << ", " << container.line() << ", "
<< container.offset() << container.column()
<< ")"; << ")";
return debug; return debug;
} }
@@ -112,7 +114,7 @@ void PrintTo(const SourceLocationContainer &container, ::std::ostream* os)
*os << "[" *os << "["
<< container.filePath().constData() << ", " << container.filePath().constData() << ", "
<< container.line() << ", " << container.line() << ", "
<< container.offset() << container.column()
<< "]"; << "]";
} }
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -51,16 +51,16 @@ public:
SourceLocationContainer() = default; SourceLocationContainer() = default;
SourceLocationContainer(const Utf8String &filePath, SourceLocationContainer(const Utf8String &filePath,
uint line, uint line,
uint offset); uint column);
const Utf8String &filePath() const; const Utf8String &filePath() const;
uint line() const; uint line() const;
uint offset() const; uint column() const;
private: private:
Utf8String filePath_; Utf8String filePath_;
uint line_; uint line_;
uint offset_; uint column_;
}; };
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);

View File

@@ -513,7 +513,10 @@ static std::string commandLocals(ExtensionCommandContext &commandExtCtx,PCSTR ar
if (watchSynchronization) { if (watchSynchronization) {
watchesSymbolGroup = 0; watchesSymbolGroup = 0;
extCtx.discardWatchesSymbolGroup(); extCtx.discardWatchesSymbolGroup();
if (!watcherInameExpressionMap.empty()) { }
if (watchesSymbolGroup == 0
&& (!watcherInameExpressionMap.empty() || WatchesSymbolGroup::isWatchIname(iname))) {
// Force group into existence // Force group into existence
watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage); watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage);
if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(), if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(),
@@ -522,7 +525,6 @@ static std::string commandLocals(ExtensionCommandContext &commandExtCtx,PCSTR ar
return std::string(); return std::string();
} }
} }
}
// Pre-expand. // Pre-expand.
if (!expandedInames.empty()) { if (!expandedInames.empty()) {

View File

@@ -39,8 +39,9 @@ Rectangle {
property QtObject modelProxy property QtObject modelProxy
property QtObject zoomer property QtObject zoomer
property bool recursionGuard: false property bool recursionGuard: false
onWidthChanged: updateRangeMover()
function updateRange() { function updateZoomer() {
if (recursionGuard) if (recursionGuard)
return; return;
recursionGuard = true; recursionGuard = true;
@@ -54,9 +55,7 @@ Rectangle {
recursionGuard = false; recursionGuard = false;
} }
Connections { function updateRangeMover() {
target: zoomer
onRangeChanged: {
if (recursionGuard) if (recursionGuard)
return; return;
recursionGuard = true; recursionGuard = true;
@@ -72,6 +71,10 @@ Rectangle {
rangeMover.rangeRight = newRangeX + newWidth; rangeMover.rangeRight = newRangeX + newWidth;
recursionGuard = false; recursionGuard = false;
} }
Connections {
target: zoomer
onRangeChanged: updateRangeMover()
} }
TimeDisplay { TimeDisplay {
@@ -186,8 +189,8 @@ Rectangle {
RangeMover { RangeMover {
id: rangeMover id: rangeMover
visible: modelProxy.height > 0 visible: modelProxy.height > 0
onRangeLeftChanged: overview.updateRange() onRangeLeftChanged: overview.updateZoomer()
onRangeRightChanged: overview.updateRange() onRangeRightChanged: overview.updateZoomer()
} }
Rectangle { Rectangle {

View File

@@ -45,8 +45,11 @@ GdbServerProviderProcess::GdbServerProviderProcess(
const QSharedPointer<const ProjectExplorer::IDevice> &device, const QSharedPointer<const ProjectExplorer::IDevice> &device,
QObject *parent) QObject *parent)
: ProjectExplorer::DeviceProcess(device, parent) : ProjectExplorer::DeviceProcess(device, parent)
, m_process(new QProcess(this)) , m_process(new Utils::QtcProcess(this))
{ {
if (Utils::HostOsInfo::isWindowsHost())
m_process->setUseCtrlCStub(true);
connect(m_process, connect(m_process,
static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
this, &GdbServerProviderProcess::error); this, &GdbServerProviderProcess::error);
@@ -65,7 +68,10 @@ GdbServerProviderProcess::GdbServerProviderProcess(
void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments) void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments)
{ {
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return); QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
m_process->start(executable, arguments); QString args;
Utils::QtcProcess::addArgs(&args, arguments);
m_process->setCommand(executable, args);
m_process->start();
} }
void GdbServerProviderProcess::interrupt() void GdbServerProviderProcess::interrupt()

View File

@@ -33,6 +33,8 @@
#include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/devicesupport/deviceprocess.h>
namespace Utils { class QtcProcess; }
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {
@@ -64,7 +66,7 @@ public:
qint64 write(const QByteArray &data); qint64 write(const QByteArray &data);
private: private:
QProcess * const m_process; Utils::QtcProcess *m_process;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -38,6 +38,8 @@
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QTextBlock>
namespace { namespace {
QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainformat, QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainformat,
@@ -53,6 +55,14 @@ QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainforma
return extraSelection; return extraSelection;
} }
int positionInText(QTextDocument *textDocument,
const ClangBackEnd::SourceLocationContainer &sourceLocationContainer)
{
auto textBlock = textDocument->findBlockByNumber(int(sourceLocationContainer.line()) - 1);
return textBlock.position() + int(sourceLocationContainer.column()) - 1;
}
void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic, void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic,
QTextDocument *textDocument, QTextDocument *textDocument,
const QTextCharFormat &contextFormat, const QTextCharFormat &contextFormat,
@@ -61,8 +71,8 @@ void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic,
{ {
for (auto &&range : diagnostic.ranges()) { for (auto &&range : diagnostic.ranges()) {
QTextCursor cursor(textDocument); QTextCursor cursor(textDocument);
cursor.setPosition(int(range.start().offset())); cursor.setPosition(positionInText(textDocument, range.start()));
cursor.setPosition(int(range.end().offset()), QTextCursor::KeepAnchor); cursor.setPosition(positionInText(textDocument, range.end()), QTextCursor::KeepAnchor);
auto extraSelection = createExtraSelections(contextFormat, cursor, diagnosticText); auto extraSelection = createExtraSelections(contextFormat, cursor, diagnosticText);
@@ -70,14 +80,15 @@ void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic,
} }
} }
QTextCursor createSelectionCursor(QTextDocument *textDocument, uint position) QTextCursor createSelectionCursor(QTextDocument *textDocument,
const ClangBackEnd::SourceLocationContainer &sourceLocationContainer)
{ {
QTextCursor cursor(textDocument); QTextCursor cursor(textDocument);
cursor.setPosition(int(position)); cursor.setPosition(positionInText(textDocument, sourceLocationContainer));
cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
if (!cursor.hasSelection()) { if (!cursor.hasSelection()) {
cursor.setPosition(int(position) - 1); cursor.setPosition(positionInText(textDocument, sourceLocationContainer) - 1);
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2); cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
} }
@@ -122,7 +133,7 @@ void addSelections(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics
QList<QTextEdit::ExtraSelection> &extraSelections) QList<QTextEdit::ExtraSelection> &extraSelections)
{ {
for (auto &&diagnostic : diagnostics) { for (auto &&diagnostic : diagnostics) {
auto cursor = createSelectionCursor(textDocument, diagnostic.location().offset()); auto cursor = createSelectionCursor(textDocument, diagnostic.location());
auto text = diagnosticText(diagnostic); auto text = diagnosticText(diagnostic);
auto extraSelection = createExtraSelections(mainFormat, cursor, text); auto extraSelection = createExtraSelections(mainFormat, cursor, text);

View File

@@ -170,18 +170,37 @@ void ClangEditorDocumentProcessor::updateCodeWarnings(const QVector<ClangBackEnd
emit codeWarningsUpdated(revision(), codeWarnings); emit codeWarningsUpdated(revision(), codeWarnings);
} }
} }
namespace {
static QList<TextEditor::BlockRange> int positionInText(QTextDocument *textDocument,
toTextEditorBlocks(const QVector<ClangBackEnd::SourceRangeContainer> &ifdefedOutRanges) const ClangBackEnd::SourceLocationContainer &sourceLocationContainer)
{
auto textBlock = textDocument->findBlockByNumber(int(sourceLocationContainer.line()) - 1);
return textBlock.position() + int(sourceLocationContainer.column()) - 1;
}
TextEditor::BlockRange
toTextEditorBlock(QTextDocument *textDocument,
const ClangBackEnd::SourceRangeContainer &sourceRangeContainer)
{
return TextEditor::BlockRange(positionInText(textDocument, sourceRangeContainer.start()),
positionInText(textDocument, sourceRangeContainer.end()));
}
QList<TextEditor::BlockRange>
toTextEditorBlocks(QTextDocument *textDocument,
const QVector<ClangBackEnd::SourceRangeContainer> &ifdefedOutRanges)
{ {
QList<TextEditor::BlockRange> blockRanges; QList<TextEditor::BlockRange> blockRanges;
blockRanges.reserve(ifdefedOutRanges.size()); blockRanges.reserve(ifdefedOutRanges.size());
for (const auto &range : ifdefedOutRanges) for (const auto &range : ifdefedOutRanges)
blockRanges.append(TextEditor::BlockRange(range.start().offset(),range.end().offset())); blockRanges.append(toTextEditorBlock(textDocument, range));
return blockRanges; return blockRanges;
} }
}
void ClangEditorDocumentProcessor::updateHighlighting( void ClangEditorDocumentProcessor::updateHighlighting(
const QVector<ClangBackEnd::HighlightingMarkContainer> &highlightingMarks, const QVector<ClangBackEnd::HighlightingMarkContainer> &highlightingMarks,
@@ -189,7 +208,7 @@ void ClangEditorDocumentProcessor::updateHighlighting(
uint documentRevision) uint documentRevision)
{ {
if (documentRevision == revision()) { if (documentRevision == revision()) {
const auto skippedPreprocessorBlocks = toTextEditorBlocks(skippedPreprocessorRanges); const auto skippedPreprocessorBlocks = toTextEditorBlocks(textDocument(), skippedPreprocessorRanges);
emit ifdefedOutBlocksUpdated(documentRevision, skippedPreprocessorBlocks); emit ifdefedOutBlocksUpdated(documentRevision, skippedPreprocessorBlocks);
m_semanticHighlighter.setHighlightingRunner( m_semanticHighlighter.setHighlightingRunner(

View File

@@ -32,6 +32,8 @@
#include <texteditor/refactoringchanges.h> #include <texteditor/refactoringchanges.h>
#include <QTextDocument>
namespace ClangCodeModel { namespace ClangCodeModel {
ClangFixItOperation::ClangFixItOperation(const Utf8String &filePath, ClangFixItOperation::ClangFixItOperation(const Utf8String &filePath,
@@ -56,19 +58,26 @@ QString ClangCodeModel::ClangFixItOperation::description() const
void ClangFixItOperation::perform() void ClangFixItOperation::perform()
{ {
const TextEditor::RefactoringChanges refactoringChanges; const TextEditor::RefactoringChanges refactoringChanges;
TextEditor::RefactoringFilePtr refactoringFile = refactoringChanges.file(filePath.toString()); refactoringFile = refactoringChanges.file(filePath.toString());
refactoringFile->setChangeSet(changeSet()); refactoringFile->setChangeSet(changeSet());
refactoringFile->apply(); refactoringFile->apply();
} }
QString ClangFixItOperation::refactoringFileContent_forTestOnly() const
{
return refactoringFile->document()->toPlainText();
}
Utils::ChangeSet ClangFixItOperation::changeSet() const Utils::ChangeSet ClangFixItOperation::changeSet() const
{ {
Utils::ChangeSet changeSet; Utils::ChangeSet changeSet;
for (const auto &fixItContainer : fixItContainers) { for (const auto &fixItContainer : fixItContainers) {
const auto range = fixItContainer.range(); const auto range = fixItContainer.range();
changeSet.replace(range.start().offset(), const auto start = range.start();
range.end().offset(), const auto end = range.end();
changeSet.replace(refactoringFile->position(start.line(), start.column()),
refactoringFile->position(end.line(), end.column()),
fixItContainer.text()); fixItContainer.text());
} }

View File

@@ -34,9 +34,16 @@
#include <texteditor/quickfix.h> #include <texteditor/quickfix.h>
#include <clangbackendipc/fixitcontainer.h> #include <clangbackendipc/fixitcontainer.h>
#include <utils/changeset.h> #include <utils/changeset.h>
#include <QVector> #include <QVector>
#include <QSharedPointer>
namespace TextEditor
{
class RefactoringFile;
}
namespace ClangCodeModel { namespace ClangCodeModel {
@@ -51,11 +58,15 @@ public:
QString description() const override; QString description() const override;
void perform() override; void perform() override;
QString refactoringFileContent_forTestOnly() const;
private:
Utils::ChangeSet changeSet() const; Utils::ChangeSet changeSet() const;
private: private:
Utf8String filePath; Utf8String filePath;
Utf8String fixItText; Utf8String fixItText;
QSharedPointer<TextEditor::RefactoringFile> refactoringFile;
QVector<ClangBackEnd::FixItContainer> fixItContainers; QVector<ClangBackEnd::FixItContainer> fixItContainers;
}; };

View File

@@ -62,6 +62,8 @@ CppTools::SemanticHighlighter::Kind toCppToolsSemanticHighlighterKind(
case HighlightingType::Label: case HighlightingType::Label:
return SemanticHighlighter::LabelUse; return SemanticHighlighter::LabelUse;
case HighlightingType::Preprocessor: case HighlightingType::Preprocessor:
case HighlightingType::PreprocessorDefinition:
case HighlightingType::PreprocessorExpansion:
return SemanticHighlighter::MacroUse; return SemanticHighlighter::MacroUse;
default: default:
return SemanticHighlighter::Unknown; return SemanticHighlighter::Unknown;

View File

@@ -3218,9 +3218,10 @@ void GdbEngine::loadAdditionalQmlStack()
return; return;
} }
// Call the debug function of QML with the context address to obtain the QML stack trace. // Call the debug function of QML with the context address to obtain the QML stack trace.
runCommand({"-data-evaluate-expression \"qt_v4StackTrace((QV4::ExecutionContext *)0x" DebuggerCommand cmd("-data-evaluate-expression \"qt_v4StackTrace((QV4::ExecutionContext *)0x"
+ QByteArray::number(contextAddress, 16) + ")\"", + QByteArray::number(contextAddress, 16) + ")\"");
NoFlags, CB(handleQmlStackTrace)}); cmd.callback = CB(handleQmlStackTrace);
runCommand(cmd);
}; };
runCommand(cmd); runCommand(cmd);
} }

View File

@@ -749,9 +749,10 @@ BuildConfiguration *QmakeBuildConfigurationFactory::restore(Target *parent, cons
BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
{ {
QMakeStep *qs = qmakeStep();
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild) if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
return Debug; return Debug;
else if (qmakeStep()->separateDebugInfo()) else if (qs && qs->separateDebugInfo())
return Profile; return Profile;
else else
return Release; return Release;

View File

@@ -923,8 +923,8 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
if (bc) { if (bc) {
k = bc->target()->kit(); k = bc->target()->kit();
env = bc->environment(); env = bc->environment();
if (bc->qmakeStep()) if (QMakeStep *qs = bc->qmakeStep())
qmakeArgs = bc->qmakeStep()->parserArguments(); qmakeArgs = qs->parserArguments();
else else
qmakeArgs = bc->configCommandLineArguments(); qmakeArgs = bc->configCommandLineArguments();
} else { } else {

View File

@@ -375,7 +375,7 @@ void QmlJSHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPo
else if (m_colorTip.isValid()) else if (m_colorTip.isValid())
Utils::ToolTip::show(point, m_colorTip, editorWidget); Utils::ToolTip::show(point, m_colorTip, editorWidget);
else else
Utils::ToolTip::show(point, toolTip(), editorWidget); BaseHoverHandler::operateTooltip(editorWidget, point);
} }
void QmlJSHoverHandler::prettyPrintTooltip(const Value *value, void QmlJSHoverHandler::prettyPrintTooltip(const Value *value,

View File

@@ -123,9 +123,9 @@ ResourceTopLevelNode::ResourceTopLevelNode(const Utils::FileName &filePath, Fold
Utils::FileName base = parent->filePath(); Utils::FileName base = parent->filePath();
if (filePath.isChildOf(base)) if (filePath.isChildOf(base))
setDisplayName(filePath.relativeChildPath(base).toString()); setDisplayName(filePath.relativeChildPath(base).toUserOutput());
else else
setDisplayName(filePath.toString()); setDisplayName(filePath.toUserOutput());
} }
ResourceTopLevelNode::~ResourceTopLevelNode() ResourceTopLevelNode::~ResourceTopLevelNode()

View File

@@ -65,13 +65,13 @@ protected:
void setLastHelpItemIdentified(const HelpItem &help); void setLastHelpItemIdentified(const HelpItem &help);
const HelpItem &lastHelpItemIdentified() const; const HelpItem &lastHelpItemIdentified() const;
virtual void decorateToolTip();
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
private: private:
void clear(); void clear();
void process(TextEditorWidget *widget, int pos); void process(TextEditorWidget *widget, int pos);
virtual void identifyMatch(TextEditorWidget *editorWidget, int pos) = 0; virtual void identifyMatch(TextEditorWidget *editorWidget, int pos) = 0;
virtual void decorateToolTip();
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
bool m_diagnosticTooltip; bool m_diagnosticTooltip;
QString m_toolTip; QString m_toolTip;

View File

@@ -229,7 +229,7 @@ int TabSettings::columnCountForText(const QString &text, int startColumn) const
int TabSettings::spacesLeftFromPosition(const QString &text, int position) int TabSettings::spacesLeftFromPosition(const QString &text, int position)
{ {
if (position >= text.size()) if (position > text.size())
return 0; return 0;
int i = position; int i = position;
while (i > 0) { while (i > 0) {

View File

@@ -5476,26 +5476,25 @@ void TextEditorWidget::wheelEvent(QWheelEvent *e)
return; return;
} }
const int delta = e->delta(); const float delta = e->angleDelta().y() / 120.f;
if (delta < 0) if (delta != 0)
zoomOut(); zoomF(delta);
else if (delta > 0)
zoomIn();
return; return;
} }
QPlainTextEdit::wheelEvent(e); QPlainTextEdit::wheelEvent(e);
} }
void TextEditorWidget::zoomIn() void TextEditorWidget::zoomF(float delta)
{ {
d->clearVisibleFoldedBlock(); d->clearVisibleFoldedBlock();
emit requestFontZoom(10); float step = 10.f * delta;
} // Ensure we always zoom a minimal step in-case the resolution is more than 16x
if (step > 0 && step < 1)
step = 1;
else if (step < 0 && step > -1)
step = -1;
void TextEditorWidget::zoomOut() emit requestFontZoom(step);
{
d->clearVisibleFoldedBlock();
emit requestFontZoom(-10);
} }
void TextEditorWidget::zoomReset() void TextEditorWidget::zoomReset()

View File

@@ -378,8 +378,7 @@ public:
void circularPaste(); void circularPaste();
void switchUtf8bom(); void switchUtf8bom();
void zoomIn(); void zoomF(float delta);
void zoomOut();
void zoomReset(); void zoomReset();
void cutLine(); void cutLine();

View File

@@ -130,6 +130,7 @@ HighlightingType HighlightingInformation::referencedTypeKind(const Cursor &curso
case CXCursor_ClassDecl: case CXCursor_ClassDecl:
case CXCursor_StructDecl: case CXCursor_StructDecl:
case CXCursor_UnionDecl: case CXCursor_UnionDecl:
case CXCursor_TypedefDecl:
case CXCursor_TemplateTypeParameter: case CXCursor_TemplateTypeParameter:
case CXCursor_TypeAliasDecl: return HighlightingType::Type; case CXCursor_TypeAliasDecl: return HighlightingType::Type;
case CXCursor_EnumDecl: return HighlightingType::Enumeration; case CXCursor_EnumDecl: return HighlightingType::Enumeration;
@@ -205,8 +206,8 @@ HighlightingType HighlightingInformation::identifierKind(const Cursor &cursor) c
case CXCursor_NamespaceRef: case CXCursor_NamespaceRef:
case CXCursor_NamespaceAlias: case CXCursor_NamespaceAlias:
case CXCursor_TypeAliasDecl: case CXCursor_TypeAliasDecl:
case CXCursor_TypedefDecl:
case CXCursor_ClassTemplate: case CXCursor_ClassTemplate:
case CXCursor_UnexposedDecl:
case CXCursor_CXXStaticCastExpr: case CXCursor_CXXStaticCastExpr:
case CXCursor_CXXReinterpretCastExpr: case CXCursor_CXXReinterpretCastExpr:
case CXCursor_ObjCCategoryDecl: case CXCursor_ObjCCategoryDecl:

View File

@@ -67,7 +67,7 @@ uint SourceLocation::offset() const
SourceLocationContainer SourceLocation::toSourceLocationContainer() const SourceLocationContainer SourceLocation::toSourceLocationContainer() const
{ {
return SourceLocationContainer(filePath_, line_, offset_); return SourceLocationContainer(filePath_, line_, column_);
} }
SourceLocation::SourceLocation(CXSourceLocation cxSourceLocation) SourceLocation::SourceLocation(CXSourceLocation cxSourceLocation)
@@ -94,7 +94,8 @@ SourceLocation::SourceLocation(CXTranslationUnit cxTranslationUnit,
line, line,
column)), column)),
filePath_(filePath), filePath_(filePath),
line_(line) line_(line),
column_(column)
{ {
} }

View File

@@ -5670,11 +5670,18 @@ void tst_Dumpers::dumper_data()
"struct Data { Data() : a(42) {} int a; };\n" "struct Data { Data() : a(42) {} int a; };\n"
"struct VEmpty {};\n" "struct VEmpty {};\n"
"struct VData { VData() : v(42) {} int v; };\n" "struct VData { VData() : v(42) {} int v; };\n"
"struct S1 : Empty, Data, virtual VEmpty, virtual VData\n" "struct S1 : Empty, Data, virtual VEmpty, virtual VData\n"
" { S1() : i1(1) {} int i1; };\n" " { S1() : i1(1) {} int i1; };\n"
"struct S2 : Empty, Data, virtual VEmpty, virtual VData\n" "struct S2 : Empty, Data, virtual VEmpty, virtual VData\n"
" { S2() : i2(1) {} int i2; };\n" " { S2() : i2(1) {} int i2; };\n"
"struct Combined : S1, S2 { Combined() : c(1) {} int c; };\n"; "struct Combined : S1, S2 { Combined() : c(1) {} int c; };\n"
"struct T1 : virtual VEmpty, virtual VData\n"
" { T1() : i1(1) {} int i1; };\n"
"struct T2 : virtual VEmpty, virtual VData\n"
" { T2() : i2(1) {} int i2; };\n"
"struct TT : T1, T2 { TT() : c(1) {} int c; };\n";
QTest::newRow("Inheritance") QTest::newRow("Inheritance")
<< Data(inheritanceData, << Data(inheritanceData,
@@ -5683,30 +5690,19 @@ void tst_Dumpers::dumper_data()
"c.S2::a = 43;\n" "c.S2::a = 43;\n"
"c.S1::v = 44;\n" "c.S1::v = 44;\n"
"c.S2::v = 45;\n" "c.S2::v = 45;\n"
"unused(&c.S2::v);\n") "unused(&c.S2::v);\n"
+ NoLldbEngine "TT tt;\n"
"tt.T1::v = 44;\n"
"tt.T2::v = 45;\n"
"unused(&tt.T2::v);\n")
+ Check("c.c", "1", "int") + Check("c.c", "1", "int")
+ Check("c.@1.@1.a", "42", "int") + Check("c.@1.@1.a", "42", "int")
+ Check("c.@1.@3.v", "45", "int") + Check("c.@1.@3.v", "45", "int")
+ Check("c.@2.@1.a", "43", "int") + Check("c.@2.@1.a", "43", "int")
+ Check("c.@2.@3.v", "45", "int"); + Check("c.@2.@3.v", "45", "int")
+ Check("tt.c", "1", "int")
// FIXME: Virtual inheritance doesn't work with LLDB 300 + Check("tt.@1.@1.v", "45", "int")
QTest::newRow("InheritanceLldb") + Check("tt.@2.@1.v", "45", "int");
<< Data(inheritanceData,
"Combined c;\n"
"c.S1::a = 42;\n"
"c.S2::a = 43;\n"
"c.S1::v = 44;\n"
"c.S2::v = 45;\n"
"unused(&c.S2::v);\n")
+ LldbEngine
+ Check("c.c", "1", "int")
+ Check("c.@1.@1.a", "42", "int")
//+ Check("c.@1.@4.v", "45", "int")
+ Check("c.@2.@1.a", "43", "int");
//+ Check("c.@2.@4.v", "45", "int");
QTest::newRow("Gdb13393") QTest::newRow("Gdb13393")
<< Data( << Data(

View File

@@ -49,6 +49,11 @@ class Targets:
desktopTargets &= ~Targets.DESKTOP_541_GCC desktopTargets &= ~Targets.DESKTOP_541_GCC
return desktopTargets return desktopTargets
@staticmethod
def qt4Classes():
return (Targets.DESKTOP_474_GCC & Targets.DESKTOP_480_DEFAULT
& Targets.SIMULATOR & Targets.EMBEDDED_LINUX)
@staticmethod @staticmethod
def getStringForTarget(target): def getStringForTarget(target):
if target == Targets.DESKTOP_474_GCC: if target == Targets.DESKTOP_474_GCC:

View File

@@ -64,11 +64,26 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
return checkedTargets return checkedTargets
def openCmakeProject(projectPath, buildDir): def openCmakeProject(projectPath, buildDir):
def additionalFunction():
pChooser = waitForObject("{leftWidget={text='Default' type='QCheckBox' unnamed='1' "
"visible='1'} type='Utils::PathChooser' unnamed='1' visible='1'}")
lineEdit = getChildByClass(pChooser, "Utils::FancyLineEdit")
replaceEditorContent(lineEdit, buildDir)
# disable all build configurations except "Default"
configs = ['Debug', 'Release', 'Release with Debug Information', 'Minimum Size Release']
for checkbox in configs:
ensureChecked(waitForObject("{text='%s' type='QCheckBox' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"
% checkbox), False)
ensureChecked(waitForObject("{text='Default' type='QCheckBox' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"), True)
invokeMenuItem("File", "Open File or Project...") invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath) selectFromFileDialog(projectPath)
replaceEditorContent("{type='Utils::FancyLineEdit' unnamed='1' visible='1'" __chooseTargets__(0) # uncheck all
"window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}", buildDir) __chooseTargets__(Targets.DESKTOP_480_DEFAULT, additionalFunc=additionalFunction)
clickButton(waitForObject(":CMake Wizard.Next_QPushButton")) clickButton(waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'"
"window=':Qt Creator_Core::Internal::MainWindow'}"))
return __handleCmakeWizardPage__() return __handleCmakeWizardPage__()
def __handleCmakeWizardPage__(): def __handleCmakeWizardPage__():
@@ -403,7 +418,10 @@ def createNewQtPlugin(projectDir=None, projectName=None, className=None, fromWel
# parameter target can be an OR'd value of Targets # parameter target can be an OR'd value of Targets
# parameter availableTargets should be the result of __createProjectOrFileSelectType__() # parameter availableTargets should be the result of __createProjectOrFileSelectType__()
# or use None as a fallback # or use None as a fallback
def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None): # parameter additionalFunc function to be executed inside the detailed view of each chosen kit
# if present, 'Details' button will be clicked, function will be executed,
# 'Details' button will be clicked again
def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None, additionalFunc=None):
if availableTargets != None: if availableTargets != None:
available = availableTargets available = availableTargets
else: else:
@@ -419,8 +437,19 @@ def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None):
try: try:
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current), ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current),
mustCheck, 3000) mustCheck, 3000)
if (mustCheck): if mustCheck:
checkedTargets.append(current) checkedTargets.append(current)
# perform additional function on detailed kits view
if additionalFunc:
detailsWidget = waitForObject("{type='Utils::DetailsWidget' unnamed='1' "
"window=':Qt Creator_Core::Internal::MainWindow' "
"toolTip?='<html><body><h3>%s</h3>*' visible='1'}"
% Targets.getStringForTarget(current))
detailsButton = getChildByClass(detailsWidget, "Utils::DetailsButton")
clickButton(detailsButton)
additionalFunc()
clickButton(detailsButton)
except LookupError: except LookupError:
if mustCheck: if mustCheck:
test.fail("Failed to check target '%s'." % Targets.getStringForTarget(current)) test.fail("Failed to check target '%s'." % Targets.getStringForTarget(current))

View File

@@ -261,6 +261,7 @@ class JIRA:
def __initBugDict__(self): def __initBugDict__(self):
self.__bugs__= { self.__bugs__= {
'QTCREATORBUG-6853':self._workaroundCreator6853_, 'QTCREATORBUG-6853':self._workaroundCreator6853_,
'QTCREATORBUG-15456':self._workaroundCreator15456_,
} }
# helper function - will be called if no workaround for the requested bug is deposited # helper function - will be called if no workaround for the requested bug is deposited
def _exitFatal_(self, bugType, number): def _exitFatal_(self, bugType, number):
@@ -271,3 +272,13 @@ class JIRA:
def _workaroundCreator6853_(self, *args): def _workaroundCreator6853_(self, *args):
if "Release" in args[0] and platform.system() == "Linux": if "Release" in args[0] and platform.system() == "Linux":
snooze(2) snooze(2)
def _workaroundCreator15456_(self, *args):
isMsvc = args[0]
isQt5 = args[1]
config = args[2]
if isMsvc and isQt5 and config != "Release":
unexpectedExitMessage = ("{type='QMessageBox' unnamed='1' visible='1' "
"windowTitle='Unexpected CDB Exit'}")
clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' "
"visible='1' window=%s}" % unexpectedExitMessage))

View File

@@ -60,7 +60,7 @@ def main():
myCompTE = "SampleApp.Resources.qml\\.qrc./.MyComponent\\.qml" myCompTE = "SampleApp.Resources.qml\\.qrc./.MyComponent\\.qml"
# there should be new QML file generated with name "MyComponent.qml" # there should be new QML file generated with name "MyComponent.qml"
try: try:
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 3000) waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 5000)
except: except:
try: try:
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000) waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000)

View File

@@ -50,9 +50,9 @@ def main():
"#include <iostream>", "#include <iostream>",
"int main(int, char *argv[])", "int main(int, char *argv[])",
"{", "{",
' std::cout << \"' + outputStdOut + '\" << std::endl;', 'std::cout << \"' + outputStdOut + '\" << std::endl;',
' std::cerr << \"' + outputStdErr + '\" << std::endl;', 'std::cerr << \"' + outputStdErr + '\" << std::endl;',
' qDebug() << \"' + outputQDebug + '\";']) 'qDebug() << \"' + outputQDebug + '\";'])
# Rely on code completion for closing bracket # Rely on code completion for closing bracket
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
openDocument(project + "." + project + "\\.pro") openDocument(project + "." + project + "\\.pro")
@@ -63,6 +63,10 @@ def main():
if not availableConfigs: if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.") test.fatal("Haven't found a suitable Qt version - leaving without building.")
for kit, config in availableConfigs: for kit, config in availableConfigs:
if (checkedTargets[kit] == Targets.DESKTOP_480_DEFAULT
and config == "Profile" and JIRA.isBugStillOpen(15457)):
test.warning("Skipping MSVC build of Qt 4 because of QTCREATORBUG-15457.")
continue
selectBuildConfig(len(checkedTargets), kit, config) selectBuildConfig(len(checkedTargets), kit, config)
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
@@ -95,6 +99,8 @@ def main():
invokeMenuItem("Debug", "Start Debugging", "Start Debugging") invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
JIRA.performWorkaroundForBug(6853, JIRA.Bug.CREATOR, config) JIRA.performWorkaroundForBug(6853, JIRA.Bug.CREATOR, config)
handleDebuggerWarnings(config, isMsvc) handleDebuggerWarnings(config, isMsvc)
JIRA.performWorkaroundForBug(15456, JIRA.Bug.CREATOR, isMsvc,
checkedTargets[kit] & ~Targets.qt4Classes(), config)
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow") outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
waitFor("'Debugging has finished' in str(outputWindow.plainText)", 20000) waitFor("'Debugging has finished' in str(outputWindow.plainText)", 20000)

View File

@@ -132,9 +132,9 @@ def testHovering():
expectedTypes = ["TextTip", "TextTip"] expectedTypes = ["TextTip", "TextTip"]
expectedValues = [ expectedValues = [
{'text':'<table><tr><td valign=middle>FocusScope\n<p>The FocusScope object explicitly ' {'text':'<table><tr><td valign=middle>FocusScope\n<p>The FocusScope object explicitly '
'creates a focus scope.</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"></td></tr></table>'}, 'creates a focus scope.</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>Rectangle\n<p>The Rectangle item provides a filled rectangle with an ' {'text':'<table><tr><td valign=middle>Rectangle\n<p>The Rectangle item provides a filled rectangle with an '
'optional border.</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"></td></tr></table>'} 'optional border.</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
] ]
alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}] alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
@@ -147,14 +147,14 @@ def testHovering():
{'text':'<table><tr><td valign=middle>boolean<p>This property indicates whether the item has focus ' {'text':'<table><tr><td valign=middle>boolean<p>This property indicates whether the item has focus '
'within the enclosing focus scope. If true, this item will gain active focus when the enclosing ' 'within the enclosing focus scope. If true, this item will gain active focus when the enclosing '
'focus scope gains active focus. In the following example, <tt>input</tt> will be given active focus ' 'focus scope gains active focus. In the following example, <tt>input</tt> will be given active focus '
'when <tt>scope</tt> gains active focus.</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"' 'when <tt>scope</tt> gains active focus.</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"'
'></td></tr></table>'}, '></td></tr></table>'},
{'text':'<table><tr><td valign=middle>string<p>This property holds the color used to fill the rectangle.' {'text':'<table><tr><td valign=middle>string<p>This property holds the color used to fill the rectangle.'
'</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"></td></tr></table>'}, '</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>State<p>This property holds a list of states defined by the item.' {'text':'<table><tr><td valign=middle>State<p>This property holds a list of states defined by the item.'
'</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"></td></tr></table>'}, '</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>Transition<p>This property holds a list of transitions defined by ' {'text':'<table><tr><td valign=middle>Transition<p>This property holds a list of transitions defined by '
'the item.</p></td><td>&nbsp;&nbsp;<img src=":/texteditor/images/f1.png"></td></tr></table>'} 'the item.</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
] ]
alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}] alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)

View File

@@ -31,7 +31,20 @@
#ifndef REFACTORINGCHANGES_H #ifndef REFACTORINGCHANGES_H
#define REFACTORINGCHANGES_H #define REFACTORINGCHANGES_H
#include <QFile>
#include <QSharedPointer> #include <QSharedPointer>
#include <QTextBlock>
#include <QTextCursor>
#include <QTextDocument>
#include <utils/changeset.h>
#include <memory>
#include "gtest/gtest.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest-qt-printing.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;
@@ -47,20 +60,68 @@ class RefactoringFile;
class RefactoringChangesData; class RefactoringChangesData;
typedef QSharedPointer<RefactoringFile> RefactoringFilePtr; typedef QSharedPointer<RefactoringFile> RefactoringFilePtr;
using testing::NotNull;
class RefactoringFile class RefactoringFile
{ {
public: public:
void setChangeSet(const Utils::ChangeSet &) {} RefactoringFile(std::unique_ptr<QTextDocument> &&textDocument)
void apply() {} : textDocument(std::move(textDocument))
{
}
const QTextDocument *document() const
{
return textDocument.get();
}
void setChangeSet(const Utils::ChangeSet &changes)
{
this->changes = changes;
}
void apply()
{
QTextCursor textCursor(textDocument.get());
changes.apply(&textCursor);
changes.clear();
}
int position(uint line, uint column)
{
return textDocument->findBlockByNumber(uint(line) - 1).position() + int(column) - 1;
}
private:
std::unique_ptr<QTextDocument> textDocument;
Utils::ChangeSet changes;
}; };
QString readFile(const QString &filePath)
{
EXPECT_FALSE(filePath.isEmpty());
QFile file(filePath);
EXPECT_TRUE(file.open(QFile::ReadOnly));
auto content = file.readAll();
EXPECT_FALSE(content.isEmpty());
return QString::fromUtf8(content);
}
class RefactoringChanges class RefactoringChanges
{ {
public: public:
RefactoringChanges() {} RefactoringChanges() {}
virtual ~RefactoringChanges() {} virtual ~RefactoringChanges() {}
RefactoringFilePtr file(const QString &) const { return RefactoringFilePtr(); } RefactoringFilePtr file(const QString &filePath) const
{
return RefactoringFilePtr(new RefactoringFile(std::unique_ptr<QTextDocument>(new QTextDocument(readFile(filePath)))));
}
}; };
class RefactoringChangesData class RefactoringChangesData

View File

@@ -58,13 +58,12 @@ QString unsavedFileContent(const QString &unsavedFilePath)
return QString::fromUtf8(unsavedFileContentFile.readAll()); return QString::fromUtf8(unsavedFileContentFile.readAll());
} }
MATCHER_P2(MatchText, errorText, expectedText, MATCHER_P(MatchText, expectedText,
std::string(negation ? "hasn't" : "has") + " error text:\n" + PrintToString(errorText) + std::string(negation ? "hasn't" : "has")
" and expected text:\n" + PrintToString(expectedText)) + " expected text:\n" + PrintToString(expectedText))
{ {
QString resultText = errorText; const ::ClangFixItOperation &operation = arg;
Utils::ChangeSet changeSet = arg.changeSet(); QString resultText = operation.refactoringFileContent_forTestOnly();
changeSet.apply(&resultText);
if (resultText != expectedText) { if (resultText != expectedText) {
*result_listener << "\n" << resultText.toUtf8().constData(); *result_listener << "\n" << resultText.toUtf8().constData();
@@ -77,30 +76,31 @@ MATCHER_P2(MatchText, errorText, expectedText,
class ClangFixItOperation : public ::testing::Test class ClangFixItOperation : public ::testing::Test
{ {
protected: protected:
Utf8String filePath; Utf8String semicolonFilePath{TESTDATA_DIR"/diagnostic_semicolon_fixit.cpp", -1};
Utf8String compareFilePath{TESTDATA_DIR"/diagnostic_comparison_fixit.cpp", -1};
Utf8String diagnosticText{Utf8StringLiteral("expected ';' at end of declaration")}; Utf8String diagnosticText{Utf8StringLiteral("expected ';' at end of declaration")};
FixItContainer semicolonFixItContainer{Utf8StringLiteral(";"), FixItContainer semicolonFixItContainer{Utf8StringLiteral(";"),
{{filePath, 3u, 29u}, {{semicolonFilePath, 3u, 13u},
{filePath, 3u, 29u}}}; {semicolonFilePath, 3u, 13u}}};
QString semicolonErrorFile{QString::fromUtf8(TESTDATA_DIR "/diagnostic_semicolon_fixit.cpp")}; QString semicolonErrorFile{semicolonFilePath.toString()};
QString semicolonExpectedFile{QString::fromUtf8(TESTDATA_DIR"/diagnostic_semicolon_fixit_expected.cpp")}; QString semicolonExpectedFile{QString::fromUtf8(TESTDATA_DIR"/diagnostic_semicolon_fixit_expected.cpp")};
QString compareWarningFile{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit.cpp")}; QString compareWarningFile{compareFilePath.toString()};
QString compareExpected1File{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit_expected1.cpp")}; QString compareExpected1File{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit_expected1.cpp")};
QString compareExpected2File{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit_expected2.cpp")}; QString compareExpected2File{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit_expected2.cpp")};
FixItContainer compareFixItContainer{Utf8StringLiteral("=="), FixItContainer compareFixItContainer{Utf8StringLiteral("=="),
{{filePath, 4u, 43u}, {{compareFilePath, 4u, 11u},
{filePath, 4u, 44u}}}; {compareFilePath, 4u, 12u}}};
FixItContainer assignmentFixItContainerParenLeft{Utf8StringLiteral("("), FixItContainer assignmentFixItContainerParenLeft{Utf8StringLiteral("("),
{{filePath, 4u, 41u}, {{compareFilePath, 4u, 9u},
{filePath, 4u, 41u}}}; {compareFilePath, 4u, 9u}}};
FixItContainer assignmentFixItContainerParenRight{Utf8StringLiteral(")"), FixItContainer assignmentFixItContainerParenRight{Utf8StringLiteral(")"),
{{filePath, 4u, 46u}, {{compareFilePath, 4u, 14u},
{filePath, 4u, 46u}}}; {compareFilePath, 4u, 14u}}};
}; };
TEST_F(ClangFixItOperation, Description) TEST_F(ClangFixItOperation, Description)
{ {
::ClangFixItOperation operation(filePath, diagnosticText, {semicolonFixItContainer}); ::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer});
ASSERT_THAT(operation.description(), ASSERT_THAT(operation.description(),
QStringLiteral("Apply Fix: expected ';' at end of declaration")); QStringLiteral("Apply Fix: expected ';' at end of declaration"));
@@ -108,29 +108,32 @@ TEST_F(ClangFixItOperation, Description)
TEST_F(ClangFixItOperation, AppendSemicolon) TEST_F(ClangFixItOperation, AppendSemicolon)
{ {
::ClangFixItOperation operation(filePath, diagnosticText, {semicolonFixItContainer}); ::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer});
ASSERT_THAT(operation, MatchText(unsavedFileContent(semicolonErrorFile), operation.perform();
unsavedFileContent(semicolonExpectedFile)));
ASSERT_THAT(operation, MatchText(unsavedFileContent(semicolonExpectedFile)));
} }
TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseComparison) TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseComparison)
{ {
::ClangFixItOperation operation(filePath, diagnosticText, {compareFixItContainer}); ::ClangFixItOperation operation(compareFilePath, diagnosticText, {compareFixItContainer});
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareWarningFile), operation.perform();
unsavedFileContent(compareExpected1File)));
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareExpected1File)));
} }
TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseParentheses) TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseParentheses)
{ {
::ClangFixItOperation operation(filePath, ::ClangFixItOperation operation(compareFilePath,
diagnosticText, diagnosticText,
{assignmentFixItContainerParenLeft, {assignmentFixItContainerParenLeft,
assignmentFixItContainerParenRight}); assignmentFixItContainerParenRight});
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareWarningFile), operation.perform();
unsavedFileContent(compareExpected2File)));
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareExpected2File)));
} }
} }

View File

@@ -399,3 +399,28 @@ void f19()
{ {
ScopeClass::ScopeOperator(); ScopeClass::ScopeOperator();
} }
namespace TemplateClassNamespace {
template<class X>
class TemplateClass
{
};
}
void f20()
{
TemplateClassNamespace::TemplateClass<ScopeClass> TemplateClassDefinition;
}
void f21()
{
typedef int TypeDefDeclaration;
TypeDefDeclaration TypeDefDeclarationUsage;
}
typedef int EnumerationTypeDef;
enum Enumeration2 : EnumerationTypeDef {
};

View File

@@ -186,7 +186,7 @@ DiagnosticContainer DiagnosticSet::expectedDiagnostic(DiagnosticSet::ChildMode c
Utf8StringLiteral("Semantic Issue"), Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()}, {Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Note, ClangBackEnd::DiagnosticSeverity::Note,
SourceLocationContainer(headerFilePath, 1, 5), SourceLocationContainer(headerFilePath, 1, 6),
{}, {},
{}, {},
{} {}
@@ -199,7 +199,7 @@ DiagnosticContainer DiagnosticSet::expectedDiagnostic(DiagnosticSet::ChildMode c
Utf8StringLiteral("Semantic Issue"), Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()}, {Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Error, ClangBackEnd::DiagnosticSeverity::Error,
SourceLocationContainer(translationUnitMainFile.filePath(), 3, 53), SourceLocationContainer(translationUnitMainFile.filePath(), 3, 6),
{}, {},
{}, {},
children children

View File

@@ -196,7 +196,7 @@ DiagnosticContainer Diagnostic::expectedDiagnostic(Diagnostic::ChildMode childMo
Utf8StringLiteral("Semantic Issue"), Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()}, {Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Note, ClangBackEnd::DiagnosticSeverity::Note,
SourceLocationContainer(translationUnit.filePath(), 2, 14), SourceLocationContainer(translationUnit.filePath(), 2, 5),
{}, {},
{}, {},
{} {}
@@ -210,7 +210,7 @@ DiagnosticContainer Diagnostic::expectedDiagnostic(Diagnostic::ChildMode childMo
Utf8StringLiteral("Semantic Issue"), Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()}, {Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Warning, ClangBackEnd::DiagnosticSeverity::Warning,
SourceLocationContainer(translationUnit.filePath(), 5, 38), SourceLocationContainer(translationUnit.filePath(), 5, 4),
{}, {},
{}, {},
children children

View File

@@ -844,17 +844,17 @@ TEST_F(HighlightingInformations, FriendTypeDeclaration)
{ {
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(350, 28)); const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(350, 28));
ASSERT_THAT(infos[2], HasType(HighlightingType::Type)); ASSERT_THAT(infos[2], HasType(HighlightingType::Invalid));
} }
TEST_F(HighlightingInformations, FriendArgumentTypeDeclaration) TEST_F(HighlightingInformations, FriendArgumentTypeDeclaration)
{ {
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(351, 65)); const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(351, 65));
ASSERT_THAT(infos[6], HasType(HighlightingType::Type)); ASSERT_THAT(infos[6], HasType(HighlightingType::Invalid));
} }
TEST_F(HighlightingInformations, DISABLED_FriendArgumentDeclaration) TEST_F(HighlightingInformations, FriendArgumentDeclaration)
{ {
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(351, 65)); const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(351, 65));
@@ -903,6 +903,55 @@ TEST_F(HighlightingInformations, ScopeOperator)
ASSERT_THAT(infos[1], HasType(HighlightingType::Invalid)); ASSERT_THAT(infos[1], HasType(HighlightingType::Invalid));
} }
TEST_F(HighlightingInformations, TemplateClassNamespace)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(413, 78));
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
}
TEST_F(HighlightingInformations, TemplateClass)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(413, 78));
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
}
TEST_F(HighlightingInformations, TemplateClassParameter)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(413, 78));
ASSERT_THAT(infos[4], HasType(HighlightingType::Type));
}
TEST_F(HighlightingInformations, TemplateClassDeclaration)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(413, 78));
ASSERT_THAT(infos[6], HasType(HighlightingType::LocalVariable));
}
TEST_F(HighlightingInformations, TypeDefDeclaration)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(418, 36));
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
}
TEST_F(HighlightingInformations, TypeDefDeclarationUsage)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(419, 48));
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
}
TEST_F(HighlightingInformations, DISABLED_EnumerationTypeDef)
{
const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(424, 41));
ASSERT_THAT(infos[3], HasType(HighlightingType::Type));
}
Data *HighlightingInformations::d; Data *HighlightingInformations::d;
void HighlightingInformations::SetUpTestCase() void HighlightingInformations::SetUpTestCase()