Merge remote-tracking branch 'origin/4.2'

Change-Id: I957c22020fbacb2f631220b0cdc7fa16a782798b
This commit is contained in:
Orgad Shaneh
2016-11-21 10:25:45 +02:00
36 changed files with 488 additions and 308 deletions

View File

@@ -108,45 +108,36 @@ def qdump__boost__posix_time__time_duration(d, value):
def qdump__boost__unordered__unordered_set(d, value): def qdump__boost__unordered__unordered_set(d, value):
base = value.address() innerType = value.type[0]
ptrSize = d.ptrSize() if value.type.size() == 6 * d.ptrSize(): # 48 for boost 1.55+, 40 for 1.48
size = d.extractInt(base + 2 * ptrSize) # boost 1.58 or 1.55
d.putItemCount(size) # bases are 3? bytes, and mlf is actually a float, but since
# its followed by size_t maxload, it's # effectively padded to a size_t
bases, bucketCount, size, mlf, maxload, buckets = value.split('tttttp')
# Distinguish 1.58 and 1.55. 1.58 used one template argument, 1.55 two.
ittype = d.lookupType(value.type.name + '::iterator').target()
forward = len(ittype.templateArguments()) == 1
else:
# boost 1.48
# Values are stored before the next pointers. Determine the offset.
buckets, bucketCount, size, mlf, maxload = value.split('ptttt')
forward = False
if d.isExpanded(): if forward:
innerType = value.type[0] # boost 1.58
bucketCount = d.extractInt(base + ptrSize) code = 'pp{%s}' % innerType.name
#warn("A BUCKET COUNT: %s" % bucketCount) def children(p):
#warn("X BUCKET COUNT: %s" % d.parseAndEvaluate("s1.table_.bucket_count_").value()) while True:
try: p, dummy, val = d.split(code, p)
# boost 1.58 yield val
table = value["table_"] else:
bucketsAddr = table["buckets_"].integer() # boost 1.48 or 1.55
#warn("A BUCKETS: 0x%x" % bucketsAddr) code = '{%s}@p' % innerType.name
#warn("X BUCKETS: 0x%x" % d.parseAndEvaluate("s1.table_.buckets_").pointer()) (pp, ssize, fields) = d.describeStruct(code)
lastBucketAddr = bucketsAddr + bucketCount * ptrSize offset = fields[2].offset()
#warn("A LAST BUCKET: 0x%x" % lastBucketAddr) def children(p):
#warn("X LAST BUCKET: 0x%x" % d.parseAndEvaluate("s1.table_.get_bucket(s1.table_.bucket_count_)").pointer()) while True:
previousStartAddr = lastBucketAddr val, pad, p = d.split(code, p - offset)
#warn("A PREVIOUS START: 0x%x" % previousStartAddr) yield val
#warn("X PREVIOUS START: 0x%x" % d.parseAndEvaluate("s1.table_.get_previous_start()").pointer()) p = d.extractPointer(buckets + bucketCount * d.ptrSize())
item = d.extractPointer(previousStartAddr) d.putItems(size, children(p), maxNumChild = 10000)
#warn("A KEY ADDR: 0x%x" % item)
#warn("X KEY ADDR: 0x%x" % d.parseAndEvaluate("s1.table_.get_previous_start()->next_").pointer())
item = d.extractPointer(previousStartAddr)
#warn("A VALUE: %x" % d.extractInt(item + ptrSize))
#warn("X VALUE: %x" % d.parseAndEvaluate("*(int*)(s1.table_.get_previous_start()->next_ + 1)").integer())
with Children(d, size, maxNumChild=10000):
for j in d.childRange():
d.putSubItem(j, d.createValue(item + 2 * ptrSize, innerType))
item = d.extractPointer(item)
except:
# boost 1.48
offset = int((innerType.size() + ptrSize - 1) / ptrSize) * ptrSize
with Children(d, size, maxNumChild=10000):
afterBuckets = d.extractPointer(base + 5 * ptrSize)
afterBuckets += bucketCount * ptrSize
item = d.extractPointer(afterBuckets)
for j in d.childRange():
d.putSubItem(j, d.createValue(item - offset, innerType))
item = d.extractPointer(item)

View File

@@ -170,10 +170,7 @@ class Dumper(DumperBase):
else: else:
targs.append(self.Type(self, targ)) targs.append(self.Type(self, targ))
elif isinstance(targ, int): elif isinstance(targ, int):
value = self.Value(self) targs.append(targ)
value.type = self.lookupType('int')
value.ldata = targ.to_bytes(4, sys.byteorder)
targs.append(value)
else: else:
error('CDBCRAP %s' % type(targ)) error('CDBCRAP %s' % type(targ))
return targs return targs

View File

@@ -866,26 +866,27 @@ class DumperBase:
baseIndex = 0 baseIndex = 0
for item in value.members(True): for item in value.members(True):
#warn('FIELD: %s' % item) #warn('FIELD: %s' % item)
if item.name is not None and item.name.startswith('_vptr.'): if item.name is not None:
with SubItem(self, '[vptr]'): if item.name.startswith('_vptr.') or item.name.startswith('__vfptr'):
# int (**)(void) with SubItem(self, '[vptr]'):
self.putType(' ') # int (**)(void)
self.putField('sortgroup', 20) self.putType(' ')
self.putValue(item.name) self.putField('sortgroup', 20)
n = 10 self.putValue(item.name)
if self.isExpanded(): n = 10
with Children(self): if self.isExpanded():
p = item.pointer() with Children(self):
for i in xrange(n): p = item.pointer()
deref = self.extractPointer(p) for i in xrange(n):
if deref == 0: deref = self.extractPointer(p)
n = i if deref == 0:
break n = i
with SubItem(self, i): break
self.putItem(self.createPointerValue(deref, 'void')) with SubItem(self, i):
p += self.ptrSize() self.putItem(self.createPointerValue(deref, 'void'))
self.putNumChild(n) p += self.ptrSize()
continue self.putNumChild(n)
continue
if item.isBaseClass and dumpBase: if item.isBaseClass and dumpBase:
baseIndex += 1 baseIndex += 1
@@ -2585,6 +2586,13 @@ class DumperBase:
return True return True
return False return False
def putItems(self, count, generator, maxNumChild=10000):
self.putItemCount(count)
if self.isExpanded():
with Children(self, count, maxNumChild=maxNumChild):
for i, val in zip(self.childRange(), generator):
self.putSubItem(i, val)
def putItem(self, value): def putItem(self, value):
self.preping('putItem') self.preping('putItem')
self.putItemX(value) self.putItemX(value)
@@ -2738,6 +2746,19 @@ class DumperBase:
return tiVersion return tiVersion
return None return None
def qtDeclarativeHookDataSymbolName(self):
return 'qtDeclarativeHookData'
def qtDeclarativeTypeInfoVersion(self):
addr = self.symbolAddress(self.qtDeclarativeHookDataSymbolName())
if addr:
# Only available with Qt 5.6+
(hookVersion, x, tiVersion) = self.split('ppp', addr)
if hookVersion >= 1:
self.qtTypeInfoVersion = lambda: tiVersion
return tiVersion
return None
def addToCache(self, typeobj): def addToCache(self, typeobj):
typename = typeobj.name typename = typeobj.name
if typename in self.typesReported: if typename in self.typesReported:
@@ -3316,6 +3337,12 @@ class DumperBase:
def unqualified(self): def unqualified(self):
return self return self
def templateArguments(self):
tdata = self.typeData()
if tdata is None:
return self.dumper.listTemplateParameters(self.typeId)
return tdata.templateArguments
def templateArgument(self, position): def templateArgument(self, position):
tdata = self.typeData() tdata = self.typeData()
#warn('TDATA: %s' % tdata) #warn('TDATA: %s' % tdata)
@@ -3768,11 +3795,14 @@ class DumperBase:
readingTypeName = False readingTypeName = False
fieldType = self.createType(typeName) fieldType = self.createType(typeName)
fieldAlign = fieldType.alignment() fieldAlign = fieldType.alignment()
builder.addField(n, fieldIsStruct = True, fieldType = fieldType, fieldAlign = fieldAlign) builder.addField(n, fieldIsStruct = True,
fieldType = fieldType, fieldAlign = fieldAlign)
typeName = None typeName = None
n = None n = None
else: else:
typeName += c typeName += c
elif c == 't': # size_t
builder.addField(ptrSize, self.ptrCode(), fieldAlign = ptrSize)
elif c == 'p': # Pointer as int elif c == 'p': # Pointer as int
builder.addField(ptrSize, self.ptrCode(), fieldAlign = ptrSize) builder.addField(ptrSize, self.ptrCode(), fieldAlign = ptrSize)
elif c == 'P': # Pointer as Value elif c == 'P': # Pointer as Value

View File

@@ -1384,7 +1384,7 @@ class Dumper(DumperBase):
'd = lldb.theDumper', 'd = lldb.theDumper',
'output = d.hexencode(sys.stdout.getvalue())', 'output = d.hexencode(sys.stdout.getvalue())',
'sys.stdout = origout', 'sys.stdout = origout',
'd.report("output={channel=\"stderr\",data=\"' + output + '\"}")', 'd.report("output={channel=\"stderr\",data=\" + output + \"}")',
'if result is False:', 'if result is False:',
' d.reportState("continueafternextstop")', ' d.reportState("continueafternextstop")',
'return True' 'return True'

View File

@@ -470,7 +470,7 @@ def qdump__QFile(d, value):
offset = 144 if is32bit else 232 offset = 144 if is32bit else 232
else: else:
offset = 140 if is32bit else 232 offset = 140 if is32bit else 232
privAddress = d.extractPointer(value.address() + d.ptrSize()) vtable, privAddress = value.split('pp')
fileNameAddress = privAddress + offset fileNameAddress = privAddress + offset
d.putStringValue(fileNameAddress) d.putStringValue(fileNameAddress)
d.putNumChild(1) d.putNumChild(1)
@@ -578,11 +578,10 @@ def qform__QFiniteStack():
return arrayForms() return arrayForms()
def qdump__QFiniteStack(d, value): def qdump__QFiniteStack(d, value):
alloc = int(value['_alloc']) array, alloc, size = value.split('pii')
size = int(value['_size'])
d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000) d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
d.putItemCount(size) d.putItemCount(size)
d.putPlotData(value['_array'], size, value.type[0]) d.putPlotData(array, size, value.type[0])
def qdump__QFlags(d, value): def qdump__QFlags(d, value):
@@ -1572,6 +1571,7 @@ qdumpHelper_QVariants_F = [
def qdump__QVariant(d, value): def qdump__QVariant(d, value):
(data, typeStuff) = d.split('8sI', value) (data, typeStuff) = d.split('8sI', value)
variantType = typeStuff & 0x3fffffff variantType = typeStuff & 0x3fffffff
isShared = bool(typeStuff & 0x40000000)
# Well-known simple type. # Well-known simple type.
if variantType <= 6: if variantType <= 6:
@@ -1616,14 +1616,12 @@ def qdump__QVariant(d, value):
#data = value['d']['data'] #data = value['d']['data']
innerType = d.qtNamespace() + innert innerType = d.qtNamespace() + innert
isShared = bool(typeStuff & 0x40000000)
#warn('SHARED: %s' % isShared) #warn('SHARED: %s' % isShared)
if isShared: if isShared:
base1 = d.extractPointer(value) base1 = d.extractPointer(value)
#warn('BASE 1: %s %s' % (base1, innert)) #warn('BASE 1: %s %s' % (base1, innert))
base = d.extractPointer(base1) base = d.extractPointer(base1)
#warn('SIZE 1: %s' % size) #warn('SIZE 1: %s' % size)
innerType = d.createType(d.qtNamespace() + innert)
val = d.createValue(base, innerType) val = d.createValue(base, innerType)
else: else:
#warn('DIRECT ITEM 1: %s' % innerType) #warn('DIRECT ITEM 1: %s' % innerType)
@@ -1643,19 +1641,9 @@ def qdump__QVariant(d, value):
d.putType('%sQVariant (%s)' % (ns, variantType)) d.putType('%sQVariant (%s)' % (ns, variantType))
d.putNumChild(1) d.putNumChild(1)
if d.isExpanded(): if d.isExpanded():
typeName = None innerType = None
with Children(d): with Children(d):
ev = d.parseAndEvaluate ev = d.parseAndEvaluate
data = d.call('const void *', value, 'constData')
addr = value.address()
data = ev('((%sQVariant*)0x%x)->constData()' % (ns, addr))
if data is None:
data = ev('((QVariant*)0x%x)->constData()' % addr)
if data is None:
d.putSpecialValue('notcallable')
return None
p = None p = None
if p is None: if p is None:
# Without debug info. # Without debug info.
@@ -1671,15 +1659,24 @@ def qdump__QVariant(d, value):
return None return None
ptr = p.pointer() ptr = p.pointer()
(elided, blob) = d.encodeCArray(ptr, 1, 100) (elided, blob) = d.encodeCArray(ptr, 1, 100)
typeName = d.hexdecode(blob) innerType = d.hexdecode(blob)
# Prefer namespaced version. # Prefer namespaced version.
if len(ns) > 0: if len(ns) > 0:
if not d.lookupNativeType(ns + typeName) is None: if not d.lookupNativeType(ns + innerType) is None:
typeName = ns + typeName innerType = ns + innerType
data.type = d.createType(typeName + ' *')
d.putSubItem('data', data) if isShared:
if not typeName is None: base1 = d.extractPointer(value)
d.putBetterType('%sQVariant (%s)' % (ns, typeName)) base = d.extractPointer(base1)
val = d.createValue(base, innerType)
else:
val = d.createValue(data, innerType)
val.laddress = value.laddress
d.putSubItem('data', val)
if not innerType is None:
d.putBetterType('%sQVariant (%s)' % (ns, innerType))
return None return None
@@ -1963,40 +1960,6 @@ if False:
QV4_ValueTypeInternal_Boolean_Type_Internal = QV4_ValueType_Boolean_Type | QV4_ConvertibleToInt QV4_ValueTypeInternal_Boolean_Type_Internal = QV4_ValueType_Boolean_Type | QV4_ConvertibleToInt
QV4_ValueTypeInternal_Integer_Type_Internal = QV4_ValueType_Integer_Type | QV4_ConvertibleToInt QV4_ValueTypeInternal_Integer_Type_Internal = QV4_ValueType_Integer_Type | QV4_ConvertibleToInt
else:
# 64 bit.
QV4_NaNEncodeMask = 0xffff800000000000
QV4_IsInt32Mask = 0x0002000000000000
QV4_IsDoubleMask = 0xfffc000000000000
QV4_IsNumberMask = QV4_IsInt32Mask | QV4_IsDoubleMask
QV4_IsNullOrUndefinedMask = 0x0000800000000000
QV4_IsNullOrBooleanMask = 0x0001000000000000
QV4_PointerMask = 0xfffffffffffffffd
QV4_Masks_NaN_Mask = 0x7ff80000
QV4_Masks_Type_Mask = 0xffff8000
QV4_Masks_IsDouble_Mask = 0xfffc0000
QV4_Masks_Immediate_Mask = 0x00018000
QV4_Masks_IsNullOrUndefined_Mask = 0x00008000
QV4_Masks_IsNullOrBoolean_Mask = 0x00010000
QV4_Masks_Tag_Shift = 32
QV4_ValueType_Undefined_Type = QV4_Masks_IsNullOrUndefined_Mask
QV4_ValueType_Null_Type = QV4_Masks_IsNullOrUndefined_Mask | QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Boolean_Type = QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Integer_Type = 0x20000 | QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Managed_Type = 0
QV4_ValueType_Empty_Type = QV4_ValueType_Undefined_Type | 0x4000
QV4_ValueTypeInternal_Null_Type_Internal = QV4_ValueType_Null_Type
QV4_ValueTypeInternal_Boolean_Type_Internal = QV4_ValueType_Boolean_Type
QV4_ValueTypeInternal_Integer_Type_Internal = QV4_ValueType_Integer_Type
QV4_IsDouble_Shift = 64-14
QV4_IsNumber_Shift = 64-15
QV4_IsConvertibleToInt_Shift = 64-16
QV4_IsManaged_Shift = 64-17
def QV4_getValue(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value * def QV4_getValue(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value *
dd = d.split('Q', jsval)[0] dd = d.split('Q', jsval)[0]
@@ -2106,6 +2069,56 @@ def qdump_32__QV4__Value(d, value):
d.putFields(value) d.putFields(value)
def qdump_64__QV4__Value(d, value): def qdump_64__QV4__Value(d, value):
dti = d.qtDeclarativeTypeInfoVersion()
new = dti is not None and dti >= 2
if new:
QV4_NaNEncodeMask = 0xfffc000000000000
QV4_Masks_Immediate_Mask = 0x00020000 # bit 49
QV4_ValueTypeInternal_Empty_Type_Internal = QV4_Masks_Immediate_Mask | 0
QV4_ConvertibleToInt = QV4_Masks_Immediate_Mask | 0x10000 # bit 48
QV4_ValueTypeInternal_Null_Type_Internal = QV4_ConvertibleToInt | 0x08000
QV4_ValueTypeInternal_Boolean_Type_Internal = QV4_ConvertibleToInt | 0x04000
QV4_ValueTypeInternal_Integer_Type_Internal = QV4_ConvertibleToInt | 0x02000
QV4_ValueType_Undefined_Type = 0 # Dummy to make generic code below pass.
else:
QV4_NaNEncodeMask = 0xffff800000000000
QV4_Masks_Immediate_Mask = 0x00018000
QV4_IsInt32Mask = 0x0002000000000000
QV4_IsDoubleMask = 0xfffc000000000000
QV4_IsNumberMask = QV4_IsInt32Mask | QV4_IsDoubleMask
QV4_IsNullOrUndefinedMask = 0x0000800000000000
QV4_IsNullOrBooleanMask = 0x0001000000000000
QV4_Masks_NaN_Mask = 0x7ff80000
QV4_Masks_Type_Mask = 0xffff8000
QV4_Masks_IsDouble_Mask = 0xfffc0000
QV4_Masks_IsNullOrUndefined_Mask = 0x00008000
QV4_Masks_IsNullOrBoolean_Mask = 0x00010000
QV4_ValueType_Undefined_Type = QV4_Masks_IsNullOrUndefined_Mask
QV4_ValueType_Null_Type = QV4_Masks_IsNullOrUndefined_Mask \
| QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Boolean_Type = QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Integer_Type = 0x20000 | QV4_Masks_IsNullOrBoolean_Mask
QV4_ValueType_Managed_Type = 0
QV4_ValueType_Empty_Type = QV4_ValueType_Undefined_Type | 0x4000
QV4_ValueTypeInternal_Null_Type_Internal = QV4_ValueType_Null_Type
QV4_ValueTypeInternal_Boolean_Type_Internal = QV4_ValueType_Boolean_Type
QV4_ValueTypeInternal_Integer_Type_Internal = QV4_ValueType_Integer_Type
QV4_PointerMask = 0xfffffffffffffffd
QV4_Masks_Tag_Shift = 32
QV4_IsDouble_Shift = 64-14
QV4_IsNumber_Shift = 64-15
QV4_IsConvertibleToInt_Shift = 64-16
QV4_IsManaged_Shift = 64-17
v = value.split('Q')[0] v = value.split('Q')[0]
tag = v >> QV4_Masks_Tag_Shift tag = v >> QV4_Masks_Tag_Shift
vtable = v & QV4_PointerMask vtable = v & QV4_PointerMask
@@ -2119,15 +2132,19 @@ def qdump_64__QV4__Value(d, value):
elif (v >> QV4_IsDouble_Shift): elif (v >> QV4_IsDouble_Shift):
d.putBetterType('%sQV4::Value (double)' % ns) d.putBetterType('%sQV4::Value (double)' % ns)
d.putValue('%x' % (v ^ QV4_NaNEncodeMask), 'float:8') d.putValue('%x' % (v ^ QV4_NaNEncodeMask), 'float:8')
elif tag == QV4_ValueType_Undefined_Type: elif tag == QV4_ValueType_Undefined_Type and not new:
d.putBetterType('%sQV4::Value (undefined)' % ns) d.putBetterType('%sQV4::Value (undefined)' % ns)
d.putValue('(undefined)') d.putValue('(undefined)')
elif tag == QV4_ValueTypeInternal_Null_Type_Internal: elif tag == QV4_ValueTypeInternal_Null_Type_Internal:
d.putBetterType('%sQV4::Value (null?)' % ns) d.putBetterType('%sQV4::Value (null?)' % ns)
d.putValue('(null?)') d.putValue('(null?)')
elif v == 0: elif v == 0:
d.putBetterType('%sQV4::Value (null)' % ns) if new:
d.putValue('(null)') d.putBetterType('%sQV4::Value (undefined)' % ns)
d.putValue('(undefined)')
else:
d.putBetterType('%sQV4::Value (null)' % ns)
d.putValue('(null)')
#elif ((v >> QV4_IsManaged_Shift) & ~1) == 1: #elif ((v >> QV4_IsManaged_Shift) & ~1) == 1:
# d.putBetterType('%sQV4::Value (null/undef)' % ns) # d.putBetterType('%sQV4::Value (null/undef)' % ns)
# d.putValue('(null/undef)') # d.putValue('(null/undef)')

View File

@@ -64,44 +64,46 @@ def qdump__std__deque(d, value):
innerSize = innerType.size() innerSize = innerType.size()
bufsize = 1 bufsize = 1
if innerSize < 512: if innerSize < 512:
bufsize = int(512 / innerSize) bufsize = 512 // innerSize
#(mapptr, mapsize, startCur, startFirst, startLast, startNode, (mapptr, mapsize, startCur, startFirst, startLast, startNode,
# finishCur, finishFirst, finishLast, finishNode) = d.split("pppppppppp", value) finishCur, finishFirst, finishLast, finishNode) = value.split("pppppppppp")
#
# numInBuf = bufsize * (int((finishNode - startNode) / innerSize) - 1)
# numFirstItems = int((startLast - startCur) / innerSize)
# numLastItems = int((finishCur - finishFirst) / innerSize)
impl = value["_M_impl"] size = bufsize * ((finishNode - startNode) // d.ptrSize() - 1)
start = impl["_M_start"] size += (finishCur - finishFirst) // innerSize
finish = impl["_M_finish"] size += (startLast - startCur) // innerSize
size = bufsize * ((finish["_M_node"].pointer() - start["_M_node"].pointer()) // d.ptrSize() - 1)
size += ((finish["_M_cur"].pointer() - finish["_M_first"].pointer()) // innerSize)
size += ((start["_M_last"].pointer() - start["_M_cur"].pointer()) // innerSize)
d.check(0 <= size and size <= 1000 * 1000 * 1000) d.check(0 <= size and size <= 1000 * 1000 * 1000)
d.putItemCount(size) d.putItemCount(size)
if d.isExpanded(): if d.isExpanded():
with Children(d, size, maxNumChild=2000, childType=innerType): with Children(d, size, maxNumChild=2000, childType=innerType):
pcur = start["_M_cur"].pointer() pcur = startCur
pfirst = start["_M_first"] plast = startLast
plast = start["_M_last"].pointer() pnode = startNode
pnode = start["_M_node"]
for i in d.childRange(): for i in d.childRange():
d.putSubItem(i, d.createValue(pcur, innerType)) d.putSubItem(i, d.createValue(pcur, innerType))
pcur += innerSize pcur += innerSize
if pcur == plast: if pcur == plast:
# FIXME: Remove pointer operation. newnode = pnode + d.ptrSize()
newnode = pnode + 1 # Type is std::_Deque_iterator<Foo, Foo&, Foo*>::_Map_pointer\"} a.k.a 'Foo **' pfirst = d.extractPointer(newnode)
#warn("TYPE: %s" % pnode.type)
#warn("PNODE: 0x%x %s" % (pnode.pointer(), pnode))
#warn("NEWNODE: 0x%x %s" % (newnode.pointer(), newnode))
pnode = newnode
#warn("PNODE 2: 0x%x %s" % (pnode.pointer(), pnode))
pfirst = newnode.dereference().pointer()
plast = pfirst + bufsize * d.ptrSize() plast = pfirst + bufsize * d.ptrSize()
pcur = pfirst pcur = pfirst
pnode = newnode
def qdump__std____1__deque(d, value):
mptr, mfirst, mbegin, mend, start, size = value.split("pppptt")
d.check(0 <= size and size <= 1000 * 1000 * 1000)
d.putItemCount(size)
if d.isExpanded():
innerType = value.type[0]
innerSize = innerType.size()
ptrSize = d.ptrSize()
bufsize = (4096 // innerSize) if innerSize < 256 else 16
with Children(d, size, maxNumChild=2000, childType=innerType):
for i in d.childRange():
k, j = divmod(start + i, bufsize)
base = d.extractPointer(mfirst + k * ptrSize)
d.putSubItem(i, d.createValue(base + j * innerSize, innerType))
def qdump__std__deque__QNX(d, value): def qdump__std__deque__QNX(d, value):
innerType = value.type[0] innerType = value.type[0]
@@ -534,6 +536,10 @@ def qdump__std__stack(d, value):
def qdump__std____debug__stack(d, value): def qdump__std____debug__stack(d, value):
qdump__std__stack(d, value) qdump__std__stack(d, value)
def qdump__std____1__stack(d, value):
d.putItem(value["c"])
d.putBetterType(value.type)
def qform__std__string(): def qform__std__string():
return [Latin1StringFormat, SeparateLatin1StringFormat, return [Latin1StringFormat, SeparateLatin1StringFormat,
Utf8StringFormat, SeparateUtf8StringFormat ] Utf8StringFormat, SeparateUtf8StringFormat ]

View File

@@ -43,6 +43,11 @@
"QtQuick.Controls 1.3", "QtQuick.Controls 1.3",
"QtQuick.Controls 1.4", "QtQuick.Controls 1.4",
"QtQuick.Controls 2.0", "QtQuick.Controls 2.0",
"QtQuick.Controls 2.1",
"QtQuick.Controls.Material 2.0",
"QtQuick.Controls.Material 2.1",
"QtQuick.Controls.Universal 2.0",
"QtQuick.Controls.Universal 2.1",
"QtQuick.Controls.Styles 1.0", "QtQuick.Controls.Styles 1.0",
"QtQuick.Controls.Styles 1.1", "QtQuick.Controls.Styles 1.1",
"QtQuick.Controls.Styles 1.2", "QtQuick.Controls.Styles 1.2",
@@ -57,6 +62,7 @@
"QtQuick.LocalStorage 2.0", "QtQuick.LocalStorage 2.0",
"QtQuick.Particles 2.0", "QtQuick.Particles 2.0",
"QtQuick.Templates 2.0", "QtQuick.Templates 2.0",
"QtQuick.Templates 2.1",
"QtQuick.Window 2.0", "QtQuick.Window 2.0",
"QtQuick.XmlListModel 2.0", "QtQuick.XmlListModel 2.0",
"QtSensors 5.3", "QtSensors 5.3",

View File

@@ -311,6 +311,7 @@ int main(int argc, char **argv)
setrlimit(RLIMIT_NOFILE, &rl); setrlimit(RLIMIT_NOFILE, &rl);
#endif #endif
SharedTools::QtSingleApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv); SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
loadFonts(); loadFonts();

View File

@@ -1428,6 +1428,17 @@ static QString functionName(ExpressionNode *ast, SourceLocation *location)
return QString(); return QString();
} }
static QString functionNamespace(ExpressionNode *ast)
{
if (FieldMemberExpression *fme = cast<FieldMemberExpression *>(ast)) {
if (!fme->name.isEmpty()) {
SourceLocation location;
return functionName(fme->base, &location);
}
}
return QString();
}
void Check::checkNewExpression(ExpressionNode *ast) void Check::checkNewExpression(ExpressionNode *ast)
{ {
SourceLocation location; SourceLocation location;
@@ -1612,12 +1623,18 @@ bool Check::visit(CallExpression *ast)
SourceLocation location; SourceLocation location;
const QString name = functionName(ast->base, &location); const QString name = functionName(ast->base, &location);
const QString namespaceName = functionNamespace(ast->base);
// We have to allow the qsTr function for translation. // We have to allow the qsTr function for translation.
bool isTranslationFunction = (name == QLatin1String("qsTr") || name == QLatin1String("qsTrId"));
const bool isTranslationFunction = (name == QLatin1String("qsTr") || name == QLatin1String("qsTrId"));
// We allow the Math. functions
const bool isMathFunction = namespaceName == "Math";
// allow adding connections with the help of the qt quick designer ui // allow adding connections with the help of the qt quick designer ui
bool isDirectInConnectionsScope = bool isDirectInConnectionsScope =
(!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("Connections")); (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("Connections"));
if (!isTranslationFunction && !isDirectInConnectionsScope) if (!isTranslationFunction && !isMathFunction && !isDirectInConnectionsScope)
addMessage(ErrFunctionsNotSupportedInQmlUi, location); addMessage(ErrFunctionsNotSupportedInQmlUi, location);
if (!name.isEmpty() && name.at(0).isUpper() if (!name.isEmpty() && name.at(0).isUpper()

View File

@@ -24,12 +24,14 @@ DEF_FILE=$$PWD/qtcreatorcdbext.def
# Find out whether we are _building_ 64/32bit and determine target # Find out whether we are _building_ 64/32bit and determine target
# directories accordingly. # directories accordingly.
# #
# Newer MSVC versions set CPU, olders do not, so use hacky check on # Check for VSCMD_ARG_TGT_ARCH (VS 17) or Platform=X64 (VS 13, 15)
# LIBPATH if CPU is not available # For older versions, fall back to hacky check on LIBPATH
ENV_CPU=$$(CPU)
ENV_TARGET_ARCH=$$(VSCMD_ARG_TGT_ARCH)
isEmpty(ENV_TARGET_ARCH):ENV_TARGET_ARCH = $$(Platform)
ENV_LIBPATH=$$(LIBPATH) ENV_LIBPATH=$$(LIBPATH)
contains(ENV_CPU, ^AMD64$) { contains(ENV_TARGET_ARCH, .*64$) {
DIRNAME=$${BASENAME}64 DIRNAME=$${BASENAME}64
CDB_PLATFORM=amd64 CDB_PLATFORM=amd64
@@ -38,7 +40,7 @@ contains(ENV_CPU, ^AMD64$) {
} else { } else {
LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng
} }
} else:isEmpty(ENV_CPU):contains(ENV_LIBPATH, ^.*amd64.*$) { } else:isEmpty(ENV_TARGET_ARCH):contains(ENV_LIBPATH, ^.*amd64.*$) {
DIRNAME=$${BASENAME}64 DIRNAME=$${BASENAME}64
CDB_PLATFORM=amd64 CDB_PLATFORM=amd64

View File

@@ -116,9 +116,10 @@ Utils::SmallStringVector ClangQueryCurrentFileFindFilter::createCommandLine() co
{ {
using ClangRefactoring::RefactoringCompilerOptionsBuilder; using ClangRefactoring::RefactoringCompilerOptionsBuilder;
auto commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(), auto commandLine = RefactoringCompilerOptionsBuilder::build(
fileKindInProjectPart(projectPart.data(), projectPart.data(),
currentDocumentFilePath)); fileKindInProjectPart(projectPart.data(), currentDocumentFilePath),
RefactoringCompilerOptionsBuilder::PchUsage::None);
commandLine.push_back(currentDocumentFilePath); commandLine.push_back(currentDocumentFilePath);

View File

@@ -1222,11 +1222,9 @@ InsertVirtualMethods::~InsertVirtualMethods()
void InsertVirtualMethods::match(const CppQuickFixInterface &interface, void InsertVirtualMethods::match(const CppQuickFixInterface &interface,
QuickFixOperations &result) QuickFixOperations &result)
{ {
InsertVirtualMethodsOp *op = new InsertVirtualMethodsOp(interface, m_dialog); QSharedPointer<InsertVirtualMethodsOp> op(new InsertVirtualMethodsOp(interface, m_dialog));
if (op->isValid()) if (op->isValid())
result.append(op); result.append(op);
else
delete op;
} }
#ifdef WITH_TESTS #ifdef WITH_TESTS

View File

@@ -301,7 +301,7 @@ public:
void match(const CppQuickFixInterface &cppQuickFixInterface, QuickFixOperations &result) void match(const CppQuickFixInterface &cppQuickFixInterface, QuickFixOperations &result)
{ {
result.append(new AddIncludeForUndefinedIdentifierOp(cppQuickFixInterface, 0, m_include)); result << new AddIncludeForUndefinedIdentifierOp(cppQuickFixInterface, 0, m_include);
} }
private: private:

View File

@@ -427,7 +427,7 @@ void InverseLogicalComparison::match(const CppQuickFixInterface &interface,
return; return;
} }
result.append(new InverseLogicalComparisonOp(interface, index, binary, invertToken)); result << new InverseLogicalComparisonOp(interface, index, binary, invertToken);
} }
namespace { namespace {
@@ -517,7 +517,7 @@ void FlipLogicalOperands::match(const CppQuickFixInterface &interface, QuickFixO
replacement = QLatin1String(tok.spell()); replacement = QLatin1String(tok.spell());
} }
result.append(new FlipLogicalOperandsOp(interface, index, binary, replacement)); result << new FlipLogicalOperandsOp(interface, index, binary, replacement);
} }
namespace { namespace {
@@ -696,13 +696,13 @@ void SplitSimpleDeclaration::match(const CppQuickFixInterface &interface,
if (cursorPosition >= startOfDeclSpecifier && cursorPosition <= endOfDeclSpecifier) { if (cursorPosition >= startOfDeclSpecifier && cursorPosition <= endOfDeclSpecifier) {
// the AST node under cursor is a specifier. // the AST node under cursor is a specifier.
result.append(new SplitSimpleDeclarationOp(interface, index, declaration)); result << new SplitSimpleDeclarationOp(interface, index, declaration);
return; return;
} }
if (core_declarator && interface.isCursorOn(core_declarator)) { if (core_declarator && interface.isCursorOn(core_declarator)) {
// got a core-declarator under the text cursor. // got a core-declarator under the text cursor.
result.append(new SplitSimpleDeclarationOp(interface, index, declaration)); result << new SplitSimpleDeclarationOp(interface, index, declaration);
return; return;
} }
} }
@@ -757,7 +757,7 @@ void AddBracesToIf::match(const CppQuickFixInterface &interface, QuickFixOperati
IfStatementAST *ifStatement = path.at(index)->asIfStatement(); IfStatementAST *ifStatement = path.at(index)->asIfStatement();
if (ifStatement && interface.isCursorOn(ifStatement->if_token) && ifStatement->statement if (ifStatement && interface.isCursorOn(ifStatement->if_token) && ifStatement->statement
&& !ifStatement->statement->asCompoundStatement()) { && !ifStatement->statement->asCompoundStatement()) {
result.append(new AddBracesToIfOp(interface, index, ifStatement->statement)); result << new AddBracesToIfOp(interface, index, ifStatement->statement);
return; return;
} }
@@ -768,7 +768,7 @@ void AddBracesToIf::match(const CppQuickFixInterface &interface, QuickFixOperati
if (ifStatement && ifStatement->statement if (ifStatement && ifStatement->statement
&& interface.isCursorOn(ifStatement->statement) && interface.isCursorOn(ifStatement->statement)
&& !ifStatement->statement->asCompoundStatement()) { && !ifStatement->statement->asCompoundStatement()) {
result.append(new AddBracesToIfOp(interface, index, ifStatement->statement)); result << new AddBracesToIfOp(interface, index, ifStatement->statement);
return; return;
} }
} }
@@ -1056,7 +1056,7 @@ void SplitIfStatement::match(const CppQuickFixInterface &interface, QuickFixOper
} }
if (interface.isCursorOn(condition->binary_op_token)) { if (interface.isCursorOn(condition->binary_op_token)) {
result.append(new SplitIfStatementOp(interface, index, pattern, condition)); result << new SplitIfStatementOp(interface, index, pattern, condition);
return; return;
} }
} }
@@ -1213,15 +1213,15 @@ void WrapStringLiteral::match(const CppQuickFixInterface &interface, QuickFixOpe
if (type == TypeChar) { if (type == TypeChar) {
unsigned actions = EncloseInQLatin1CharAction; unsigned actions = EncloseInQLatin1CharAction;
QString description = msgQtStringLiteralDescription(replacement(actions)); QString description = msgQtStringLiteralDescription(replacement(actions));
result.append(new WrapStringLiteralOp(interface, priority, actions, description, literal)); result << new WrapStringLiteralOp(interface, priority, actions, description, literal);
if (NumericLiteralAST *charLiteral = literal->asNumericLiteral()) { if (NumericLiteralAST *charLiteral = literal->asNumericLiteral()) {
const QByteArray contents(file->tokenAt(charLiteral->literal_token).identifier->chars()); const QByteArray contents(file->tokenAt(charLiteral->literal_token).identifier->chars());
if (!charToStringEscapeSequences(contents).isEmpty()) { if (!charToStringEscapeSequences(contents).isEmpty()) {
actions = DoubleQuoteAction | ConvertEscapeSequencesToStringAction; actions = DoubleQuoteAction | ConvertEscapeSequencesToStringAction;
description = QApplication::translate("CppTools::QuickFix", description = QApplication::translate("CppTools::QuickFix",
"Convert to String Literal"); "Convert to String Literal");
result.append(new WrapStringLiteralOp(interface, priority, actions, result << new WrapStringLiteralOp(interface, priority, actions,
description, literal)); description, literal);
} }
} }
} else { } else {
@@ -1235,21 +1235,21 @@ void WrapStringLiteral::match(const CppQuickFixInterface &interface, QuickFixOpe
| ConvertEscapeSequencesToCharAction | objectiveCActions; | ConvertEscapeSequencesToCharAction | objectiveCActions;
QString description = QApplication::translate("CppTools::QuickFix", QString description = QApplication::translate("CppTools::QuickFix",
"Convert to Character Literal and Enclose in QLatin1Char(...)"); "Convert to Character Literal and Enclose in QLatin1Char(...)");
result.append(new WrapStringLiteralOp(interface, priority, actions, result << new WrapStringLiteralOp(interface, priority, actions,
description, literal)); description, literal);
actions &= ~EncloseInQLatin1CharAction; actions &= ~EncloseInQLatin1CharAction;
description = QApplication::translate("CppTools::QuickFix", description = QApplication::translate("CppTools::QuickFix",
"Convert to Character Literal"); "Convert to Character Literal");
result.append(new WrapStringLiteralOp(interface, priority, actions, result << new WrapStringLiteralOp(interface, priority, actions,
description, literal)); description, literal);
} }
} }
actions = EncloseInQLatin1StringAction | objectiveCActions; actions = EncloseInQLatin1StringAction | objectiveCActions;
result.append(new WrapStringLiteralOp(interface, priority, actions, result << new WrapStringLiteralOp(interface, priority, actions,
msgQtStringLiteralDescription(replacement(actions), 4), literal)); msgQtStringLiteralDescription(replacement(actions), 4), literal);
actions = EncloseInQStringLiteralAction | objectiveCActions; actions = EncloseInQStringLiteralAction | objectiveCActions;
result.append(new WrapStringLiteralOp(interface, priority, actions, result << new WrapStringLiteralOp(interface, priority, actions,
msgQtStringLiteralDescription(replacement(actions), 5), literal)); msgQtStringLiteralDescription(replacement(actions), 5), literal);
} }
} }
@@ -1334,9 +1334,9 @@ void TranslateStringLiteral::match(const CppQuickFixInterface &interface,
Symbol *s = r.declaration(); Symbol *s = r.declaration();
if (s->type()->isFunctionType()) { if (s->type()->isFunctionType()) {
// no context required for tr // no context required for tr
result.append(new WrapStringLiteralOp(interface, path.size() - 1, result << new WrapStringLiteralOp(interface, path.size() - 1,
WrapStringLiteral::TranslateTrAction, WrapStringLiteral::TranslateTrAction,
description, literal)); description, literal);
return; return;
} }
} }
@@ -1352,17 +1352,17 @@ void TranslateStringLiteral::match(const CppQuickFixInterface &interface,
// ... or global if none available! // ... or global if none available!
if (trContext.isEmpty()) if (trContext.isEmpty())
trContext = QLatin1String("GLOBAL"); trContext = QLatin1String("GLOBAL");
result.append(new WrapStringLiteralOp(interface, path.size() - 1, result << new WrapStringLiteralOp(interface, path.size() - 1,
WrapStringLiteral::TranslateQCoreApplicationAction, WrapStringLiteral::TranslateQCoreApplicationAction,
description, literal, trContext)); description, literal, trContext);
return; return;
} }
} }
// We need to use Q_TRANSLATE_NOOP // We need to use Q_TRANSLATE_NOOP
result.append(new WrapStringLiteralOp(interface, path.size() - 1, result << new WrapStringLiteralOp(interface, path.size() - 1,
WrapStringLiteral::TranslateNoopAction, WrapStringLiteral::TranslateNoopAction,
description, literal, trContext)); description, literal, trContext);
} }
namespace { namespace {
@@ -1425,8 +1425,8 @@ void ConvertCStringToNSString::match(const CppQuickFixInterface &interface,
if (!isQtStringLiteral(enclosingFunction)) if (!isQtStringLiteral(enclosingFunction))
qlatin1Call = 0; qlatin1Call = 0;
result.append(new ConvertCStringToNSStringOp(interface, path.size() - 1, literal->asStringLiteral(), result << new ConvertCStringToNSStringOp(interface, path.size() - 1, literal->asStringLiteral(),
qlatin1Call)); qlatin1Call);
} }
namespace { namespace {
@@ -1513,7 +1513,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement); auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Hexadecimal")); op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Hexadecimal"));
op->setPriority(priority); op->setPriority(priority);
result.append(op); result << op;
} }
if (value != 0) { if (value != 0) {
@@ -1531,7 +1531,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement); auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Octal")); op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Octal"));
op->setPriority(priority); op->setPriority(priority);
result.append(op); result << op;
} }
} }
@@ -1550,7 +1550,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement); auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Decimal")); op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Decimal"));
op->setPriority(priority); op->setPriority(priority);
result.append(op); result << op;
} }
} }
} }
@@ -1644,7 +1644,7 @@ void AddLocalDeclaration::match(const CppQuickFixInterface &interface, QuickFixO
} }
if (!decl) { if (!decl) {
result.append(new AddLocalDeclarationOp(interface, index, binary, nameAST)); result << new AddLocalDeclarationOp(interface, index, binary, nameAST);
return; return;
} }
} }
@@ -1720,7 +1720,7 @@ void ConvertToCamelCase::match(const CppQuickFixInterface &interface, QuickFixOp
return; return;
for (int i = 1; i < newName.length() - 1; ++i) { for (int i = 1; i < newName.length() - 1; ++i) {
if (ConvertToCamelCaseOp::isConvertibleUnderscore(newName, i)) { if (ConvertToCamelCaseOp::isConvertibleUnderscore(newName, i)) {
result.append(new ConvertToCamelCaseOp(interface, path.size() - 1, newName)); result << new ConvertToCamelCaseOp(interface, path.size() - 1, newName);
return; return;
} }
} }
@@ -1957,8 +1957,8 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa
if (looksLikeAQtClass(include.mid(1, include.size() - 2))) if (looksLikeAQtClass(include.mid(1, include.size() - 2)))
qtHeaderFileIncludeOffered = true; qtHeaderFileIncludeOffered = true;
result.append(new AddIncludeForUndefinedIdentifierOp(interface, priority, result << new AddIncludeForUndefinedIdentifierOp(interface, priority,
include)); include);
} }
} }
} }
@@ -1970,7 +1970,7 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa
if (!qtHeaderFileIncludeOffered && looksLikeAQtClass(className)) { if (!qtHeaderFileIncludeOffered && looksLikeAQtClass(className)) {
const QString include = findQtIncludeWithSameName(className, headerPaths); const QString include = findQtIncludeWithSameName(className, headerPaths);
if (!include.isEmpty()) if (!include.isEmpty())
result.append(new AddIncludeForUndefinedIdentifierOp(interface, 1, include)); result << new AddIncludeForUndefinedIdentifierOp(interface, 1, include);
} }
} }
@@ -2050,11 +2050,11 @@ void RearrangeParamDeclarationList::match(const CppQuickFixInterface &interface,
return; return;
if (prevParamListNode) if (prevParamListNode)
result.append(new RearrangeParamDeclarationListOp(interface, paramListNode->value, result << new RearrangeParamDeclarationListOp(interface, paramListNode->value,
prevParamListNode->value, RearrangeParamDeclarationListOp::TargetPrevious)); prevParamListNode->value, RearrangeParamDeclarationListOp::TargetPrevious);
if (paramListNode->next) if (paramListNode->next)
result.append(new RearrangeParamDeclarationListOp(interface, paramListNode->value, result << new RearrangeParamDeclarationListOp(interface, paramListNode->value,
paramListNode->next->value, RearrangeParamDeclarationListOp::TargetNext)); paramListNode->next->value, RearrangeParamDeclarationListOp::TargetNext);
} }
namespace { namespace {
@@ -2172,14 +2172,14 @@ void ReformatPointerDeclaration::match(const CppQuickFixInterface &interface,
// any AST and therefore no quick fix will be triggered. // any AST and therefore no quick fix will be triggered.
change = formatter.format(file->cppDocument()->translationUnit()->ast()); change = formatter.format(file->cppDocument()->translationUnit()->ast());
if (!change.isEmpty()) if (!change.isEmpty())
result.append(new ReformatPointerDeclarationOp(interface, change)); result << new ReformatPointerDeclarationOp(interface, change);
} else { } else {
const QList<AST *> suitableASTs const QList<AST *> suitableASTs
= ReformatPointerDeclarationASTPathResultsFilter().filter(path); = ReformatPointerDeclarationASTPathResultsFilter().filter(path);
foreach (AST *ast, suitableASTs) { foreach (AST *ast, suitableASTs) {
change = formatter.format(ast); change = formatter.format(ast);
if (!change.isEmpty()) { if (!change.isEmpty()) {
result.append(new ReformatPointerDeclarationOp(interface, change)); result << new ReformatPointerDeclarationOp(interface, change);
return; return;
} }
} }
@@ -2349,8 +2349,8 @@ void CompleteSwitchCaseStatement::match(const CppQuickFixInterface &interface,
foreach (const QString &usedValue, usedValues) foreach (const QString &usedValue, usedValues)
values.removeAll(usedValue); values.removeAll(usedValue);
if (!values.isEmpty()) if (!values.isEmpty())
result.append(new CompleteSwitchCaseStatementOp(interface, depth, result << new CompleteSwitchCaseStatementOp(interface, depth,
compoundStatement, values)); compoundStatement, values);
return; return;
} }
@@ -2493,12 +2493,12 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
// Add several possible insertion locations for declaration // Add several possible insertion locations for declaration
DeclOperationFactory operation(interface, fileName, matchingClass, decl); DeclOperationFactory operation(interface, fileName, matchingClass, decl);
result.append(operation(InsertionPointLocator::Public, 5)); result << operation(InsertionPointLocator::Public, 5)
result.append(operation(InsertionPointLocator::PublicSlot, 4)); << operation(InsertionPointLocator::PublicSlot, 4)
result.append(operation(InsertionPointLocator::Protected, 3)); << operation(InsertionPointLocator::Protected, 3)
result.append(operation(InsertionPointLocator::ProtectedSlot, 2)); << operation(InsertionPointLocator::ProtectedSlot, 2)
result.append(operation(InsertionPointLocator::Private, 1)); << operation(InsertionPointLocator::Private, 1)
result.append(operation(InsertionPointLocator::PrivateSlot, 0)); << operation(InsertionPointLocator::PrivateSlot, 0);
} }
} }
@@ -2708,7 +2708,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
} }
if (op) if (op)
result.append(op); result << op;
break; break;
} }
} }
@@ -2718,10 +2718,10 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
// Insert Position: Outside Class // Insert Position: Outside Class
if (!isFreeFunction) { if (!isFreeFunction) {
result.append(new InsertDefOperation(interface, decl, declAST, result << new InsertDefOperation(interface, decl, declAST,
InsertionLocation(), InsertionLocation(),
DefPosOutsideClass, DefPosOutsideClass,
interface.fileName())); interface.fileName());
} }
// Insert Position: Inside Class // Insert Position: Inside Class
@@ -2732,9 +2732,9 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
const InsertionLocation loc const InsertionLocation loc
= InsertionLocation(interface.fileName(), QString(), QString(), = InsertionLocation(interface.fileName(), QString(), QString(),
line, column); line, column);
result.append(new InsertDefOperation(interface, decl, declAST, loc, result << new InsertDefOperation(interface, decl, declAST, loc,
DefPosInsideClass, QString(), DefPosInsideClass, QString(),
isFreeFunction)); isFreeFunction);
return; return;
} }
@@ -3137,12 +3137,12 @@ void GenerateGetterSetter::match(const CppQuickFixInterface &interface,
{ {
GenerateGetterSetterOperation *op = new GenerateGetterSetterOperation(interface); GenerateGetterSetterOperation *op = new GenerateGetterSetterOperation(interface);
if (op->m_type != GenerateGetterSetterOperation::InvalidType) { if (op->m_type != GenerateGetterSetterOperation::InvalidType) {
result.append(op); result << op;
if (op->m_type == GenerateGetterSetterOperation::GetterSetterType) { if (op->m_type == GenerateGetterSetterOperation::GetterSetterType) {
result.append(new GenerateGetterSetterOperation( result << new GenerateGetterSetterOperation(
interface, op, GenerateGetterSetterOperation::GetterType)); interface, op, GenerateGetterSetterOperation::GetterType);
result.append(new GenerateGetterSetterOperation( result << new GenerateGetterSetterOperation(
interface, op, GenerateGetterSetterOperation::SetterType)); interface, op, GenerateGetterSetterOperation::SetterType);
} }
} else { } else {
delete op; delete op;
@@ -3730,13 +3730,11 @@ void ExtractFunction::match(const CppQuickFixInterface &interface, QuickFixOpera
// The current implementation doesn't try to be too smart since it preserves the original form // The current implementation doesn't try to be too smart since it preserves the original form
// of the declarations. This might be or not the desired effect. An improvement would be to // of the declarations. This might be or not the desired effect. An improvement would be to
// let the user somehow customize the function interface. // let the user somehow customize the function interface.
result.append(new ExtractFunctionOperation(interface, result << new ExtractFunctionOperation(interface,
analyser.m_extractionStart, analyser.m_extractionStart,
analyser.m_extractionEnd, analyser.m_extractionEnd,
refFuncDef, refFuncDef, funcReturn, relevantDecls,
funcReturn, m_functionNameGetter);
relevantDecls,
m_functionNameGetter));
} }
namespace { namespace {
@@ -4055,7 +4053,7 @@ void ExtractLiteralAsParameter::match(const CppQuickFixInterface &interface,
} }
const int priority = path.size() - 1; const int priority = path.size() - 1;
result.append(new ExtractLiteralAsParameterOp(interface, priority, literal, function)); result << new ExtractLiteralAsParameterOp(interface, priority, literal, function);
} }
namespace { namespace {
@@ -4402,8 +4400,8 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface,
} }
const int priority = path.size() - 1; const int priority = path.size() - 1;
result.append(new ConvertFromAndToPointerOp(interface, priority, mode, isAutoDeclaration, result << new ConvertFromAndToPointerOp(interface, priority, mode, isAutoDeclaration,
simpleDeclaration, declarator, identifier, symbol)); simpleDeclaration, declarator, identifier, symbol);
} }
namespace { namespace {
@@ -4587,9 +4585,9 @@ void InsertQtPropertyMembers::match(const CppQuickFixInterface &interface,
if (getterName.isEmpty() && setterName.isEmpty() && signalName.isEmpty()) if (getterName.isEmpty() && setterName.isEmpty() && signalName.isEmpty())
return; return;
result.append(new InsertQtPropertyMembersOp(interface, path.size() - 1, qtPropertyDeclaration, c, result << new InsertQtPropertyMembersOp(interface, path.size() - 1, qtPropertyDeclaration, c,
generateFlags, getterName, setterName, generateFlags, getterName, setterName,
signalName, storageName)); signalName, storageName);
} }
namespace { namespace {
@@ -4628,7 +4626,7 @@ void ApplyDeclDefLinkChanges::match(const CppQuickFixInterface &interface,
auto op = new ApplyDeclDefLinkOperation(interface, link); auto op = new ApplyDeclDefLinkOperation(interface, link);
op->setDescription(FunctionDeclDefLink::tr("Apply Function Signature Changes")); op->setDescription(FunctionDeclDefLink::tr("Apply Function Signature Changes"));
result.append(op); result << op;
} }
namespace { namespace {
@@ -4827,12 +4825,12 @@ void MoveFuncDefOutside::match(const CppQuickFixInterface &interface, QuickFixOp
const MoveFuncDefRefactoringHelper::MoveType type = moveOutsideMemberDefinition const MoveFuncDefRefactoringHelper::MoveType type = moveOutsideMemberDefinition
? MoveFuncDefRefactoringHelper::MoveOutsideMemberToCppFile ? MoveFuncDefRefactoringHelper::MoveOutsideMemberToCppFile
: MoveFuncDefRefactoringHelper::MoveToCppFile; : MoveFuncDefRefactoringHelper::MoveToCppFile;
result.append(new MoveFuncDefOutsideOp(interface, type, funcAST, cppFileName)); result << new MoveFuncDefOutsideOp(interface, type, funcAST, cppFileName);
} }
if (classAST) if (classAST)
result.append(new MoveFuncDefOutsideOp(interface, MoveFuncDefRefactoringHelper::MoveOutside, result << new MoveFuncDefOutsideOp(interface, MoveFuncDefRefactoringHelper::MoveOutside,
funcAST, QLatin1String(""))); funcAST, QLatin1String(""));
return; return;
} }
@@ -4917,12 +4915,12 @@ void MoveAllFuncDefOutside::match(const CppQuickFixInterface &interface, QuickFi
bool isHeaderFile = false; bool isHeaderFile = false;
const QString cppFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile); const QString cppFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile);
if (isHeaderFile && !cppFileName.isEmpty()) { if (isHeaderFile && !cppFileName.isEmpty()) {
result.append(new MoveAllFuncDefOutsideOp(interface, result << new MoveAllFuncDefOutsideOp(interface,
MoveFuncDefRefactoringHelper::MoveToCppFile, MoveFuncDefRefactoringHelper::MoveToCppFile,
classAST, cppFileName)); classAST, cppFileName);
} }
result.append(new MoveAllFuncDefOutsideOp(interface, MoveFuncDefRefactoringHelper::MoveOutside, result << new MoveAllFuncDefOutsideOp(interface, MoveFuncDefRefactoringHelper::MoveOutside,
classAST, QLatin1String(""))); classAST, QLatin1String(""));
} }
namespace { namespace {
@@ -5105,11 +5103,11 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
} }
if (!declFileName.isEmpty() && !declText.isEmpty()) if (!declFileName.isEmpty() && !declText.isEmpty())
result.append(new MoveFuncDefToDeclOp(interface, result << new MoveFuncDefToDeclOp(interface,
interface.fileName(), interface.fileName(),
declFileName, declFileName,
funcAST, declText, funcAST, declText,
defRange, declRange)); defRange, declRange);
} }
namespace { namespace {
@@ -5312,7 +5310,7 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
const Name *name = nameAST->name; const Name *name = nameAST->name;
const int insertPos = interface.currentFile()->startOf(outerAST); const int insertPos = interface.currentFile()->startOf(outerAST);
result.append(new AssignToLocalVariableOperation(interface, insertPos, outerAST, name)); result << new AssignToLocalVariableOperation(interface, insertPos, outerAST, name);
return; return;
} }
} }
@@ -5493,9 +5491,9 @@ void OptimizeForLoop::match(const CppQuickFixInterface &interface, QuickFixOpera
} }
if (optimizePostcrement || optimizeCondition) { if (optimizePostcrement || optimizeCondition) {
result.append(new OptimizeForLoopOperation(interface, forAst, optimizePostcrement, result << new OptimizeForLoopOperation(interface, forAst, optimizePostcrement,
(optimizeCondition) ? conditionExpression : 0, (optimizeCondition) ? conditionExpression : 0,
conditionType)); conditionType);
} }
} }
@@ -5660,10 +5658,10 @@ void EscapeStringLiteral::match(const CppQuickFixInterface &interface, QuickFixO
} }
if (canEscape) if (canEscape)
result.append(new EscapeStringLiteralOperation(interface, literal, true)); result << new EscapeStringLiteralOperation(interface, literal, true);
if (canUnescape) if (canUnescape)
result.append(new EscapeStringLiteralOperation(interface, literal, false)); result << new EscapeStringLiteralOperation(interface, literal, false);
} }
@@ -5977,7 +5975,7 @@ void ConvertQt4Connect::match(const CppQuickFixInterface &interface, QuickFixOpe
changes.replace(file->endOf(arg3), file->endOf(arg3), receiverAccessFunc); changes.replace(file->endOf(arg3), file->endOf(arg3), receiverAccessFunc);
changes.replace(file->startOf(arg4), file->endOf(arg4), newMethod); changes.replace(file->startOf(arg4), file->endOf(arg4), newMethod);
result.append(new ConvertQt4ConnectOperation(interface, changes)); result << new ConvertQt4ConnectOperation(interface, changes);
return; return;
} }
} }

View File

@@ -30,6 +30,7 @@
#include "cpptools_global.h" #include "cpptools_global.h"
#include <texteditor/codeassist/assistinterface.h> #include <texteditor/codeassist/assistinterface.h>
#include <texteditor/quickfix.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <texteditor/textdocument.h> #include <texteditor/textdocument.h>
@@ -41,7 +42,6 @@
namespace TextEditor { namespace TextEditor {
class TextDocument; class TextDocument;
class QuickFixOperations;
} }
namespace CppTools { namespace CppTools {

View File

@@ -107,7 +107,11 @@ DebuggerKitChooser::DebuggerKitChooser(Mode mode, QWidget *parent)
{ {
setKitMatcher([this](const Kit *k) { setKitMatcher([this](const Kit *k) {
// Match valid debuggers and restrict local debugging to compatible toolchains. // Match valid debuggers and restrict local debugging to compatible toolchains.
if (DebuggerKitInformation::configurationErrors(k)) auto errors = DebuggerKitInformation::configurationErrors(k);
// we do not care for mismatched ABI if we want *any* debugging
if (m_mode == AnyDebugging && errors == DebuggerKitInformation::DebuggerDoesNotMatch)
errors = DebuggerKitInformation::NoConfigurationError;
if (errors)
return false; return false;
if (m_mode == LocalDebugging) if (m_mode == LocalDebugging)
return ToolChainKitInformation::targetAbi(k).os() == m_hostAbi.os(); return ToolChainKitInformation::targetAbi(k).os() == m_hostAbi.os();

View File

@@ -966,6 +966,8 @@ void GdbEngine::runCommand(const DebuggerCommand &command)
Q_ARG(QString, buffer)); Q_ARG(QString, buffer));
} else { } else {
write(cmd.function.toUtf8() + "\r\n"); write(cmd.function.toUtf8() + "\r\n");
if (command.flags & NeedsFlush)
write("p 0\r\n");
// Start Watchdog. // Start Watchdog.
if (m_commandTimer.interval() <= 20000) if (m_commandTimer.interval() <= 20000)
@@ -1103,6 +1105,8 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
// the exception now in a box. // the exception now in a box.
if (msg.startsWith("During startup program exited with")) if (msg.startsWith("During startup program exited with"))
notifyInferiorExited(); notifyInferiorExited();
else if (msg.contains("Command aborted."))
notifyInferiorSpontaneousStop();
QString logMsg; QString logMsg;
if (!m_lastWinException.isEmpty()) if (!m_lastWinException.isEmpty())
logMsg = m_lastWinException + '\n'; logMsg = m_lastWinException + '\n';
@@ -2009,7 +2013,7 @@ void GdbEngine::continueInferiorInternal()
cmd.callback = CB(handleExecuteContinue); cmd.callback = CB(handleExecuteContinue);
runCommand(cmd); runCommand(cmd);
} else { } else {
DebuggerCommand cmd("-exec-continue", RunRequest); DebuggerCommand cmd("-exec-continue", RunRequest|NeedsFlush);
cmd.callback = CB(handleExecuteContinue); cmd.callback = CB(handleExecuteContinue);
runCommand(cmd); runCommand(cmd);
} }
@@ -2034,7 +2038,7 @@ void GdbEngine::executeStep()
runCommand(cmd); runCommand(cmd);
} else { } else {
DebuggerCommand cmd; DebuggerCommand cmd;
cmd.flags = RunRequest; cmd.flags = RunRequest|NeedsFlush;
cmd.function = QLatin1String(isReverseDebugging() ? "reverse-step" : "-exec-step"); cmd.function = QLatin1String(isReverseDebugging() ? "reverse-step" : "-exec-step");
cmd.callback = CB(handleExecuteStep); cmd.callback = CB(handleExecuteStep);
runCommand(cmd); runCommand(cmd);
@@ -2084,7 +2088,7 @@ void GdbEngine::executeStepI()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
showStatusMessage(tr("Step by instruction requested..."), 5000); showStatusMessage(tr("Step by instruction requested..."), 5000);
DebuggerCommand cmd; DebuggerCommand cmd;
cmd.flags = RunRequest; cmd.flags = RunRequest|NeedsFlush;
cmd.function = QLatin1String(isReverseDebugging() ? "reverse-stepi" : "-exec-step-instruction"); cmd.function = QLatin1String(isReverseDebugging() ? "reverse-stepi" : "-exec-step-instruction");
cmd.callback = CB(handleExecuteContinue); cmd.callback = CB(handleExecuteContinue);
runCommand(cmd); runCommand(cmd);
@@ -2100,12 +2104,11 @@ void GdbEngine::executeStepOut()
if (isNativeMixedActiveFrame()) { if (isNativeMixedActiveFrame()) {
runCommand({"executeStepOut", RunRequest|PythonCommand}); runCommand({"executeStepOut", RunRequest|PythonCommand});
} else { } else {
runCommand({"-exec-finish", RunRequest, CB(handleExecuteContinue)});
// -exec-finish in 'main' results (correctly) in // -exec-finish in 'main' results (correctly) in
// 40^error,msg="\"finish\" not meaningful in the outermost frame." // 40^error,msg="\"finish\" not meaningful in the outermost frame."
// However, this message does not seem to get flushed before // However, this message does not seem to get flushed before
// anything else happen - i.e. "never". Force some extra output. // anything else happen - i.e. "never". Force some extra output.
runCommand({"print 32"}); runCommand({"-exec-finish", RunRequest|NeedsFlush, CB(handleExecuteContinue)});
} }
} }

View File

@@ -154,6 +154,8 @@ private: ////////// Gdb Command Management //////////
NeedsStop = 1, NeedsStop = 1,
// No need to wait for the reply before continuing inferior. // No need to wait for the reply before continuing inferior.
Discardable = 2, Discardable = 2,
// Needs a dummy extra command to force GDB output flushing.
NeedsFlush = 4,
// Callback expects ResultRunning instead of ResultDone. // Callback expects ResultRunning instead of ResultDone.
RunRequest = 16, RunRequest = 16,
// Callback expects ResultExit instead of ResultDone. // Callback expects ResultExit instead of ResultDone.

View File

@@ -2004,7 +2004,7 @@ void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters)
{ {
QStringList inames = updateParameters.partialVariables(); QStringList inames = updateParameters.partialVariables();
if (inames.isEmpty()) if (inames.isEmpty())
inames.append("local"); inames = QStringList({ "local", "return" });
auto marker = [](WatchItem *item) { item->outdated = true; }; auto marker = [](WatchItem *item) { item->outdated = true; };

View File

@@ -30,7 +30,6 @@
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <projectexplorer/nodesvisitor.h> #include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <resourceeditor/resourcenode.h> #include <resourceeditor/resourcenode.h>
@@ -88,12 +87,16 @@ void ResourceHandler::ensureInitialized()
return; return;
m_initialized = true; m_initialized = true;
ProjectTree *tree = ProjectTree::instance();
connect(tree, &ProjectTree::filesAdded, this, &ResourceHandler::updateResources); auto connector = [this](Project *p) {
connect(tree, &ProjectTree::filesRemoved, this, &ResourceHandler::updateResources); connect(p, &Project::fileListChanged, this, &ResourceHandler::updateResources);
connect(tree, &ProjectTree::foldersAdded, this, &ResourceHandler::updateResources); };
connect(tree, &ProjectTree::foldersRemoved, this, &ResourceHandler::updateResources);
foreach (Project *p, SessionManager::projects())
connector(p);
connect(SessionManager::instance(), &SessionManager::projectAdded, this, connector);
m_originalUiQrcPaths = m_form->activeResourceFilePaths(); m_originalUiQrcPaths = m_form->activeResourceFilePaths();
if (Designer::Constants::Internal::debug) if (Designer::Constants::Internal::debug)
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths; qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;

View File

@@ -106,10 +106,10 @@ public:
DiffCurrentFileController(IDocument *document, const QString &fileName); DiffCurrentFileController(IDocument *document, const QString &fileName);
protected: protected:
void reload(); void reload() override;
private: private:
QString m_fileName; const QString m_fileName;
}; };
DiffCurrentFileController::DiffCurrentFileController(IDocument *document, const QString &fileName) : DiffCurrentFileController::DiffCurrentFileController(IDocument *document, const QString &fileName) :
@@ -164,7 +164,7 @@ public:
DiffOpenFilesController(IDocument *document); DiffOpenFilesController(IDocument *document);
protected: protected:
void reload(); void reload() override;
}; };
DiffOpenFilesController::DiffOpenFilesController(IDocument *document) : DiffOpenFilesController::DiffOpenFilesController(IDocument *document) :
@@ -224,10 +224,10 @@ public:
DiffModifiedFilesController(IDocument *document, const QStringList &fileNames); DiffModifiedFilesController(IDocument *document, const QStringList &fileNames);
protected: protected:
void reload(); void reload() override;
private: private:
QStringList m_fileNames; const QStringList m_fileNames;
}; };
DiffModifiedFilesController::DiffModifiedFilesController(IDocument *document, const QStringList &fileNames) : DiffModifiedFilesController::DiffModifiedFilesController(IDocument *document, const QStringList &fileNames) :
@@ -286,11 +286,11 @@ public:
const QString &rightFileName); const QString &rightFileName);
protected: protected:
void reload(); void reload() override;
private: private:
QString m_leftFileName; const QString m_leftFileName;
QString m_rightFileName; const QString m_rightFileName;
}; };
DiffExternalFilesController::DiffExternalFilesController(IDocument *document, const QString &leftFileName, DiffExternalFilesController::DiffExternalFilesController(IDocument *document, const QString &leftFileName,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 117 B

View File

@@ -381,6 +381,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
environment.set(QLatin1String("QML_BAD_GUI_RENDER_LOOP"), QLatin1String("true")); environment.set(QLatin1String("QML_BAD_GUI_RENDER_LOOP"), QLatin1String("true"));
environment.set(QLatin1String("QML_USE_MOCKUPS"), QLatin1String("true")); environment.set(QLatin1String("QML_USE_MOCKUPS"), QLatin1String("true"));
environment.set(QLatin1String("QML_PUPPET_MODE"), QLatin1String("true")); environment.set(QLatin1String("QML_PUPPET_MODE"), QLatin1String("true"));
environment.set(QLatin1String("QML_DISABLE_DISK_CACHE"), QLatin1String("true"));
environment.set(QLatin1String("QT_AUTO_SCREEN_SCALE_FACTOR"), QLatin1String("1")); environment.set(QLatin1String("QT_AUTO_SCREEN_SCALE_FACTOR"), QLatin1String("1"));
#ifndef QMLDESIGNER_TEST #ifndef QMLDESIGNER_TEST

View File

@@ -246,13 +246,13 @@ void ComponentFromObjectDef::match(const QmlJSQuickFixInterface &interface, Quic
return; return;
// check that the node is not the root node // check that the node is not the root node
if (i > 0 && !cast<UiProgram*>(path.at(i - 1))) { if (i > 0 && !cast<UiProgram*>(path.at(i - 1))) {
result.append(new Operation(interface, objDef)); result << new Operation(interface, objDef);
return; return;
} }
} else if (UiObjectBinding *objBinding = cast<UiObjectBinding *>(node)) { } else if (UiObjectBinding *objBinding = cast<UiObjectBinding *>(node)) {
if (!interface->currentFile()->isCursorOn(objBinding->qualifiedTypeNameId)) if (!interface->currentFile()->isCursorOn(objBinding->qualifiedTypeNameId))
return; return;
result.append(new Operation(interface, objBinding)); result << new Operation(interface, objBinding);
return; return;
} }
} }

View File

@@ -77,7 +77,7 @@ class SplitInitializerOp: public QmlJSQuickFixFactory
} }
if (objectInitializer) if (objectInitializer)
result.append(new Operation(interface, objectInitializer)); result << new Operation(interface, objectInitializer);
} }
class Operation: public QmlJSQuickFixOperation class Operation: public QmlJSQuickFixOperation
@@ -135,7 +135,7 @@ public:
foreach (const StaticAnalysis::Message &message, messages) { foreach (const StaticAnalysis::Message &message, messages) {
if (interface->currentFile()->isCursorOn(message.location)) { if (interface->currentFile()->isCursorOn(message.location)) {
result.append(new Operation(interface, message)); result << new Operation(interface, message);
return; return;
} }
} }

View File

@@ -186,13 +186,13 @@ void WrapInLoader::match(const QmlJSQuickFixInterface &interface, QuickFixOperat
return; return;
// check that the node is not the root node // check that the node is not the root node
if (i > 0 && !cast<UiProgram*>(path.at(i - 1))) { if (i > 0 && !cast<UiProgram*>(path.at(i - 1))) {
result.append(new Operation<UiObjectDefinition>(interface, objDef)); result << new Operation<UiObjectDefinition>(interface, objDef);
return; return;
} }
} else if (UiObjectBinding *objBinding = cast<UiObjectBinding *>(node)) { } else if (UiObjectBinding *objBinding = cast<UiObjectBinding *>(node)) {
if (!interface->currentFile()->isCursorOn(objBinding->qualifiedTypeNameId)) if (!interface->currentFile()->isCursorOn(objBinding->qualifiedTypeNameId))
return; return;
result.append(new Operation<UiObjectBinding>(interface, objBinding)); result << new Operation<UiObjectBinding>(interface, objBinding);
return; return;
} }
} }

View File

@@ -177,7 +177,7 @@ public:
void setChangeNumber(int changeNumber); void setChangeNumber(int changeNumber);
protected: protected:
void reload(); void reload() override;
private slots: private slots:
void slotTextualDiffOutputReceived(const QString &contents); void slotTextualDiffOutputReceived(const QString &contents);

View File

@@ -85,12 +85,13 @@ private:
QString _description; QString _description;
}; };
class TEXTEDITOR_EXPORT QuickFixOperations : public QList<QuickFixOperation::Ptr> typedef QList<QuickFixOperation::Ptr> QuickFixOperations;
inline QuickFixOperations &operator<<(QuickFixOperations &list, QuickFixOperation *op)
{ {
public: list.append(QuickFixOperation::Ptr(op));
using QList<QuickFixOperation::Ptr>::append; return list;
void append(QuickFixOperation *op) { append(QuickFixOperation::Ptr(op)); } }
};
typedef QSharedPointer<const AssistInterface> QuickFixInterface; typedef QSharedPointer<const AssistInterface> QuickFixInterface;

View File

@@ -2485,15 +2485,17 @@
height="16" height="16"
id="rect7336" /> id="rect7336" />
<path <path
style="opacity:0.8;fill:#000000;fill-opacity:1" style="fill:#000000"
d="m 353,302 0,3 1,0 0,-2 10,0 0,11 -10,0 0,-2 -1,0 0,3 12,0 0,-13 z" d="m 354,303 10,0 0,11 -10,0 z m -1,12 12,0 0,-13 -12,0 z"
id="path7346" id="path7346"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
<path <path
id="path7338" id="path7338"
style="opacity:0.5;fill:#000000;fill-opacity:1" style="opacity:0.5;fill:#000000;fill-opacity:1"
d="m 353,310 0,1 3,0 0,-1 z m 0,-2 0,1 3,0 0,-1 z m 0,-2 0,1 3,0 0,-1 z" d="m 354,310 0,1 5,0 0,-1 z m 0,-2 0,1 5,0 0,-1 z m 0,-2 0,1 5,0 0,-1 z"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccc" />
</g> </g>
<g <g
transform="translate(710,268)" transform="translate(710,268)"

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 248 KiB

View File

@@ -3041,6 +3041,69 @@ void tst_Dumpers::dumper_data()
+ Check("ptr53", "", "@QWeakPointer<Foo>"); + Check("ptr53", "", "@QWeakPointer<Foo>");
QTest::newRow("QFiniteStack")
<< Data("#include <stdlib.h>\n" // Needed on macOS.
"#include <private/qfinitestack_p.h>\n" + fooData,
"QFiniteStack<int> s1;\n"
"s1.allocate(2);\n"
"s1.push(1);\n"
"s1.push(2);\n\n"
"QFiniteStack<int> s2;\n"
"s2.allocate(100000);\n"
"for (int i = 0; i != 10000; ++i)\n"
" s2.push(i);\n\n"
"QFiniteStack<Foo *> s3;\n"
"s3.allocate(10);\n"
"s3.push(new Foo(1));\n"
"s3.push(0);\n"
"s3.push(new Foo(2));\n"
"unused(&s3);\n\n"
"QFiniteStack<Foo> s4;\n"
"s4.allocate(10);\n"
"s4.push(1);\n"
"s4.push(2);\n"
"s4.push(3);\n"
"s4.push(4);\n\n"
"QFiniteStack<bool> s5;\n"
"s5.allocate(10);\n"
"s5.push(true);\n"
"s5.push(false);\n\n")
+ QmlPrivateProfile()
+ BigArrayProfile()
+ Check("s1", "<2 items>", "@QFiniteStack<int>")
+ Check("s1.0", "[0]", "1", "int")
+ Check("s1.1", "[1]", "2", "int")
+ Check("s2", "<10000 items>", "@QFiniteStack<int>")
+ Check("s2.0", "[0]", "0", "int")
+ Check("s2.8999", "[8999]", "8999", "int")
+ Check("s3", "<3 items>", "@QFiniteStack<Foo*>")
+ Check("s3.0", "[0]", "", "Foo")
+ Check("s3.0.a", "1", "int")
+ Check("s3.1", "[1]", "0x0", "Foo *")
+ Check("s3.2", "[2]", "", "Foo")
+ Check("s3.2.a", "2", "int")
+ Check("s4", "<4 items>", "@QFiniteStack<Foo>")
+ Check("s4.0", "[0]", "", "Foo")
+ Check("s4.0.a", "1", "int")
+ Check("s4.3", "[3]", "", "Foo")
+ Check("s4.3.a", "4", "int")
+ Check("s5", "<2 items>", "@QFiniteStack<bool>")
+ Check("s5.0", "[0]", "1", "bool") // 1 -> true is done on display
+ Check("s5.1", "[1]", "0", "bool");
/* /*
QTest::newRow("QStandardItemModel") QTest::newRow("QStandardItemModel")
<< Data("#include <QStandardItemModel>\n", << Data("#include <QStandardItemModel>\n",

View File

@@ -0,0 +1,32 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
namespace CppTools {
CompilerOptionsBuilder::PchUsage getPchUsage() { return CompilerOptionsBuilder::PchUsage::None; }
} // CppTools

View File

@@ -138,8 +138,10 @@ void ClangQueryCurrentFileFindFilter::SetUp()
projectPart = CppTools::ProjectPart::Ptr(new CppTools::ProjectPart); projectPart = CppTools::ProjectPart::Ptr(new CppTools::ProjectPart);
projectPart->files.push_back(projectFile); projectPart->files.push_back(projectFile);
commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(), commandLine = RefactoringCompilerOptionsBuilder::build(
projectFile.kind); projectPart.data(),
projectFile.kind,
RefactoringCompilerOptionsBuilder::PchUsage::None);
commandLine.push_back(curentDocumentFilePath); commandLine.push_back(curentDocumentFilePath);
findFilter.setCurrentDocumentFilePath(curentDocumentFilePath); findFilter.setCurrentDocumentFilePath(curentDocumentFilePath);

View File

@@ -185,7 +185,8 @@ void RefactoringClient::SetUp()
projectPart->files.push_back(projectFile); projectPart->files.push_back(projectFile);
commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(), commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(),
projectFile.kind); projectFile.kind,
RefactoringCompilerOptionsBuilder::PchUsage::None);
client.setSearchHandle(&mockSearchHandle); client.setSearchHandle(&mockSearchHandle);
} }

View File

@@ -129,7 +129,8 @@ void RefactoringEngine::SetUp()
projectPart->files.push_back(projectFile); projectPart->files.push_back(projectFile);
commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(), commandLine = RefactoringCompilerOptionsBuilder::build(projectPart.data(),
projectFile.kind); projectFile.kind,
RefactoringCompilerOptionsBuilder::PchUsage::None);
commandLine.push_back(qStringFilePath); commandLine.push_back(qStringFilePath);
} }

View File

@@ -72,6 +72,7 @@ SOURCES += \
diagnosticset-test.cpp \ diagnosticset-test.cpp \
diagnostic-test.cpp \ diagnostic-test.cpp \
fixit-test.cpp \ fixit-test.cpp \
gtest-qt-printing.cpp \
highlightingmarksreporter-test.cpp \ highlightingmarksreporter-test.cpp \
highlightingmarks-test.cpp \ highlightingmarks-test.cpp \
projectpart-test.cpp \ projectpart-test.cpp \