Commit 4026864f authored by Eike Ziller's avatar Eike Ziller

Merge remote-tracking branch 'origin/4.2'

 Conflicts:
	src/plugins/clangrefactoring/refactoringengine.cpp
	src/tools/clangrefactoringbackend/source/symbolfinder.cpp

Change-Id: I7c1c87f3b8ade43a07f6668565501042e967fa8b
parents 6e17882b 82818cb9
......@@ -25,7 +25,8 @@ Prerequisites:
* cmake
* On Mac OS X: latest Xcode
* On Linux: g++ 4.8 or later
* LLVM 3.8.0 or later (optional, needed for the Clang Code Model)
* LLVM 3.9.0 or later (optional, needed for the Clang Code Model)
* Qbs 1.7.x (optional, sources also contain Qbs itself)
The installed toolchains have to match the one Qt was compiled with.
......@@ -33,6 +34,8 @@ You can build Qt Creator with
# Optional, needed for the Clang Code Model:
export LLVM_INSTALL_DIR=/path/to/llvm (or "set" on Windows)
# Optional, needed to let the QbsProjectManager plugin use system Qbs:
export QBS_INSTALL_DIR=/path/to/qbs
cd $SOURCE_DIRECTORY
qmake -r
......
......@@ -132,7 +132,7 @@
\list 1
\li Acquire Clang 3.8.0 or higher in one of the following ways:
\li Acquire Clang 3.9.0 or higher in one of the following ways:
\list
......
var Environment = loadExtension("qbs.Environment")
var File = loadExtension("qbs.File")
var FileInfo = loadExtension("qbs.FileInfo")
var MinimumLLVMVersion = "3.8.0"
var MinimumLLVMVersion = "3.9.0"
var Process = loadExtension("qbs.Process")
function readOutput(executable, args)
......@@ -28,7 +28,7 @@ function llvmConfig(qbs, qtcFunctions)
{
var llvmInstallDirFromEnv = Environment.getEnv("LLVM_INSTALL_DIR")
var llvmConfigVariants = [
"llvm-config", "llvm-config-3.8", "llvm-config-3.9", "llvm-config-4.0", "llvm-config-4.1"
"llvm-config", "llvm-config-3.9", "llvm-config-4.0", "llvm-config-4.1"
];
// Prefer llvm-config* from LLVM_INSTALL_DIR
......
......@@ -574,7 +574,7 @@ class DumperBase:
res = []
for item in targs[::-1]:
c = ord(item[0])
if c == '-' or (c >= 48 and c < 58):
if c in (45, 46) or (c >= 48 and c < 58): # '-', '.' or digit.
if item.find('.') > -1:
res.append(float(item))
else:
......@@ -2759,6 +2759,20 @@ class DumperBase:
self.targetValue = None # For references.
self.isBaseClass = None
def copy(self):
val = self.dumper.Value(self.dumper)
val.dumper = self.dumper
val.name = self.name
val.type = self.type
val.ldata = self.ldata
val.laddress = self.laddress
val.lIsInScope = self.lIsInScope
val.ldisplay = self.ldisplay
val.lbitpos = self.lbitpos
val.lbitsize = self.lbitsize
val.targetValue = self.targetValue
return val
def check(self):
if self.laddress is not None and not self.dumper.isInt(self.laddress):
error('INCONSISTENT ADDRESS: %s' % type(self.laddress))
......@@ -2848,12 +2862,18 @@ class DumperBase:
members = self.members(True)
for member in members:
#warn('CHECKING FIELD %s' % member.name)
if member.type.code == TypeCodeTypedef:
member = member.detypedef()
if member.name == name:
return member
for member in members:
#warn('CHECKING BASE %s' % member.name)
#if member.name == name:
# return member
if member.type.code == TypeCodeTypedef:
member = member.detypedef()
if member.name == name:
return member
if member.type.code == TypeCodeStruct:
res = member.findMemberByName(name)
if res is not None:
......@@ -2979,6 +2999,9 @@ class DumperBase:
res = []
anonNumber = 0
for field in fields:
if isinstance(field, self.dumper.Value):
res.append(field)
continue
if field.isBaseClass and not includeBases:
continue
if field.name is None or len(field.name) == 0:
......@@ -3029,10 +3052,8 @@ class DumperBase:
self.check()
if self.type.code != TypeCodeTypedef:
error("WRONG")
val = self.dumper.Value(self.dumper)
val = self.copy()
val.type = self.type.ltarget
val.ldata = self.ldata
val.laddress = self.laddress
#warn("DETYPEDEF FROM: %s" % self)
#warn("DETYPEDEF TO: %s" % val)
return val
......
......@@ -1014,30 +1014,34 @@ class Dumper(DumperBase):
if not self.currentQtNamespaceGuess is None:
return self.currentQtNamespaceGuess
# This only works when called from a valid frame.
try:
cand = 'QArrayData::shared_null'
symbol = gdb.lookup_symbol(cand)[0]
if symbol:
ns = symbol.name[:-len(cand)]
self.qtNamespaceToReport = ns
self.qtNamespace = lambda: ns
return ns
except:
pass
for objfile in gdb.objfiles():
name = objfile.filename
if name.find('/libQt5Core') >= 0:
ns = ''
try:
# This is Qt, but not 5.x.
cand = 'QByteArray::shared_null'
symbol = gdb.lookup_symbol(cand)[0]
if symbol:
ns = symbol.name[:-len(cand)]
# This only works when called from a valid frame.
try:
cand = 'QArrayData::shared_null'
symbol = gdb.lookup_symbol(cand)[0]
if symbol:
ns = symbol.name[:-len(cand)]
except:
try:
# Some GDB 7.11.1 on Arch Linux.
cand = 'QArrayData::shared_null[0]'
val = gdb.parse_and_eval(cand)
if val.type is not None:
typeobj = val.type.unqualified()
ns = typeobj.name[:-len('QArrayData')]
except:
pass
# This might be wrong, but we can't do better: We found
# a libQt5Core and could not extract a namespace.
# The best guess is that there isn't any.
self.qtNamespaceToReport = ns
self.qtNamespace = lambda: ns
self.fallbackQtVersion = 0x40800
return ns
except:
pass
self.currentQtNamespaceGuess = ''
return ''
......
......@@ -247,7 +247,7 @@ class Dumper(DumperBase):
if bitsize > 0:
#bitpos = bitpos % bitsize
bitpos = bitpos % 8 # Reported type is always wrapping type!
fieldBits[f.name] = (bitsize, bitpos)
fieldBits[f.name] = (bitsize, bitpos, f.IsBitfield())
# Normal members and non-empty base classes.
for i in range(fakeValue.GetNumChildren()):
......@@ -259,11 +259,12 @@ class Dumper(DumperBase):
nativeFieldType = nativeField.GetType()
if field.name in fieldBits:
(field.lbitsize, field.lbitpos) = fieldBits[field.name]
(field.lbitsize, field.lbitpos, isBitfield) = fieldBits[field.name]
else:
field.lbitsize = nativeFieldType.GetByteSize() * 8
isBitfield = False
if field.lbitsize != nativeFieldType.GetByteSize() * 8:
if isBitfield:
field.ltype = self.createBitfieldType(self.typeName(nativeFieldType), field.lbitsize)
else:
fakeMember = fakeValue.GetChildAtIndex(i)
......
......@@ -62,7 +62,7 @@ def qdump____m512d(d, value):
d.putArrayData(value.address(), 8, d.lookupType('double'))
def qdump____m128i(d, value):
data = d.hexencode(value.data())
data = d.hexencode(value.data(16))
d.putValue(':'.join('%04x' % int(data[i:i+4], 16) for i in xrange(0, 32, 4)))
if d.isExpanded():
with Children(d):
......@@ -73,7 +73,7 @@ def qdump____m128i(d, value):
d.putArrayItem('uint64x2', addr, 2, 'unsigned long long')
def qdump____m256i(d, value):
data = d.hexencode(value.data())
data = d.hexencode(value.data(32))
d.putValue(':'.join('%04x' % int(data[i:i+4], 16) for i in xrange(0, 64, 4)))
if d.isExpanded():
with Children(d):
......@@ -84,7 +84,7 @@ def qdump____m256i(d, value):
d.putArrayItem('uint64x4', addr, 4, 'unsigned long long')
def qdump____m512i(d, value):
data = d.hexencode(value.data())
data = d.hexencode(value.data(64))
d.putValue(':'.join('%04x' % int(data[i:i+4], 16) for i in xrange(0, 64, 4))
+ ', ' + ':'.join('%04x' % int(data[i:i+4], 16) for i in xrange(64, 128, 4)))
if d.isExpanded():
......
......@@ -38,13 +38,9 @@ def qdump__QBasicAtomicInt(d, value):
def qdump__QAtomicPointer(d, value):
d.putType(value.type)
p = value.extractPointer()
d.putValue('@0x%x' % p)
d.putNumChild(1 if p else 0)
if d.isExpanded():
with Children(d):
d.putSubItem('[pointee]', value.dereference())
d.putItem(value.cast(value.type[0].pointer()))
d.putBetterType(value.type)
def qform__QByteArray():
return [Latin1StringFormat, SeparateLatin1StringFormat,
......@@ -1064,6 +1060,7 @@ def qdump__QRegExp(d, value):
privAddress = d.extractPointer(value)
(eng, pattern) = d.split('p{QString}', privAddress)
d.putStringValue(pattern)
d.putNumChild(1)
if d.isExpanded():
with Children(d):
d.call('void', value, 'capturedTexts') # Warm up internal cache.
......
......@@ -511,10 +511,17 @@ def qdump__std____1__map__const_iterator(d, value):
def qdump__std____1__set__iterator(d, value):
d.putEmptyValue()
d.putNumChild(1)
if value.type.name.endswith("::iterator"):
treeTypeName = value.type.name[:-len("::iterator")]
elif value.type.name.endswith("::const_iterator"):
treeTypeName = value.type.name[:-len("::const_iterator")]
treeType = d.lookupType(treeTypeName)
keyType = treeType[0]
if d.isExpanded():
with Children(d):
node = value['__ptr_'].dereference()['__value_']
node = node.cast(value.type[0])
node = node.cast(keyType)
d.putSubItem('value', node)
def qdump__std____1__set_const_iterator(d, value):
......
......@@ -124,7 +124,7 @@ TextColorHighlight=ffff0000
TextColorLink=textColorLink
TextColorLinkVisited=textColorLinkVisited
TextColorNormal=text
TodoItemTextColor=text
TodoItemTextColor=ff000000
ToggleButtonBackgroundColor=shadowBackground
ToolBarBackgroundColor=shadowBackground
TreeViewArrowColorNormal=hoverBackground
......
......@@ -122,7 +122,7 @@ TextColorHighlight=ffff0000
TextColorLink=ff007af4
TextColorLinkVisited=ffa57aff
TextColorNormal=text
TodoItemTextColor=text
TodoItemTextColor=ff000000
ToggleButtonBackgroundColor=shadowBackground
ToolBarBackgroundColor=shadowBackground
TreeViewArrowColorNormal=hoverBackground
......
......@@ -120,7 +120,7 @@ TextColorHighlight=ffff0000
TextColorLink=ff007af4
TextColorLinkVisited=ffa57aff
TextColorNormal=text
TodoItemTextColor=text
TodoItemTextColor=ff000000
ToggleButtonBackgroundColor=shadowBackground
ToolBarBackgroundColor=shadowBackground
TreeViewArrowColorNormal=hoverBackground
......
......@@ -33,6 +33,16 @@ Item {
property int screenDependHeightDistance: Math.min(50, Math.max(16, height / 30))
DropArea {
anchors.fill: parent
keys: ["text/uri-list"]
onDropped: {
if ((drop.supportedActions & Qt.CopyAction != 0)
&& welcomeMode.openDroppedFiles(drop.urls))
drop.accept(Qt.CopyAction);
}
}
SideBar {
id: sideBar
model: pagesModel
......
......@@ -369,9 +369,12 @@ template <typename ForwardIterator, typename InitFunction, typename MapFunction,
QFuture<ReduceResult>
mapReduce(ForwardIterator begin, ForwardIterator end, InitFunction &&init, MapFunction &&map,
ReduceFunction &&reduce, CleanUpFunction &&cleanup,
MapReduceOption option = MapReduceOption::Unordered, int size = -1)
MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority,
int size = -1)
{
return runAsync(Internal::blockingIteratorMapReduce<
return runAsync(priority,
Internal::blockingIteratorMapReduce<
ForwardIterator,
typename std::decay<InitFunction>::type,
typename std::decay<MapFunction>::type,
......@@ -438,9 +441,11 @@ template <typename Container, typename InitFunction, typename MapFunction,
QFuture<ReduceResult>
mapReduce(Container &&container, InitFunction &&init, MapFunction &&map,
ReduceFunction &&reduce, CleanUpFunction &&cleanup,
MapReduceOption option = MapReduceOption::Unordered)
MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority)
{
return runAsync(Internal::blockingContainerMapReduce<
return runAsync(priority,
Internal::blockingContainerMapReduce<
typename std::decay<Container>::type,
typename std::decay<InitFunction>::type,
typename std::decay<MapFunction>::type,
......@@ -458,9 +463,11 @@ template <typename Container, typename InitFunction, typename MapFunction,
QFuture<ReduceResult>
mapReduce(std::reference_wrapper<Container> containerWrapper, InitFunction &&init, MapFunction &&map,
ReduceFunction &&reduce, CleanUpFunction &&cleanup,
MapReduceOption option = MapReduceOption::Unordered)
MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority)
{
return runAsync(Internal::blockingContainerRefMapReduce<
return runAsync(priority,
Internal::blockingContainerRefMapReduce<
Container,
typename std::decay<InitFunction>::type,
typename std::decay<MapFunction>::type,
......@@ -478,14 +485,15 @@ template <typename ForwardIterator, typename MapFunction, typename State, typena
typename MapResult = typename Internal::resultType<MapFunction>::type>
QFuture<StateResult>
mapReduce(ForwardIterator begin, ForwardIterator end, MapFunction &&map, State &&initialState,
ReduceFunction &&reduce, MapReduceOption option = MapReduceOption::Unordered, int size = -1)
ReduceFunction &&reduce, MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority, int size = -1)
{
return mapReduce(begin, end,
Internal::StateWrapper<State>(std::forward<State>(initialState)),
std::forward<MapFunction>(map),
Internal::ReduceWrapper<StateResult, MapResult, ReduceFunction>(std::forward<ReduceFunction>(reduce)),
&Internal::cleanupReportingState<StateResult>,
option, size);
option, priority, size);
}
template <typename Container, typename MapFunction, typename State, typename ReduceFunction,
......@@ -493,14 +501,15 @@ template <typename Container, typename MapFunction, typename State, typename Red
typename MapResult = typename Internal::resultType<MapFunction>::type>
QFuture<StateResult>
mapReduce(Container &&container, MapFunction &&map, State &&initialState, ReduceFunction &&reduce,
MapReduceOption option = MapReduceOption::Unordered)
MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority)
{
return mapReduce(std::forward<Container>(container),
Internal::StateWrapper<State>(std::forward<State>(initialState)),
std::forward<MapFunction>(map),
Internal::ReduceWrapper<StateResult, MapResult, ReduceFunction>(std::forward<ReduceFunction>(reduce)),
&Internal::cleanupReportingState<StateResult>,
option);
option, priority);
}
template <typename ForwardIterator, typename MapFunction, typename State, typename ReduceFunction,
......@@ -509,12 +518,13 @@ template <typename ForwardIterator, typename MapFunction, typename State, typena
Q_REQUIRED_RESULT
StateResult
mappedReduced(ForwardIterator begin, ForwardIterator end, MapFunction &&map, State &&initialState,
ReduceFunction &&reduce, MapReduceOption option = MapReduceOption::Unordered, int size = -1)
ReduceFunction &&reduce, MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority, int size = -1)
{
return mapReduce(begin, end,
std::forward<MapFunction>(map), std::forward<State>(initialState),
std::forward<ReduceFunction>(reduce),
option, size).result();
option, priority, size).result();
}
template <typename Container, typename MapFunction, typename State, typename ReduceFunction,
......@@ -523,38 +533,41 @@ template <typename Container, typename MapFunction, typename State, typename Red
Q_REQUIRED_RESULT
StateResult
mappedReduced(Container &&container, MapFunction &&map, State &&initialState, ReduceFunction &&reduce,
MapReduceOption option = MapReduceOption::Unordered)
MapReduceOption option = MapReduceOption::Unordered,
QThread::Priority priority = QThread::InheritPriority)
{
return mapReduce(std::forward<Container>(container), std::forward<MapFunction>(map),
std::forward<State>(initialState), std::forward<ReduceFunction>(reduce),
option).result();
option, priority).result();
}
template <typename ForwardIterator, typename MapFunction,
typename MapResult = typename Internal::resultType<MapFunction>::type>
QFuture<MapResult>
map(ForwardIterator begin, ForwardIterator end, MapFunction &&map,
MapReduceOption option = MapReduceOption::Ordered, int size = -1)
MapReduceOption option = MapReduceOption::Ordered,
QThread::Priority priority = QThread::InheritPriority, int size = -1)
{
return mapReduce(begin, end,
&Internal::dummyInit<MapResult>,
std::forward<MapFunction>(map),
Internal::DummyReduce<MapResult>(),
&Internal::dummyCleanup<MapResult>,
option, size);
option, priority, size);
}
template <typename Container, typename MapFunction,
typename MapResult = typename Internal::resultType<MapFunction>::type>
QFuture<MapResult>
map(Container &&container, MapFunction &&map, MapReduceOption option = MapReduceOption::Ordered)
map(Container &&container, MapFunction &&map, MapReduceOption option = MapReduceOption::Ordered,
QThread::Priority priority = QThread::InheritPriority)
{
return mapReduce(std::forward<Container>(container),
Internal::dummyInit<MapResult>,
std::forward<MapFunction>(map),
Internal::DummyReduce<MapResult>(),
Internal::dummyCleanup<MapResult>,
option);
option, priority);
}
template <template<typename> class ResultContainer, typename ForwardIterator, typename MapFunction,
......@@ -562,11 +575,12 @@ template <template<typename> class ResultContainer, typename ForwardIterator, ty
Q_REQUIRED_RESULT
ResultContainer<MapResult>
mapped(ForwardIterator begin, ForwardIterator end, MapFunction &&mapFun,
MapReduceOption option = MapReduceOption::Ordered, int size = -1)
MapReduceOption option = MapReduceOption::Ordered,
QThread::Priority priority = QThread::InheritPriority, int size = -1)
{
return Utils::transform<ResultContainer>(map(begin, end,
std::forward<MapFunction>(mapFun),
option, size).results(),
option, priority, size).results(),
[](const MapResult &r) { return r; });
}
......@@ -574,11 +588,13 @@ template <template<typename> class ResultContainer, typename Container, typename
typename MapResult = typename Internal::resultType<MapFunction>::type>
Q_REQUIRED_RESULT
ResultContainer<MapResult>
mapped(Container &&container, MapFunction &&mapFun, MapReduceOption option = MapReduceOption::Ordered)
mapped(Container &&container, MapFunction &&mapFun,
MapReduceOption option = MapReduceOption::Ordered,
QThread::Priority priority = QThread::InheritPriority)
{
return Utils::transform<ResultContainer>(map(container,
std::forward<MapFunction>(mapFun),
option).results(),
option, priority).results(),
[](const MapResult &r) { return r; });
}
......
......@@ -25,6 +25,8 @@
#pragma once
#include <qsystemdetection.h>
#include <cstdlib>
#include <cstring>
#include <memory>
......@@ -35,7 +37,7 @@ namespace Memory {
inline char *allocate(std::size_t size)
{
#ifdef WIN32
#ifdef Q_OS_WIN32
return static_cast<char*>(_aligned_malloc(size, 64));
#else
return static_cast<char*>(std::malloc(size));
......@@ -44,7 +46,7 @@ inline char *allocate(std::size_t size)
inline void deallocate(char *memory)
{
#ifdef WIN32
#ifdef Q_OS_WIN32
_aligned_free(memory);
#else
#pragma GCC diagnostic push
......@@ -58,7 +60,7 @@ inline void deallocate(char *memory)
inline char *reallocate(char *oldMemory, std::size_t newSize)
{
#ifdef WIN32
#ifdef Q_OS_WIN32
return static_cast<char*>(_aligned_realloc(oldMemory, newSize, 64));
#else
return static_cast<char*>(std::realloc(oldMemory, newSize));
......
......@@ -5,16 +5,6 @@
<file>images/sort@2x.png</file>
<file>images/leafsort.png</file>
<file>images/leafsort@2x.png</file>
<file>images/debug.png</file>
<file>images/fail.png</file>
<file>images/fatal.png</file>
<file>images/pass.png</file>
<file>images/skip.png</file>
<file>images/warn.png</file>
<file>images/xfail.png</file>
<file>images/xpass.png</file>
<file>images/blacklisted_fail.png</file>
<file>images/blacklisted_pass.png</file>
<file>images/benchmark.png</file>
<file>images/runselected_boxes.png</file>
<file>images/runselected_boxes@2x.png</file>
......
......@@ -38,5 +38,39 @@ const Utils::Icon RUN_SELECTED_OVERLAY({
{QLatin1String(":/images/runselected_boxes.png"), Utils::Theme::BackgroundColorDark},
{QLatin1String(":/images/runselected_tickmarks.png"), Utils::Theme::IconsBaseColor}});
const Utils::Icon RESULT_PASS({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestPassTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_FAIL({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestFailTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_XFAIL({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestXFailTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_XPASS({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestXPassTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_SKIP({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestSkipTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_BLACKLISTEDPASS({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestPassTextColor},
{":/projectexplorer/images/buildstepdisable.png", Utils::Theme::PanelTextColorDark}},
Utils::Icon::Tint | Utils::Icon::PunchEdges);
const Utils::Icon RESULT_BLACKLISTEDFAIL({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestFailTextColor},
{":/projectexplorer/images/buildstepdisable.png", Utils::Theme::PanelTextColorDark}},
Utils::Icon::Tint | Utils::Icon::PunchEdges);
const Utils::Icon RESULT_BENCHMARK(":/images/benchmark.png");
const Utils::Icon RESULT_MESSAGEDEBUG({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestDebugTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_MESSAGEWARN({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestWarnTextColor}},
Utils::Icon::Tint);
const Utils::Icon RESULT_MESSAGEFATAL({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestFatalTextColor}},
Utils::Icon::Tint);
} // namespace Icons
} // namespace Autotest
......@@ -178,6 +178,7 @@ void AutotestPlugin::onRunSelectedTriggered()
void AutotestPlugin::updateMenuItemsEnabledState()
{
const bool enabled = !TestRunner::instance()->isTestRunning()
&& TestTreeModel::instance()->parser()->enabled()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle;
const bool hasTests = TestTreeModel::instance()->hasTests();
......