forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.6'
Conflicts: src/plugins/baremetal/gdbserverproviderprocess.cpp Change-Id: I1ba618db9db6669edada6477c05a1b56b7b5b430
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
the QML file). The image appears in \uicontrol Resources. You can also use
|
||||
any other image or a QML type, instead.
|
||||
|
||||
\list a
|
||||
\list 1
|
||||
|
||||
\li In the \uicontrol Projects view, double-click the MainForm.ui.qml
|
||||
file to open it in \QMLD.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
|
||||
QTCREATOR_PRI_INCLUDED = 1
|
||||
|
||||
QTCREATOR_VERSION = 3.5.82
|
||||
QTCREATOR_COMPAT_VERSION = 3.5.82
|
||||
QTCREATOR_VERSION = 3.6.0
|
||||
QTCREATOR_COMPAT_VERSION = 3.6.0
|
||||
BINARY_ARTIFACTS_BRANCH = 3.6
|
||||
|
||||
# enable c++11
|
||||
|
@@ -5,12 +5,12 @@ Project {
|
||||
minimumQbsVersion: "1.4.3"
|
||||
property bool withAutotests: qbs.buildVariant === "debug"
|
||||
property string ide_version_major: '3'
|
||||
property string ide_version_minor: '5'
|
||||
property string ide_version_release: '82'
|
||||
property string ide_version_minor: '6'
|
||||
property string ide_version_release: '0'
|
||||
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_minor: '5'
|
||||
property string ide_compat_version_release: '82'
|
||||
property string ide_compat_version_minor: '6'
|
||||
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 path ide_source_tree: path
|
||||
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
|
||||
|
@@ -471,7 +471,7 @@ class Dumper(DumperBase):
|
||||
self.put('type="%s",' % typeName) # str(type.unqualified()) ?
|
||||
|
||||
if self.currentValue.value is None:
|
||||
self.put('value="",encoding="%d","numchild="0",'
|
||||
self.put('value="",encoding="%d",numchild="0",'
|
||||
% SpecialNotAccessibleValue)
|
||||
else:
|
||||
if not self.currentValue.encoding is None:
|
||||
@@ -1633,7 +1633,11 @@ class Dumper(DumperBase):
|
||||
symtab = sal.symtab
|
||||
if not symtab is None:
|
||||
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":
|
||||
interpreterStack = self.extractInterpreterStack()
|
||||
|
@@ -1123,14 +1123,15 @@ class Dumper(DumperBase):
|
||||
self.value = value
|
||||
|
||||
baseObjects = []
|
||||
# GetNumberOfDirectBaseClasses() includes(!) GetNumberOfVirtualBaseClasses()
|
||||
# so iterating over .GetNumberOfDirectBaseClasses() is correct.
|
||||
for i in xrange(value.GetType().GetNumberOfDirectBaseClasses()):
|
||||
baseClass = value.GetType().GetDirectBaseClassAtIndex(i).GetType()
|
||||
baseChildCount = baseClass.GetNumberOfFields() \
|
||||
+ baseClass.GetNumberOfDirectBaseClasses() \
|
||||
+ baseClass.GetNumberOfVirtualBaseClasses()
|
||||
+ baseClass.GetNumberOfDirectBaseClasses()
|
||||
if baseChildCount:
|
||||
baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(memberBase)))
|
||||
memberBase += 1
|
||||
baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(i)))
|
||||
else:
|
||||
# This base object is empty, but exists and will *not* be reported
|
||||
# by value.GetChildCount(). So manually report the empty base class.
|
||||
|
@@ -3744,29 +3744,6 @@ For example, "Revision: 15" will leave the branch at revision 15.</sou
|
||||
<translation>Определяет, получает ли флажок фокус при нажатии или нет.</translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>ClangCodeModel::Internal::ClangCompletionAssistProcessor</name>
|
||||
<message>
|
||||
@@ -3775,13 +3752,6 @@ For example, "Revision: 15" will leave the branch at revision 15.</sou
|
||||
<translation>Находится в %1</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ClangCodeModel::Internal::ClangIndexer</name>
|
||||
<message>
|
||||
<source>Parsing C/C++/ObjC Files</source>
|
||||
<translation>Разбор С/С++/ObjC файлов</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ClangCodeModel::Internal::ClangProjectSettingsPropertiesPage</name>
|
||||
<message>
|
||||
@@ -3815,14 +3785,6 @@ For example, "Revision: 15" will leave the branch at revision 15.</sou
|
||||
<source>Clang Settings</source>
|
||||
<translation>Настройки Clang</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Header Files (*.h)</source>
|
||||
<translation>Заголовочные файлы (*.h)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>All Files (*)</source>
|
||||
<translation>Все файлы (*)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ClangCodeModel::Internal::ModelManagerSupport</name>
|
||||
@@ -3832,21 +3794,6 @@ For example, "Revision: 15" will leave the branch at revision 15.</sou
|
||||
<translation>Clang</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ClangCodeModel::Internal::PchManager</name>
|
||||
<message>
|
||||
<source>Successfully generated PCH file "%1".</source>
|
||||
<translation>Успешно создан PCH-файл «%1».</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to generate PCH file "%1".</source>
|
||||
<translation>Не удалось создать PCH-файл «%1».</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Precompiling</source>
|
||||
<translation>Прекомпиляция</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ClangFormatSettings</name>
|
||||
<message>
|
||||
@@ -17574,6 +17521,37 @@ You can choose between stashing the changes or discarding them.</source>
|
||||
<translation>GLSL</translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>GridSpecifics</name>
|
||||
<message>
|
||||
@@ -24194,7 +24172,7 @@ Preselects a desktop Qt for building the application if available.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stacked</source>
|
||||
<translation type="unfinished">Уложеная</translation>
|
||||
<translation>Уложеная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<source>Switch checkout</source>
|
||||
<translation type="unfinished">Сменить выгружаемый каталог</translation>
|
||||
<translation>Сменить выгружаемый каталог</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Switch the checkout in the current directory to the new branch.</source>
|
||||
<translation type="unfinished">Переключить выгружаемый каталог текущего каталога на новую.</translation>
|
||||
<translation>Переключить выгружаемый каталог текущего каталога на новую.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hardlink</source>
|
||||
@@ -24266,7 +24244,7 @@ Preselects a desktop Qt for building the application if available.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bazaar Clone (Or Branch)</source>
|
||||
<translation type="unfinished">Клонирование Bazaar</translation>
|
||||
<translation>Клонирование Bazaar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Module:</source>
|
||||
|
@@ -39,10 +39,10 @@ namespace ClangBackEnd {
|
||||
|
||||
SourceLocationContainer::SourceLocationContainer(const Utf8String &filePath,
|
||||
uint line,
|
||||
uint offset)
|
||||
uint column)
|
||||
: filePath_(filePath),
|
||||
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)
|
||||
{
|
||||
out << container.filePath_;
|
||||
out << container.line_;
|
||||
out << container.offset_;
|
||||
out << container.column_;
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container)
|
||||
{
|
||||
in >> container.filePath_;
|
||||
in >> container.line_;
|
||||
in >> container.offset_;
|
||||
in >> container.column_;
|
||||
|
||||
return in;
|
||||
}
|
||||
@@ -87,14 +87,16 @@ bool operator==(const SourceLocationContainer &first, const SourceLocationContai
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second)
|
||||
{
|
||||
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)
|
||||
@@ -102,7 +104,7 @@ QDebug operator<<(QDebug debug, const SourceLocationContainer &container)
|
||||
debug.nospace() << "SourceLocationContainer("
|
||||
<< container.filePath() << ", "
|
||||
<< container.line() << ", "
|
||||
<< container.offset()
|
||||
<< container.column()
|
||||
<< ")";
|
||||
return debug;
|
||||
}
|
||||
@@ -112,7 +114,7 @@ void PrintTo(const SourceLocationContainer &container, ::std::ostream* os)
|
||||
*os << "["
|
||||
<< container.filePath().constData() << ", "
|
||||
<< container.line() << ", "
|
||||
<< container.offset()
|
||||
<< container.column()
|
||||
<< "]";
|
||||
}
|
||||
} // namespace ClangBackEnd
|
||||
|
@@ -51,16 +51,16 @@ public:
|
||||
SourceLocationContainer() = default;
|
||||
SourceLocationContainer(const Utf8String &filePath,
|
||||
uint line,
|
||||
uint offset);
|
||||
uint column);
|
||||
|
||||
const Utf8String &filePath() const;
|
||||
uint line() const;
|
||||
uint offset() const;
|
||||
uint column() const;
|
||||
|
||||
private:
|
||||
Utf8String filePath_;
|
||||
uint line_;
|
||||
uint offset_;
|
||||
uint column_;
|
||||
};
|
||||
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);
|
||||
|
@@ -513,14 +513,16 @@ static std::string commandLocals(ExtensionCommandContext &commandExtCtx,PCSTR ar
|
||||
if (watchSynchronization) {
|
||||
watchesSymbolGroup = 0;
|
||||
extCtx.discardWatchesSymbolGroup();
|
||||
if (!watcherInameExpressionMap.empty()) {
|
||||
// Force group into existence
|
||||
watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage);
|
||||
if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(),
|
||||
watcherInameExpressionMap,
|
||||
errorMessage)) {
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
if (watchesSymbolGroup == 0
|
||||
&& (!watcherInameExpressionMap.empty() || WatchesSymbolGroup::isWatchIname(iname))) {
|
||||
// Force group into existence
|
||||
watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage);
|
||||
if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(),
|
||||
watcherInameExpressionMap,
|
||||
errorMessage)) {
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,8 +39,9 @@ Rectangle {
|
||||
property QtObject modelProxy
|
||||
property QtObject zoomer
|
||||
property bool recursionGuard: false
|
||||
onWidthChanged: updateRangeMover()
|
||||
|
||||
function updateRange() {
|
||||
function updateZoomer() {
|
||||
if (recursionGuard)
|
||||
return;
|
||||
recursionGuard = true;
|
||||
@@ -54,24 +55,26 @@ Rectangle {
|
||||
recursionGuard = false;
|
||||
}
|
||||
|
||||
function updateRangeMover() {
|
||||
if (recursionGuard)
|
||||
return;
|
||||
recursionGuard = true;
|
||||
var newRangeX = (zoomer.rangeStart - zoomer.traceStart) * width /
|
||||
zoomer.traceDuration;
|
||||
var newWidth = zoomer.rangeDuration * width / zoomer.traceDuration;
|
||||
var widthChanged = Math.abs(newWidth - rangeMover.rangeWidth) > 1;
|
||||
var leftChanged = Math.abs(newRangeX - rangeMover.rangeLeft) > 1;
|
||||
if (leftChanged)
|
||||
rangeMover.rangeLeft = newRangeX;
|
||||
|
||||
if (leftChanged || widthChanged)
|
||||
rangeMover.rangeRight = newRangeX + newWidth;
|
||||
recursionGuard = false;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: zoomer
|
||||
onRangeChanged: {
|
||||
if (recursionGuard)
|
||||
return;
|
||||
recursionGuard = true;
|
||||
var newRangeX = (zoomer.rangeStart - zoomer.traceStart) * width /
|
||||
zoomer.traceDuration;
|
||||
var newWidth = zoomer.rangeDuration * width / zoomer.traceDuration;
|
||||
var widthChanged = Math.abs(newWidth - rangeMover.rangeWidth) > 1;
|
||||
var leftChanged = Math.abs(newRangeX - rangeMover.rangeLeft) > 1;
|
||||
if (leftChanged)
|
||||
rangeMover.rangeLeft = newRangeX;
|
||||
|
||||
if (leftChanged || widthChanged)
|
||||
rangeMover.rangeRight = newRangeX + newWidth;
|
||||
recursionGuard = false;
|
||||
}
|
||||
onRangeChanged: updateRangeMover()
|
||||
}
|
||||
|
||||
TimeDisplay {
|
||||
@@ -186,8 +189,8 @@ Rectangle {
|
||||
RangeMover {
|
||||
id: rangeMover
|
||||
visible: modelProxy.height > 0
|
||||
onRangeLeftChanged: overview.updateRange()
|
||||
onRangeRightChanged: overview.updateRange()
|
||||
onRangeLeftChanged: overview.updateZoomer()
|
||||
onRangeRightChanged: overview.updateZoomer()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@@ -45,8 +45,11 @@ GdbServerProviderProcess::GdbServerProviderProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *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,
|
||||
static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
||||
this, &GdbServerProviderProcess::error);
|
||||
@@ -65,7 +68,10 @@ GdbServerProviderProcess::GdbServerProviderProcess(
|
||||
void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments)
|
||||
{
|
||||
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()
|
||||
|
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceprocess.h>
|
||||
|
||||
namespace Utils { class QtcProcess; }
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
@@ -64,7 +66,7 @@ public:
|
||||
qint64 write(const QByteArray &data);
|
||||
|
||||
private:
|
||||
QProcess * const m_process;
|
||||
Utils::QtcProcess *m_process;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -38,6 +38,8 @@
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QTextBlock>
|
||||
|
||||
namespace {
|
||||
|
||||
QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainformat,
|
||||
@@ -53,6 +55,14 @@ QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainforma
|
||||
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,
|
||||
QTextDocument *textDocument,
|
||||
const QTextCharFormat &contextFormat,
|
||||
@@ -61,8 +71,8 @@ void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic,
|
||||
{
|
||||
for (auto &&range : diagnostic.ranges()) {
|
||||
QTextCursor cursor(textDocument);
|
||||
cursor.setPosition(int(range.start().offset()));
|
||||
cursor.setPosition(int(range.end().offset()), QTextCursor::KeepAnchor);
|
||||
cursor.setPosition(positionInText(textDocument, range.start()));
|
||||
cursor.setPosition(positionInText(textDocument, range.end()), QTextCursor::KeepAnchor);
|
||||
|
||||
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);
|
||||
cursor.setPosition(int(position));
|
||||
cursor.setPosition(positionInText(textDocument, sourceLocationContainer));
|
||||
cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
|
||||
|
||||
if (!cursor.hasSelection()) {
|
||||
cursor.setPosition(int(position) - 1);
|
||||
cursor.setPosition(positionInText(textDocument, sourceLocationContainer) - 1);
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
|
||||
}
|
||||
|
||||
@@ -122,7 +133,7 @@ void addSelections(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics
|
||||
QList<QTextEdit::ExtraSelection> &extraSelections)
|
||||
{
|
||||
for (auto &&diagnostic : diagnostics) {
|
||||
auto cursor = createSelectionCursor(textDocument, diagnostic.location().offset());
|
||||
auto cursor = createSelectionCursor(textDocument, diagnostic.location());
|
||||
|
||||
auto text = diagnosticText(diagnostic);
|
||||
auto extraSelection = createExtraSelections(mainFormat, cursor, text);
|
||||
|
@@ -170,18 +170,37 @@ void ClangEditorDocumentProcessor::updateCodeWarnings(const QVector<ClangBackEnd
|
||||
emit codeWarningsUpdated(revision(), codeWarnings);
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
|
||||
static QList<TextEditor::BlockRange>
|
||||
toTextEditorBlocks(const QVector<ClangBackEnd::SourceRangeContainer> &ifdefedOutRanges)
|
||||
int positionInText(QTextDocument *textDocument,
|
||||
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;
|
||||
blockRanges.reserve(ifdefedOutRanges.size());
|
||||
|
||||
for (const auto &range : ifdefedOutRanges)
|
||||
blockRanges.append(TextEditor::BlockRange(range.start().offset(),range.end().offset()));
|
||||
blockRanges.append(toTextEditorBlock(textDocument, range));
|
||||
|
||||
return blockRanges;
|
||||
}
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateHighlighting(
|
||||
const QVector<ClangBackEnd::HighlightingMarkContainer> &highlightingMarks,
|
||||
@@ -189,7 +208,7 @@ void ClangEditorDocumentProcessor::updateHighlighting(
|
||||
uint documentRevision)
|
||||
{
|
||||
if (documentRevision == revision()) {
|
||||
const auto skippedPreprocessorBlocks = toTextEditorBlocks(skippedPreprocessorRanges);
|
||||
const auto skippedPreprocessorBlocks = toTextEditorBlocks(textDocument(), skippedPreprocessorRanges);
|
||||
emit ifdefedOutBlocksUpdated(documentRevision, skippedPreprocessorBlocks);
|
||||
|
||||
m_semanticHighlighter.setHighlightingRunner(
|
||||
|
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <texteditor/refactoringchanges.h>
|
||||
|
||||
#include <QTextDocument>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
|
||||
ClangFixItOperation::ClangFixItOperation(const Utf8String &filePath,
|
||||
@@ -56,19 +58,26 @@ QString ClangCodeModel::ClangFixItOperation::description() const
|
||||
void ClangFixItOperation::perform()
|
||||
{
|
||||
const TextEditor::RefactoringChanges refactoringChanges;
|
||||
TextEditor::RefactoringFilePtr refactoringFile = refactoringChanges.file(filePath.toString());
|
||||
refactoringFile = refactoringChanges.file(filePath.toString());
|
||||
refactoringFile->setChangeSet(changeSet());
|
||||
refactoringFile->apply();
|
||||
}
|
||||
|
||||
QString ClangFixItOperation::refactoringFileContent_forTestOnly() const
|
||||
{
|
||||
return refactoringFile->document()->toPlainText();
|
||||
}
|
||||
|
||||
Utils::ChangeSet ClangFixItOperation::changeSet() const
|
||||
{
|
||||
Utils::ChangeSet changeSet;
|
||||
|
||||
for (const auto &fixItContainer : fixItContainers) {
|
||||
const auto range = fixItContainer.range();
|
||||
changeSet.replace(range.start().offset(),
|
||||
range.end().offset(),
|
||||
const auto start = range.start();
|
||||
const auto end = range.end();
|
||||
changeSet.replace(refactoringFile->position(start.line(), start.column()),
|
||||
refactoringFile->position(end.line(), end.column()),
|
||||
fixItContainer.text());
|
||||
}
|
||||
|
||||
|
@@ -34,9 +34,16 @@
|
||||
#include <texteditor/quickfix.h>
|
||||
|
||||
#include <clangbackendipc/fixitcontainer.h>
|
||||
|
||||
#include <utils/changeset.h>
|
||||
|
||||
#include <QVector>
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace TextEditor
|
||||
{
|
||||
class RefactoringFile;
|
||||
}
|
||||
|
||||
namespace ClangCodeModel {
|
||||
|
||||
@@ -51,11 +58,15 @@ public:
|
||||
QString description() const override;
|
||||
void perform() override;
|
||||
|
||||
QString refactoringFileContent_forTestOnly() const;
|
||||
|
||||
private:
|
||||
Utils::ChangeSet changeSet() const;
|
||||
|
||||
private:
|
||||
Utf8String filePath;
|
||||
Utf8String fixItText;
|
||||
QSharedPointer<TextEditor::RefactoringFile> refactoringFile;
|
||||
QVector<ClangBackEnd::FixItContainer> fixItContainers;
|
||||
};
|
||||
|
||||
|
@@ -62,6 +62,8 @@ CppTools::SemanticHighlighter::Kind toCppToolsSemanticHighlighterKind(
|
||||
case HighlightingType::Label:
|
||||
return SemanticHighlighter::LabelUse;
|
||||
case HighlightingType::Preprocessor:
|
||||
case HighlightingType::PreprocessorDefinition:
|
||||
case HighlightingType::PreprocessorExpansion:
|
||||
return SemanticHighlighter::MacroUse;
|
||||
default:
|
||||
return SemanticHighlighter::Unknown;
|
||||
|
@@ -3218,9 +3218,10 @@ void GdbEngine::loadAdditionalQmlStack()
|
||||
return;
|
||||
}
|
||||
// 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"
|
||||
+ QByteArray::number(contextAddress, 16) + ")\"",
|
||||
NoFlags, CB(handleQmlStackTrace)});
|
||||
DebuggerCommand cmd("-data-evaluate-expression \"qt_v4StackTrace((QV4::ExecutionContext *)0x"
|
||||
+ QByteArray::number(contextAddress, 16) + ")\"");
|
||||
cmd.callback = CB(handleQmlStackTrace);
|
||||
runCommand(cmd);
|
||||
};
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
@@ -749,9 +749,10 @@ BuildConfiguration *QmakeBuildConfigurationFactory::restore(Target *parent, cons
|
||||
|
||||
BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
|
||||
{
|
||||
QMakeStep *qs = qmakeStep();
|
||||
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
|
||||
return Debug;
|
||||
else if (qmakeStep()->separateDebugInfo())
|
||||
else if (qs && qs->separateDebugInfo())
|
||||
return Profile;
|
||||
else
|
||||
return Release;
|
||||
|
@@ -923,8 +923,8 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
|
||||
if (bc) {
|
||||
k = bc->target()->kit();
|
||||
env = bc->environment();
|
||||
if (bc->qmakeStep())
|
||||
qmakeArgs = bc->qmakeStep()->parserArguments();
|
||||
if (QMakeStep *qs = bc->qmakeStep())
|
||||
qmakeArgs = qs->parserArguments();
|
||||
else
|
||||
qmakeArgs = bc->configCommandLineArguments();
|
||||
} else {
|
||||
|
@@ -375,7 +375,7 @@ void QmlJSHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPo
|
||||
else if (m_colorTip.isValid())
|
||||
Utils::ToolTip::show(point, m_colorTip, editorWidget);
|
||||
else
|
||||
Utils::ToolTip::show(point, toolTip(), editorWidget);
|
||||
BaseHoverHandler::operateTooltip(editorWidget, point);
|
||||
}
|
||||
|
||||
void QmlJSHoverHandler::prettyPrintTooltip(const Value *value,
|
||||
|
@@ -123,9 +123,9 @@ ResourceTopLevelNode::ResourceTopLevelNode(const Utils::FileName &filePath, Fold
|
||||
|
||||
Utils::FileName base = parent->filePath();
|
||||
if (filePath.isChildOf(base))
|
||||
setDisplayName(filePath.relativeChildPath(base).toString());
|
||||
setDisplayName(filePath.relativeChildPath(base).toUserOutput());
|
||||
else
|
||||
setDisplayName(filePath.toString());
|
||||
setDisplayName(filePath.toUserOutput());
|
||||
}
|
||||
|
||||
ResourceTopLevelNode::~ResourceTopLevelNode()
|
||||
|
@@ -65,13 +65,13 @@ protected:
|
||||
void setLastHelpItemIdentified(const HelpItem &help);
|
||||
const HelpItem &lastHelpItemIdentified() const;
|
||||
|
||||
virtual void decorateToolTip();
|
||||
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
|
||||
private:
|
||||
void clear();
|
||||
void process(TextEditorWidget *widget, int pos);
|
||||
|
||||
virtual void identifyMatch(TextEditorWidget *editorWidget, int pos) = 0;
|
||||
virtual void decorateToolTip();
|
||||
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
|
||||
|
||||
bool m_diagnosticTooltip;
|
||||
QString m_toolTip;
|
||||
|
@@ -229,7 +229,7 @@ int TabSettings::columnCountForText(const QString &text, int startColumn) const
|
||||
|
||||
int TabSettings::spacesLeftFromPosition(const QString &text, int position)
|
||||
{
|
||||
if (position >= text.size())
|
||||
if (position > text.size())
|
||||
return 0;
|
||||
int i = position;
|
||||
while (i > 0) {
|
||||
|
@@ -5476,26 +5476,25 @@ void TextEditorWidget::wheelEvent(QWheelEvent *e)
|
||||
return;
|
||||
}
|
||||
|
||||
const int delta = e->delta();
|
||||
if (delta < 0)
|
||||
zoomOut();
|
||||
else if (delta > 0)
|
||||
zoomIn();
|
||||
const float delta = e->angleDelta().y() / 120.f;
|
||||
if (delta != 0)
|
||||
zoomF(delta);
|
||||
return;
|
||||
}
|
||||
QPlainTextEdit::wheelEvent(e);
|
||||
}
|
||||
|
||||
void TextEditorWidget::zoomIn()
|
||||
void TextEditorWidget::zoomF(float delta)
|
||||
{
|
||||
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()
|
||||
{
|
||||
d->clearVisibleFoldedBlock();
|
||||
emit requestFontZoom(-10);
|
||||
emit requestFontZoom(step);
|
||||
}
|
||||
|
||||
void TextEditorWidget::zoomReset()
|
||||
|
@@ -378,8 +378,7 @@ public:
|
||||
void circularPaste();
|
||||
void switchUtf8bom();
|
||||
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void zoomF(float delta);
|
||||
void zoomReset();
|
||||
|
||||
void cutLine();
|
||||
|
@@ -130,6 +130,7 @@ HighlightingType HighlightingInformation::referencedTypeKind(const Cursor &curso
|
||||
case CXCursor_ClassDecl:
|
||||
case CXCursor_StructDecl:
|
||||
case CXCursor_UnionDecl:
|
||||
case CXCursor_TypedefDecl:
|
||||
case CXCursor_TemplateTypeParameter:
|
||||
case CXCursor_TypeAliasDecl: return HighlightingType::Type;
|
||||
case CXCursor_EnumDecl: return HighlightingType::Enumeration;
|
||||
@@ -205,8 +206,8 @@ HighlightingType HighlightingInformation::identifierKind(const Cursor &cursor) c
|
||||
case CXCursor_NamespaceRef:
|
||||
case CXCursor_NamespaceAlias:
|
||||
case CXCursor_TypeAliasDecl:
|
||||
case CXCursor_TypedefDecl:
|
||||
case CXCursor_ClassTemplate:
|
||||
case CXCursor_UnexposedDecl:
|
||||
case CXCursor_CXXStaticCastExpr:
|
||||
case CXCursor_CXXReinterpretCastExpr:
|
||||
case CXCursor_ObjCCategoryDecl:
|
||||
|
@@ -67,7 +67,7 @@ uint SourceLocation::offset() const
|
||||
|
||||
SourceLocationContainer SourceLocation::toSourceLocationContainer() const
|
||||
{
|
||||
return SourceLocationContainer(filePath_, line_, offset_);
|
||||
return SourceLocationContainer(filePath_, line_, column_);
|
||||
}
|
||||
|
||||
SourceLocation::SourceLocation(CXSourceLocation cxSourceLocation)
|
||||
@@ -94,7 +94,8 @@ SourceLocation::SourceLocation(CXTranslationUnit cxTranslationUnit,
|
||||
line,
|
||||
column)),
|
||||
filePath_(filePath),
|
||||
line_(line)
|
||||
line_(line),
|
||||
column_(column)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -5670,11 +5670,18 @@ void tst_Dumpers::dumper_data()
|
||||
"struct Data { Data() : a(42) {} int a; };\n"
|
||||
"struct VEmpty {};\n"
|
||||
"struct VData { VData() : v(42) {} int v; };\n"
|
||||
|
||||
"struct S1 : Empty, Data, virtual VEmpty, virtual VData\n"
|
||||
" { S1() : i1(1) {} int i1; };\n"
|
||||
"struct S2 : Empty, Data, virtual VEmpty, virtual VData\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")
|
||||
<< Data(inheritanceData,
|
||||
@@ -5683,30 +5690,19 @@ void tst_Dumpers::dumper_data()
|
||||
"c.S2::a = 43;\n"
|
||||
"c.S1::v = 44;\n"
|
||||
"c.S2::v = 45;\n"
|
||||
"unused(&c.S2::v);\n")
|
||||
+ NoLldbEngine
|
||||
"unused(&c.S2::v);\n"
|
||||
"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.@1.@1.a", "42", "int")
|
||||
+ Check("c.@1.@3.v", "45", "int")
|
||||
+ Check("c.@2.@1.a", "43", "int")
|
||||
+ Check("c.@2.@3.v", "45", "int");
|
||||
|
||||
// FIXME: Virtual inheritance doesn't work with LLDB 300
|
||||
QTest::newRow("InheritanceLldb")
|
||||
<< 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");
|
||||
|
||||
+ Check("c.@2.@3.v", "45", "int")
|
||||
+ Check("tt.c", "1", "int")
|
||||
+ Check("tt.@1.@1.v", "45", "int")
|
||||
+ Check("tt.@2.@1.v", "45", "int");
|
||||
|
||||
QTest::newRow("Gdb13393")
|
||||
<< Data(
|
||||
|
@@ -49,6 +49,11 @@ class Targets:
|
||||
desktopTargets &= ~Targets.DESKTOP_541_GCC
|
||||
return desktopTargets
|
||||
|
||||
@staticmethod
|
||||
def qt4Classes():
|
||||
return (Targets.DESKTOP_474_GCC & Targets.DESKTOP_480_DEFAULT
|
||||
& Targets.SIMULATOR & Targets.EMBEDDED_LINUX)
|
||||
|
||||
@staticmethod
|
||||
def getStringForTarget(target):
|
||||
if target == Targets.DESKTOP_474_GCC:
|
||||
|
@@ -64,11 +64,26 @@ def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWe
|
||||
return checkedTargets
|
||||
|
||||
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...")
|
||||
selectFromFileDialog(projectPath)
|
||||
replaceEditorContent("{type='Utils::FancyLineEdit' unnamed='1' visible='1'"
|
||||
"window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}", buildDir)
|
||||
clickButton(waitForObject(":CMake Wizard.Next_QPushButton"))
|
||||
__chooseTargets__(0) # uncheck all
|
||||
__chooseTargets__(Targets.DESKTOP_480_DEFAULT, additionalFunc=additionalFunction)
|
||||
clickButton(waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'"
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}"))
|
||||
return __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 availableTargets should be the result of __createProjectOrFileSelectType__()
|
||||
# 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:
|
||||
available = availableTargets
|
||||
else:
|
||||
@@ -419,8 +437,19 @@ def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None):
|
||||
try:
|
||||
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current),
|
||||
mustCheck, 3000)
|
||||
if (mustCheck):
|
||||
if mustCheck:
|
||||
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:
|
||||
if mustCheck:
|
||||
test.fail("Failed to check target '%s'." % Targets.getStringForTarget(current))
|
||||
|
@@ -261,6 +261,7 @@ class JIRA:
|
||||
def __initBugDict__(self):
|
||||
self.__bugs__= {
|
||||
'QTCREATORBUG-6853':self._workaroundCreator6853_,
|
||||
'QTCREATORBUG-15456':self._workaroundCreator15456_,
|
||||
}
|
||||
# helper function - will be called if no workaround for the requested bug is deposited
|
||||
def _exitFatal_(self, bugType, number):
|
||||
@@ -271,3 +272,13 @@ class JIRA:
|
||||
def _workaroundCreator6853_(self, *args):
|
||||
if "Release" in args[0] and platform.system() == "Linux":
|
||||
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))
|
||||
|
@@ -60,7 +60,7 @@ def main():
|
||||
myCompTE = "SampleApp.Resources.qml\\.qrc./.MyComponent\\.qml"
|
||||
# there should be new QML file generated with name "MyComponent.qml"
|
||||
try:
|
||||
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 3000)
|
||||
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 5000)
|
||||
except:
|
||||
try:
|
||||
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000)
|
||||
|
@@ -50,9 +50,9 @@ def main():
|
||||
"#include <iostream>",
|
||||
"int main(int, char *argv[])",
|
||||
"{",
|
||||
' std::cout << \"' + outputStdOut + '\" << std::endl;',
|
||||
' std::cerr << \"' + outputStdErr + '\" << std::endl;',
|
||||
' qDebug() << \"' + outputQDebug + '\";'])
|
||||
'std::cout << \"' + outputStdOut + '\" << std::endl;',
|
||||
'std::cerr << \"' + outputStdErr + '\" << std::endl;',
|
||||
'qDebug() << \"' + outputQDebug + '\";'])
|
||||
# Rely on code completion for closing bracket
|
||||
invokeMenuItem("File", "Save All")
|
||||
openDocument(project + "." + project + "\\.pro")
|
||||
@@ -63,6 +63,10 @@ def main():
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version - leaving without building.")
|
||||
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)
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
||||
@@ -95,6 +99,8 @@ def main():
|
||||
invokeMenuItem("Debug", "Start Debugging", "Start Debugging")
|
||||
JIRA.performWorkaroundForBug(6853, JIRA.Bug.CREATOR, config)
|
||||
handleDebuggerWarnings(config, isMsvc)
|
||||
JIRA.performWorkaroundForBug(15456, JIRA.Bug.CREATOR, isMsvc,
|
||||
checkedTargets[kit] & ~Targets.qt4Classes(), config)
|
||||
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
|
||||
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
||||
waitFor("'Debugging has finished' in str(outputWindow.plainText)", 20000)
|
||||
|
@@ -132,9 +132,9 @@ def testHovering():
|
||||
expectedTypes = ["TextTip", "TextTip"]
|
||||
expectedValues = [
|
||||
{'text':'<table><tr><td valign=middle>FocusScope\n<p>The FocusScope object explicitly '
|
||||
'creates a focus scope.</p></td><td> <img src=":/texteditor/images/f1.png"></td></tr></table>'},
|
||||
'creates a focus scope.</p></td><td> <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 '
|
||||
'optional border.</p></td><td> <img src=":/texteditor/images/f1.png"></td></tr></table>'}
|
||||
'optional border.</p></td><td> <img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
|
||||
]
|
||||
alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}]
|
||||
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 '
|
||||
'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 '
|
||||
'when <tt>scope</tt> gains active focus.</p></td><td> <img src=":/texteditor/images/f1.png"'
|
||||
'when <tt>scope</tt> gains active focus.</p></td><td> <img src=":/utils/tooltip/images/f1.png"'
|
||||
'></td></tr></table>'},
|
||||
{'text':'<table><tr><td valign=middle>string<p>This property holds the color used to fill the rectangle.'
|
||||
'</p></td><td> <img src=":/texteditor/images/f1.png"></td></tr></table>'},
|
||||
'</p></td><td> <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.'
|
||||
'</p></td><td> <img src=":/texteditor/images/f1.png"></td></tr></table>'},
|
||||
'</p></td><td> <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 '
|
||||
'the item.</p></td><td> <img src=":/texteditor/images/f1.png"></td></tr></table>'}
|
||||
'the item.</p></td><td> <img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
|
||||
]
|
||||
alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}]
|
||||
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
|
||||
|
@@ -31,7 +31,20 @@
|
||||
#ifndef REFACTORINGCHANGES_H
|
||||
#define REFACTORINGCHANGES_H
|
||||
|
||||
#include <QFile>
|
||||
#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
|
||||
class QString;
|
||||
@@ -47,20 +60,68 @@ class RefactoringFile;
|
||||
class RefactoringChangesData;
|
||||
typedef QSharedPointer<RefactoringFile> RefactoringFilePtr;
|
||||
|
||||
using testing::NotNull;
|
||||
|
||||
class RefactoringFile
|
||||
{
|
||||
public:
|
||||
void setChangeSet(const Utils::ChangeSet &) {}
|
||||
void apply() {}
|
||||
RefactoringFile(std::unique_ptr<QTextDocument> &&textDocument)
|
||||
: 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
|
||||
{
|
||||
public:
|
||||
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
|
||||
|
@@ -58,13 +58,12 @@ QString unsavedFileContent(const QString &unsavedFilePath)
|
||||
return QString::fromUtf8(unsavedFileContentFile.readAll());
|
||||
}
|
||||
|
||||
MATCHER_P2(MatchText, errorText, expectedText,
|
||||
std::string(negation ? "hasn't" : "has") + " error text:\n" + PrintToString(errorText) +
|
||||
" and expected text:\n" + PrintToString(expectedText))
|
||||
MATCHER_P(MatchText, expectedText,
|
||||
std::string(negation ? "hasn't" : "has")
|
||||
+ " expected text:\n" + PrintToString(expectedText))
|
||||
{
|
||||
QString resultText = errorText;
|
||||
Utils::ChangeSet changeSet = arg.changeSet();
|
||||
changeSet.apply(&resultText);
|
||||
const ::ClangFixItOperation &operation = arg;
|
||||
QString resultText = operation.refactoringFileContent_forTestOnly();
|
||||
|
||||
if (resultText != expectedText) {
|
||||
*result_listener << "\n" << resultText.toUtf8().constData();
|
||||
@@ -77,30 +76,31 @@ MATCHER_P2(MatchText, errorText, expectedText,
|
||||
class ClangFixItOperation : public ::testing::Test
|
||||
{
|
||||
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")};
|
||||
FixItContainer semicolonFixItContainer{Utf8StringLiteral(";"),
|
||||
{{filePath, 3u, 29u},
|
||||
{filePath, 3u, 29u}}};
|
||||
QString semicolonErrorFile{QString::fromUtf8(TESTDATA_DIR "/diagnostic_semicolon_fixit.cpp")};
|
||||
{{semicolonFilePath, 3u, 13u},
|
||||
{semicolonFilePath, 3u, 13u}}};
|
||||
QString semicolonErrorFile{semicolonFilePath.toString()};
|
||||
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 compareExpected2File{QString::fromUtf8(TESTDATA_DIR"/diagnostic_comparison_fixit_expected2.cpp")};
|
||||
FixItContainer compareFixItContainer{Utf8StringLiteral("=="),
|
||||
{{filePath, 4u, 43u},
|
||||
{filePath, 4u, 44u}}};
|
||||
{{compareFilePath, 4u, 11u},
|
||||
{compareFilePath, 4u, 12u}}};
|
||||
FixItContainer assignmentFixItContainerParenLeft{Utf8StringLiteral("("),
|
||||
{{filePath, 4u, 41u},
|
||||
{filePath, 4u, 41u}}};
|
||||
{{compareFilePath, 4u, 9u},
|
||||
{compareFilePath, 4u, 9u}}};
|
||||
FixItContainer assignmentFixItContainerParenRight{Utf8StringLiteral(")"),
|
||||
{{filePath, 4u, 46u},
|
||||
{filePath, 4u, 46u}}};
|
||||
{{compareFilePath, 4u, 14u},
|
||||
{compareFilePath, 4u, 14u}}};
|
||||
};
|
||||
|
||||
TEST_F(ClangFixItOperation, Description)
|
||||
{
|
||||
::ClangFixItOperation operation(filePath, diagnosticText, {semicolonFixItContainer});
|
||||
::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer});
|
||||
|
||||
ASSERT_THAT(operation.description(),
|
||||
QStringLiteral("Apply Fix: expected ';' at end of declaration"));
|
||||
@@ -108,29 +108,32 @@ TEST_F(ClangFixItOperation, Description)
|
||||
|
||||
TEST_F(ClangFixItOperation, AppendSemicolon)
|
||||
{
|
||||
::ClangFixItOperation operation(filePath, diagnosticText, {semicolonFixItContainer});
|
||||
::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer});
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(semicolonErrorFile),
|
||||
unsavedFileContent(semicolonExpectedFile)));
|
||||
operation.perform();
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(semicolonExpectedFile)));
|
||||
}
|
||||
|
||||
TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseComparison)
|
||||
{
|
||||
::ClangFixItOperation operation(filePath, diagnosticText, {compareFixItContainer});
|
||||
::ClangFixItOperation operation(compareFilePath, diagnosticText, {compareFixItContainer});
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareWarningFile),
|
||||
unsavedFileContent(compareExpected1File)));
|
||||
operation.perform();
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareExpected1File)));
|
||||
}
|
||||
|
||||
TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseParentheses)
|
||||
{
|
||||
::ClangFixItOperation operation(filePath,
|
||||
::ClangFixItOperation operation(compareFilePath,
|
||||
diagnosticText,
|
||||
{assignmentFixItContainerParenLeft,
|
||||
assignmentFixItContainerParenRight});
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareWarningFile),
|
||||
unsavedFileContent(compareExpected2File)));
|
||||
operation.perform();
|
||||
|
||||
ASSERT_THAT(operation, MatchText(unsavedFileContent(compareExpected2File)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -399,3 +399,28 @@ void f19()
|
||||
{
|
||||
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 {
|
||||
|
||||
};
|
||||
|
@@ -186,7 +186,7 @@ DiagnosticContainer DiagnosticSet::expectedDiagnostic(DiagnosticSet::ChildMode c
|
||||
Utf8StringLiteral("Semantic Issue"),
|
||||
{Utf8String(), Utf8String()},
|
||||
ClangBackEnd::DiagnosticSeverity::Note,
|
||||
SourceLocationContainer(headerFilePath, 1, 5),
|
||||
SourceLocationContainer(headerFilePath, 1, 6),
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
@@ -199,7 +199,7 @@ DiagnosticContainer DiagnosticSet::expectedDiagnostic(DiagnosticSet::ChildMode c
|
||||
Utf8StringLiteral("Semantic Issue"),
|
||||
{Utf8String(), Utf8String()},
|
||||
ClangBackEnd::DiagnosticSeverity::Error,
|
||||
SourceLocationContainer(translationUnitMainFile.filePath(), 3, 53),
|
||||
SourceLocationContainer(translationUnitMainFile.filePath(), 3, 6),
|
||||
{},
|
||||
{},
|
||||
children
|
||||
|
@@ -196,7 +196,7 @@ DiagnosticContainer Diagnostic::expectedDiagnostic(Diagnostic::ChildMode childMo
|
||||
Utf8StringLiteral("Semantic Issue"),
|
||||
{Utf8String(), Utf8String()},
|
||||
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"),
|
||||
{Utf8String(), Utf8String()},
|
||||
ClangBackEnd::DiagnosticSeverity::Warning,
|
||||
SourceLocationContainer(translationUnit.filePath(), 5, 38),
|
||||
SourceLocationContainer(translationUnit.filePath(), 5, 4),
|
||||
{},
|
||||
{},
|
||||
children
|
||||
|
@@ -844,17 +844,17 @@ TEST_F(HighlightingInformations, FriendTypeDeclaration)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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));
|
||||
|
||||
@@ -903,6 +903,55 @@ TEST_F(HighlightingInformations, ScopeOperator)
|
||||
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;
|
||||
|
||||
void HighlightingInformations::SetUpTestCase()
|
||||
|
Reference in New Issue
Block a user