Commit 48558716 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

Merge remote-tracking branch 'origin/2.8'

parents 938151a0 39379295
......@@ -8,7 +8,7 @@ you can check out from the public Git repository. For example:
git clone git://gitorious.org/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline v2.8.0..v2.8.1
There is a total of about 123 changes by 28 individual contributors.
There is a total of 132 changes by 28 individual contributors.
Credits for these changes go to:
......@@ -91,10 +91,14 @@ Analyzer
C++ Support
* Fixed crash in typedef resolving (QTCREATORBUG-9990)
* Fixed crash in type lookup (QTCREATORBUG-10019)
* Improved performance for generated symbols (QTCREATORBUG-9877)
* Added checking whether project has changed before reparsing
(QTCREATORBUG-9581)
QML Support
* Add vector*d, quaternion, and matrix4x4 types to code model
Python Support
Diff Viewer
......
......@@ -313,7 +313,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
ClassOrNamespace* enclosingTemplateInstantiation,
QSet<const Declaration *> typedefsBeingResolved) const
{
if (! scope) {
if (! scope || ! name) {
return 0;
} else if (Block *block = scope->asBlock()) {
for (unsigned i = 0; i < block->memberCount(); ++i) {
......
......@@ -24,11 +24,14 @@ SUBDIRS += \
utils/process_stub.pro \
qtcomponents/styleitem
exists(../shared/qbs/qbs.pro):SUBDIRS += \
QBS_DIRS = \
../shared/qbs/src/lib \
../shared/qbs/src/plugins \
../shared/qbs/static.pro
exists(../shared/qbs/qbs.pro): SUBDIRS += $$QBS_DIRS
TR_EXCLUDE = $$QBS_DIRS
win32:SUBDIRS += utils/process_ctrlc_stub.pro
# Windows: Compile Qt Creator CDB extension if Debugging tools can be detected.
......
......@@ -887,8 +887,16 @@ bool Check::visit(UiPublicMember *ast)
preferedType = QLatin1String("'rect'");
else if (init == _context->valueOwner()->qmlSizeObject())
preferedType = QLatin1String("'size'");
else if (init == _context->valueOwner()->qmlVector2DObject())
preferedType = QLatin1String("'vector2d'");
else if (init == _context->valueOwner()->qmlVector3DObject())
preferedType = QLatin1String("'vector3d'");
else if (init == _context->valueOwner()->qmlVector4DObject())
preferedType = QLatin1String("'vector4d'");
else if (init == _context->valueOwner()->qmlQuaternionObject())
preferedType = QLatin1String("'quaternion'");
else if (init == _context->valueOwner()->qmlMatrix4x4Object())
preferedType = QLatin1String("'matrix4x4'");
if (!preferedType.isEmpty())
addMessage(HintPreferNonVarPropertyType, ast->typeToken, preferedType);
......
......@@ -63,7 +63,11 @@ public:
validBuiltinPropertyNames.insert(QLatin1String("url"));
validBuiltinPropertyNames.insert(QLatin1String("var"));
validBuiltinPropertyNames.insert(QLatin1String("variant")); // obsolete in Qt 5
validBuiltinPropertyNames.insert(QLatin1String("vector2d"));
validBuiltinPropertyNames.insert(QLatin1String("vector3d"));
validBuiltinPropertyNames.insert(QLatin1String("vector4d"));
validBuiltinPropertyNames.insert(QLatin1String("quaternion"));
validBuiltinPropertyNames.insert(QLatin1String("matrix4x4"));
validBuiltinPropertyNames.insert(QLatin1String("alias"));
}
......
......@@ -100,7 +100,11 @@ public:
ObjectValue *_qmlPointObject;
ObjectValue *_qmlSizeObject;
ObjectValue *_qmlRectObject;
ObjectValue *_qmlVector2DObject;
ObjectValue *_qmlVector3DObject;
ObjectValue *_qmlVector4DObject;
ObjectValue *_qmlQuaternionObject;
ObjectValue *_qmlMatrix4x4Object;
NullValue _nullValue;
UndefinedValue _undefinedValue;
......@@ -505,11 +509,72 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
_qmlRectObject->setMember(QLatin1String("width"), numberValue());
_qmlRectObject->setMember(QLatin1String("height"), numberValue());
_qmlVector2DObject = newObject(/*prototype =*/ 0);
_qmlVector2DObject->setClassName(QLatin1String("Vector2D"));
_qmlVector2DObject->setMember(QLatin1String("x"), realValue());
_qmlVector2DObject->setMember(QLatin1String("y"), realValue());
addFunction(_qmlVector2DObject, QLatin1String("plus"), _qmlVector2DObject, 1);
addFunction(_qmlVector2DObject, QLatin1String("minus"), _qmlVector2DObject, 1);
addFunction(_qmlVector2DObject, QLatin1String("times"), _qmlVector2DObject, 1);
addFunction(_qmlVector2DObject, QLatin1String("dotProduct"), realValue(), 1);
addFunction(_qmlVector2DObject, QLatin1String("length"), realValue(), 1);
addFunction(_qmlVector2DObject, QLatin1String("normalized"), _qmlVector2DObject, 0);
addFunction(_qmlVector2DObject, QLatin1String("toVector3d"), _qmlVector3DObject, 0);
addFunction(_qmlVector2DObject, QLatin1String("toVector4d"), _qmlVector4DObject, 0);
addFunction(_qmlVector2DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
_qmlVector3DObject = newObject(/*prototype =*/ 0);
_qmlVector3DObject->setClassName(QLatin1String("Vector3D"));
_qmlVector3DObject->setMember(QLatin1String("x"), realValue());
_qmlVector3DObject->setMember(QLatin1String("y"), realValue());
_qmlVector3DObject->setMember(QLatin1String("z"), realValue());
addFunction(_qmlVector3DObject, QLatin1String("plus"), _qmlVector3DObject, 1);
addFunction(_qmlVector3DObject, QLatin1String("minus"), _qmlVector3DObject, 1);
addFunction(_qmlVector3DObject, QLatin1String("times"), _qmlVector3DObject, 1);
addFunction(_qmlVector3DObject, QLatin1String("dotProduct"), realValue(), 1);
addFunction(_qmlVector3DObject, QLatin1String("length"), realValue(), 1);
addFunction(_qmlVector3DObject, QLatin1String("normalized"), _qmlVector3DObject, 0);
addFunction(_qmlVector3DObject, QLatin1String("toVector2d"), _qmlVector2DObject, 0);
addFunction(_qmlVector3DObject, QLatin1String("toVector4d"), _qmlVector4DObject, 0);
addFunction(_qmlVector3DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
_qmlVector4DObject = newObject(/*prototype =*/ 0);
_qmlVector4DObject->setClassName(QLatin1String("Vector4D"));
_qmlVector4DObject->setMember(QLatin1String("x"), realValue());
_qmlVector4DObject->setMember(QLatin1String("y"), realValue());
_qmlVector4DObject->setMember(QLatin1String("z"), realValue());
_qmlVector4DObject->setMember(QLatin1String("w"), realValue());
addFunction(_qmlVector4DObject, QLatin1String("plus"), _qmlVector4DObject, 1);
addFunction(_qmlVector4DObject, QLatin1String("minus"), _qmlVector4DObject, 1);
addFunction(_qmlVector4DObject, QLatin1String("times"), _qmlVector4DObject, 1);
addFunction(_qmlVector4DObject, QLatin1String("dotProduct"), realValue(), 1);
addFunction(_qmlVector4DObject, QLatin1String("length"), realValue(), 1);
addFunction(_qmlVector4DObject, QLatin1String("normalized"), _qmlVector4DObject, 0);
addFunction(_qmlVector4DObject, QLatin1String("toVector2d"), _qmlVector2DObject, 0);
addFunction(_qmlVector4DObject, QLatin1String("toVector3d"), _qmlVector3DObject, 0);
addFunction(_qmlVector4DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
_qmlQuaternionObject = newObject(/*prototype =*/ 0);
_qmlQuaternionObject->setClassName(QLatin1String("Quaternion"));
_qmlQuaternionObject->setMember(QLatin1String("scalar"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("x"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("y"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("z"), realValue());
_qmlMatrix4x4Object = newObject(/*prototype =*/ 0);
_qmlMatrix4x4Object->setClassName(QLatin1String("Matrix4x4"));
for (int i = 1; i < 5; ++i)
for (int j = 1; j < 5; ++j)
_qmlMatrix4x4Object->setMember(QString::fromLatin1("m%1%2").arg(i).arg(j), realValue());
addFunction(_qmlMatrix4x4Object, QLatin1String("plus"), _qmlMatrix4x4Object, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("minus"), _qmlMatrix4x4Object, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("times"), _qmlMatrix4x4Object, 1); // could be matrix or vector
addFunction(_qmlMatrix4x4Object, QLatin1String("row"), _qmlVector4DObject, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("column"), _qmlMatrix4x4Object, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("determinant"), realValue(), 0);
addFunction(_qmlMatrix4x4Object, QLatin1String("inverted"), _qmlMatrix4x4Object, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("transposed"), _qmlMatrix4x4Object, 1);
addFunction(_qmlMatrix4x4Object, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
// global Qt object, in alphabetic order
_qtObject = newObject(new QtObjectPrototypeReference(this));
......@@ -535,7 +600,11 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
addFunction(_qtObject, QLatin1String("rgba"), &_colorValue, 4);
addFunction(_qtObject, QLatin1String("size"), _qmlSizeObject, 2);
addFunction(_qtObject, QLatin1String("tint"), &_colorValue, 2);
addFunction(_qtObject, QLatin1String("vector2d"), _qmlVector2DObject, 2);
addFunction(_qtObject, QLatin1String("vector3d"), _qmlVector3DObject, 3);
addFunction(_qtObject, QLatin1String("vector4d"), _qmlVector4DObject, 4);
addFunction(_qtObject, QLatin1String("quaternion"), _qmlQuaternionObject, 4);
addFunction(_qtObject, QLatin1String("matrix4x4"), _qmlMatrix4x4Object, 16);
_globalObject->setMember(QLatin1String("Qt"), _qtObject);
// firebug/webkit compat
......@@ -821,11 +890,31 @@ const ObjectValue *ValueOwner::qmlRectObject()
return _shared->_qmlRectObject;
}
const ObjectValue *ValueOwner::qmlVector2DObject()
{
return _shared->_qmlVector2DObject;
}
const ObjectValue *ValueOwner::qmlVector3DObject()
{
return _shared->_qmlVector3DObject;
}
const ObjectValue *ValueOwner::qmlVector4DObject()
{
return _shared->_qmlVector4DObject;
}
const ObjectValue *ValueOwner::qmlQuaternionObject()
{
return _shared->_qmlQuaternionObject;
}
const ObjectValue *ValueOwner::qmlMatrix4x4Object()
{
return _shared->_qmlMatrix4x4Object;
}
const Value *ValueOwner::defaultValueForBuiltinType(const QString &name) const
{
// this list is defined in ProcessAST::visit(UiPublicMember) in qdeclarativescript.cpp
......
......@@ -91,7 +91,11 @@ public:
const ObjectValue *qmlPointObject();
const ObjectValue *qmlSizeObject();
const ObjectValue *qmlRectObject();
const ObjectValue *qmlVector2DObject();
const ObjectValue *qmlVector3DObject();
const ObjectValue *qmlVector4DObject();
const ObjectValue *qmlQuaternionObject();
const ObjectValue *qmlMatrix4x4Object();
// converts builtin types, such as int, string to a Value
const Value *defaultValueForBuiltinType(const QString &typeName) const;
......
......@@ -251,8 +251,12 @@ bool Highlighter::maybeQmlBuiltinType(const QStringRef &text) const
return true;
else if (ch == QLatin1Char('l') && text == QLatin1String("list"))
return true;
else if (ch == QLatin1Char('m') && text == QLatin1String("matrix4x4"))
return true;
else if (ch == QLatin1Char('p') && text == QLatin1String("point"))
return true;
else if (ch == QLatin1Char('q') && text == QLatin1String("quaternion"))
return true;
else if (ch == QLatin1Char('r') && text == QLatin1String("real"))
return true;
else if (ch == QLatin1Char('r') && text == QLatin1String("rect"))
......@@ -269,8 +273,12 @@ bool Highlighter::maybeQmlBuiltinType(const QStringRef &text) const
return true;
else if (ch == QLatin1Char('v') && text == QLatin1String("var"))
return true;
else if (ch == QLatin1Char('v') && text == QLatin1String("vector2d"))
return true;
else if (ch == QLatin1Char('v') && text == QLatin1String("vector3d"))
return true;
else if (ch == QLatin1Char('v') && text == QLatin1String("vector4d"))
return true;
else
return false;
}
......
......@@ -1265,6 +1265,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
QString parseInto;
LoadFlags flags = 0;
if (m_cumulative)
flags = LoadSilent;
if (args.count() >= 2) {
parseInto = args.at(1).toQString(m_tmp2);
if (args.count() >= 3 && isTrue(args.at(2), m_tmp3))
......
......@@ -265,6 +265,8 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil
ushort unicode = vals_data[x].unicode();
if (unicode == quote) {
quote = 0;
hadWord = true;
build += QChar(unicode);
continue;
}
switch (unicode) {
......@@ -272,7 +274,7 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil
case '\'':
quote = unicode;
hadWord = true;
continue;
break;
case ' ':
case '\t':
if (!quote) {
......@@ -283,22 +285,23 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil
}
continue;
}
build += QChar(unicode);
break;
case '\\':
if (x + 1 != vals_len) {
ushort next = vals_data[++x].unicode();
if (next == '\'' || next == '"' || next == '\\')
if (next == '\'' || next == '"' || next == '\\') {
build += QChar(unicode);
unicode = next;
else
} else {
--x;
}
}
// fallthrough
default:
hadWord = true;
build += QChar(unicode);
break;
}
build += QChar(unicode);
}
if (hadWord)
ret << ProString(build).setSource(source);
......@@ -572,13 +575,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
okey = true, or_op = false; // force next evaluation
break;
case TokForLoop:
if (m_cumulative) { // This is a no-win situation, so just pretend it's no loop
skipHashStr(tokPtr);
uint exprLen = getBlockLen(tokPtr);
tokPtr += exprLen;
blockLen = getBlockLen(tokPtr);
ret = visitProBlock(tokPtr);
} else if (okey != or_op) {
if (m_cumulative || okey != or_op) {
const ProKey &variable = getHashStr(tokPtr);
uint exprLen = getBlockLen(tokPtr);
const ushort *exprPtr = tokPtr;
......@@ -748,6 +745,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
ProStringList list = values(it_list.toKey());
if (list.isEmpty()) {
if (it_list == statics.strforever) {
if (m_cumulative) {
// The termination conditions wouldn't be evaluated, so we must skip it.
traceMsg("skipping forever loop in cumulative mode");
return ReturnFalse;
}
infinite = true;
} else {
const QString &itl = it_list.toQString(m_tmp1);
......@@ -758,6 +760,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
if (ok) {
int end = itl.mid(dotdot+2).toInt(&ok);
if (ok) {
if (m_cumulative && qAbs(end - start) > 100) {
// Such a loop is unlikely to contribute something useful to the
// file collection, and may cause considerable delay.
traceMsg("skipping excessive loop in cumulative mode");
return ReturnFalse;
}
if (start < end) {
for (int i = start; i <= end; i++)
list << ProString(QString::number(i));
......@@ -1804,7 +1812,10 @@ ProString QMakeEvaluator::first(const ProKey &variableName) const
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
{
if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
QMakeParser::ParseFlags pflags = QMakeParser::ParseUseCache;
if (!(flags & LoadSilent))
pflags |= QMakeParser::ParseReportMissing;
if (ProFile *pro = m_parser->parsedProFile(fileName, pflags)) {
m_locationStack.push(m_current);
VisitReturn ok = visitProFile(pro, type, flags);
m_current = m_locationStack.pop();
......@@ -1819,8 +1830,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
#endif
return ok;
} else {
if (!(flags & LoadSilent) && !m_vfs->exists(fileName))
evalError(fL1S("WARNING: Include file %1 not found").arg(fileName));
return ReturnFalse;
}
}
......
......@@ -237,7 +237,8 @@ void QMakeGlobals::setDirectories(const QString &input_dir, const QString &outpu
int srcLen = srcpath.length();
int dstLen = dstpath.length();
int lastSl = -1;
while (++lastSl, srcpath.at(--srcLen) == dstpath.at(--dstLen))
while (++lastSl, --srcLen, --dstLen,
srcLen && dstLen && srcpath.at(srcLen) == dstpath.at(dstLen))
if (srcpath.at(srcLen) == QLatin1Char('/'))
lastSl = 0;
source_root = srcpath.left(srcLen + lastSl);
......
......@@ -140,10 +140,10 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler
initialize();
}
ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
{
ProFile *pro;
if (cache && m_cache) {
if ((flags & ParseUseCache) && m_cache) {
ProFileCache::Entry *ent;
#ifdef PROPARSER_THREAD_SAFE
QMutexLocker locker(&m_cache->mutex);
......@@ -172,7 +172,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
locker.unlock();
#endif
pro = new ProFile(fileName);
if (!read(pro)) {
if (!read(pro, flags)) {
delete pro;
pro = 0;
} else {
......@@ -193,7 +193,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
}
} else {
pro = new ProFile(fileName);
if (!read(pro)) {
if (!read(pro, flags)) {
delete pro;
pro = 0;
}
......@@ -218,12 +218,12 @@ void QMakeParser::discardFileFromCache(const QString &fileName)
m_cache->discardFile(fileName);
}
bool QMakeParser::read(ProFile *pro)
bool QMakeParser::read(ProFile *pro, ParseFlags flags)
{
QString content;
QString errStr;
if (!m_vfs->readFile(pro->fileName(), &content, &errStr)) {
if (m_handler && m_vfs->exists(pro->fileName()))
if (m_handler && ((flags & ParseReportMissing) || m_vfs->exists(pro->fileName())))
m_handler->message(QMakeParserHandler::ParserIoError,
fL1S("Cannot read %1: %2").arg(pro->fileName(), errStr));
return false;
......
......@@ -75,11 +75,18 @@ public:
// Call this from a concurrency-free context
static void initialize();
enum ParseFlag {
ParseDefault = 0,
ParseUseCache = 1,
ParseReportMissing = 2
};
Q_DECLARE_FLAGS(ParseFlags, ParseFlag)
QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler *handler);
enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar };
// fileName is expected to be absolute and cleanPath()ed.
ProFile *parsedProFile(const QString &fileName, bool cache = false);
ProFile *parsedProFile(const QString &fileName, ParseFlags flags = ParseDefault);
ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0,
SubGrammar grammar = FullGrammar);
......@@ -118,7 +125,7 @@ private:
ushort terminator; // '}' if replace function call is braced, ':' if test function
};
bool read(ProFile *pro);
bool read(ProFile *pro, ParseFlags flags);
bool read(ProFile *pro, const QString &content, int line, SubGrammar grammar);
ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok);
......@@ -172,6 +179,8 @@ private:
friend class ProFileCache;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeParser::ParseFlags)
class QMAKE_EXPORT ProFileCache
{
public:
......
......@@ -60,7 +60,7 @@ def checkQtCreatorHelpVersion(expectedVersion):
creatorManual = waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' "
"text?='Qt Creator Manual*' type='QModelIndex'}", 5000)
test.compare(str(creatorManual.text)[18:], expectedVersion,
"Verifying whether manual uses expected version.")
"Verifying whether manual uses expected version, text is: %s" % creatorManual.text)
except LookupError:
test.fail("Missing Qt Creator Manual.")
......
......@@ -77,14 +77,11 @@ def main():
clickButton(waitForObject(":CodePaster__Internal__PasteSelectDialog.OK_QPushButton"))
filenameCombo = waitForObject(":Qt Creator_FilenameQComboBox")
waitFor("not filenameCombo.currentText.isEmpty()", 20000)
if protocol == "Pastebin.Com" and JIRA.isBugStillOpen(9997, JIRA.Bug.CREATOR):
if protocol == "Pastebin.Com":
protocol = "Pastebin.com"
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
if protocol == "Paste.KDE.Org" and JIRA.isBugStillOpen(9995, JIRA.Bug.CREATOR):
test.xcompare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
else:
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
invokeMenuItem("File", "Close All")
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(sourceFile)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment