Commit fc49c03a authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/master' into 2.6

Final merge of master into 2.6.
parents 78aa94c8 b80205c5
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1
QTCREATOR_VERSION = 2.5.81
QTCREATOR_VERSION = 2.6.81
defineReplace(cleanPath) {
win32:1 ~= s|\\\\|/|g
......
......@@ -34,8 +34,10 @@ Project {
"src/plugins/bineditor/bineditor.qbs",
"src/plugins/bookmarks/bookmarks.qbs",
"src/plugins/classview/classview.qbs",
"src/plugins/clearcase/clearcase.qbs",
"src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs",
"src/plugins/coreplugin/coreplugin.qbs",
"src/plugins/coreplugin/images/logo/logo.qbs",
"src/plugins/cpaster/cpaster.qbs",
"src/plugins/cppeditor/cppeditor.qbs",
"src/plugins/cpptools/cpptools.qbs",
......@@ -72,6 +74,7 @@ Project {
"src/plugins/valgrind/valgrind.qbs",
"src/plugins/vcsbase/vcsbase.qbs",
"src/plugins/welcome/welcome.qbs",
"src/share/share.qbs",
"src/tools/qtcdebugger/qtcdebugger.qbs",
"src/tools/qtpromaker/qtpromaker.qbs"
]
......
......@@ -46239,7 +46239,7 @@ namespace {
}
 
#elif defined(BOTAN_TARGET_ARCH_IS_X86_64) && \
(defined(BOTAN_BUILD_COMPILER_IS_CLANG) || defined(BOTAN_BUILD_COMPILER_IS_GCC))
(defined(BOTAN_BUILD_COMPILER_IS_CLANG) || defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_INTEL))
 
/*
* We can't safely use this on x86-32 as some 32-bit ABIs use ebx as
......@@ -23,6 +23,7 @@ unix:DEFINES += BOTAN_TARGET_OS_HAS_GETTIMEOFDAY BOTAN_HAS_ALLOC_MMAP \
macx:DEFINES += BOTAN_TARGET_OS_IS_DARWIN
*g++*:DEFINES += BOTAN_BUILD_COMPILER_IS_GCC
*clang*:DEFINES += BOTAN_BUILD_COMPILER_IS_CLANG
*icc*:DEFINES += BOTAN_BUILD_COMPILER_IS_INTEL
win32 {
DEFINES += BOTAN_TARGET_OS_IS_WINDOWS \
......
......@@ -523,6 +523,8 @@ unsigned ClassSpecifierAST::firstToken() const
if (name)
if (unsigned candidate = name->firstToken())
return candidate;
if (final_token)
return final_token;
if (colon_token)
return colon_token;
if (base_clause_list)
......@@ -557,6 +559,8 @@ unsigned ClassSpecifierAST::lastToken() const
return candidate;
if (colon_token)
return colon_token + 1;
if (final_token)
return final_token + 1;
if (name)
if (unsigned candidate = name->lastToken())
return candidate;
......
......@@ -1168,6 +1168,7 @@ public:
unsigned classkey_token;
SpecifierListAST *attribute_list;
NameAST *name;
unsigned final_token;
unsigned colon_token;
BaseSpecifierListAST *base_clause_list;
unsigned dot_dot_dot_token;
......@@ -1183,6 +1184,7 @@ public:
: classkey_token(0)
, attribute_list(0)
, name(0)
, final_token(0)
, colon_token(0)
, base_clause_list(0)
, dot_dot_dot_token(0)
......
......@@ -362,6 +362,7 @@ ClassSpecifierAST *ClassSpecifierAST::clone(MemoryPool *pool) const
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
if (name)
ast->name = name->clone(pool);
ast->final_token = final_token;
ast->colon_token = colon_token;
for (BaseSpecifierListAST *iter = base_clause_list, **ast_iter = &ast->base_clause_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
......
......@@ -593,6 +593,8 @@ bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
else if (! AST::match(node->name, pattern->name, this))
return false;
pattern->final_token = node->final_token;
pattern->colon_token = node->colon_token;
if (! pattern->base_clause_list)
......
......@@ -2660,6 +2660,20 @@ bool Bind::visit(TemplateIdAST *ast)
bool Bind::visit(SimpleSpecifierAST *ast)
{
switch (tokenKind(ast->specifier_token)) {
case T_IDENTIFIER: {
const Identifier *id = tokenAt(ast->specifier_token).identifier;
if (id->isEqualTo(control()->cpp11Override())) {
if (_type.isOverride())
translationUnit()->error(ast->specifier_token, "duplicate `override'");
_type.setOverride(true);
}
else if (id->isEqualTo(control()->cpp11Final())) {
if (_type.isFinal())
translationUnit()->error(ast->specifier_token, "duplicate `final'");
_type.setFinal(true);
}
}
break;
case T_CONST:
if (_type.isConst())
translationUnit()->error(ast->specifier_token, "duplicate `%s'", spell(ast->specifier_token));
......@@ -3106,6 +3120,8 @@ bool Bind::visit(FunctionDeclaratorAST *ast)
// propagate the cv-qualifiers
fun->setConst(type.isConst());
fun->setVolatile(type.isVolatile());
fun->setOverride(type.isOverride());
fun->setFinal(type.isFinal());
this->exceptionSpecification(ast->exception_specification, type);
if (ast->as_cpp_initializer != 0) {
......
......@@ -496,6 +496,8 @@ public:
const Identifier *objcRetainId;
const Identifier *objcCopyId;
const Identifier *objcNonatomicId;
const Identifier *cpp11Override;
const Identifier *cpp11Final;
TopLevelDeclarationProcessor *processor;
};
......@@ -514,6 +516,9 @@ Control::Control()
d->objcRetainId = identifier("retain");
d->objcCopyId = identifier("copy");
d->objcNonatomicId = identifier("nonatomic");
d->cpp11Override = identifier("override");
d->cpp11Final = identifier("final");
}
Control::~Control()
......@@ -753,6 +758,12 @@ const Identifier *Control::objcCopyId() const
const Identifier *Control::objcNonatomicId() const
{ return d->objcNonatomicId; }
const Identifier *Control::cpp11Override() const
{ return d->cpp11Override; }
const Identifier *Control::cpp11Final() const
{ return d->cpp11Final; }
Symbol **Control::firstSymbol() const
{
if (d->symbols.empty())
......
......@@ -178,6 +178,9 @@ public:
const Identifier *objcRetainId() const;
const Identifier *objcCopyId() const;
const Identifier *objcNonatomicId() const;
// C++11 context keywords
const Identifier *cpp11Override() const;
const Identifier *cpp11Final() const;
const OperatorNameId *findOperatorNameId(OperatorNameId::Kind operatorId) const;
......
......@@ -55,6 +55,8 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const
ty.setInline(false);
ty.setVirtual(false);
ty.setOverride(false);
ty.setFinal(false);
ty.setExplicit(false);
ty.setDeprecated(false);
......@@ -140,6 +142,18 @@ bool FullySpecifiedType::isVirtual() const
void FullySpecifiedType::setVirtual(bool isVirtual)
{ f._isVirtual = isVirtual; }
bool FullySpecifiedType::isOverride() const
{ return f._isOverride; }
void FullySpecifiedType::setOverride(bool isOverride)
{ f._isOverride = isOverride; }
bool FullySpecifiedType::isFinal() const
{ return f._isFinal; }
void FullySpecifiedType::setFinal(bool isFinal)
{ f._isFinal = isFinal; }
bool FullySpecifiedType::isExplicit() const
{ return f._isExplicit; }
......@@ -226,6 +240,8 @@ void FullySpecifiedType::copySpecifiers(const FullySpecifiedType &type)
// function specifiers
f._isInline = type.f._isInline;
f._isVirtual = type.f._isVirtual;
f._isOverride = type.f._isOverride;
f._isFinal = type.f._isFinal;
f._isExplicit = type.f._isExplicit;
}
......@@ -235,4 +251,4 @@ bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, TypeMatcher *m
return false;
return type()->matchType(otherTy.type(), matcher);
}
\ No newline at end of file
}
......@@ -79,6 +79,12 @@ public:
bool isVirtual() const;
void setVirtual(bool isVirtual);
bool isOverride() const;
void setOverride(bool isOverride);
bool isFinal() const;
void setFinal(bool isFinal);
bool isExplicit() const;
void setExplicit(bool isExplicit);
......@@ -132,6 +138,8 @@ private:
// function specifiers
unsigned _isInline: 1;
unsigned _isVirtual: 1;
unsigned _isOverride: 1;
unsigned _isFinal: 1;
unsigned _isExplicit: 1;
// speficiers from attributes
......
......@@ -1176,6 +1176,40 @@ bool Parser::parseCvQualifiers(SpecifierListAST *&node)
return start != cursor();
}
/**
* \brief Handles override and final from C++ 2011, they are pseudo keywords and has special meaning only in function declaration
*/
bool Parser::parseOverrideFinalQualifiers(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
if (!_cxx0xEnabled)
return false;
unsigned start = cursor();
SpecifierListAST **ast = &node;
while (*ast)
ast = &(*ast)->next;
while (LA() == T_IDENTIFIER) {
const Identifier &id = *(_translationUnit->tokenAt(cursor()).identifier);
if (id.equalTo(_control->cpp11Override())
|| id.equalTo(_control->cpp11Final())) {
SimpleSpecifierAST *spec = new (_pool) SimpleSpecifierAST;
spec->specifier_token = consumeToken();
*ast = new (_pool) SpecifierListAST(spec);
ast = &(*ast)->next;
}
else {
break;
}
}
return (start != cursor());
}
bool Parser::parsePtrOperator(PtrOperatorListAST *&node)
{
DEBUG_THIS_RULE();
......@@ -1440,6 +1474,7 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
ast->rparen_token = consumeToken();
// ### parse attributes
parseCvQualifiers(ast->cv_qualifier_list);
parseOverrideFinalQualifiers(ast->cv_qualifier_list);
// ### parse ref-qualifiers
parseExceptionSpecification(ast->exception_specification);
......@@ -1570,11 +1605,26 @@ bool Parser::parseAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *dec
return true;
}
/**
* @brief Reads enumeration type declaration, examples:
* @code
enum {
debug = 1
};
enum class Format {
FormatPNG,
FormatJPEG
};
* @endcode
*/
bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_ENUM) {
unsigned enum_token = consumeToken();
if (_cxx0xEnabled && LA() == T_CLASS)
consumeToken();
NameAST *name = 0;
parseName(name);
if (LA() == T_LBRACE) {
......@@ -1872,9 +1922,12 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
}
if (LA(1) == T_IDENTIFIER && LA(2) == T_IDENTIFIER) {
warning(cursor(), "skip identifier `%s'",
tok().spell());
consumeToken();
const Identifier *id = tok(2).identifier;
if (!id->equalTo(_control->cpp11Final())) {
warning(cursor(), "skip identifier `%s'",
tok().spell());
consumeToken();
}
}
NameAST *name = 0;
......@@ -1887,6 +1940,13 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
unsigned colon_token = 0;
unsigned dot_dot_dot_token = 0;
unsigned final_token = 0;
if (LA() == T_IDENTIFIER) {
const Identifier *id = tok().identifier;
if (id->equalTo(_control->cpp11Final()))
final_token = consumeToken();
}
if (LA() == T_COLON || LA() == T_LBRACE) {
BaseSpecifierListAST *base_clause_list = 0;
......@@ -1917,6 +1977,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
ClassSpecifierAST *ast = new (_pool) ClassSpecifierAST;
ast->classkey_token = classkey_token;
ast->attribute_list = attributes;
ast->final_token = final_token;
ast->name = name;
ast->colon_token = colon_token;
ast->base_clause_list = base_clause_list;
......@@ -3780,8 +3841,11 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
} else if (! has_type_specifier && lookAtClassKey()) {
unsigned startOfTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr) ||
(LA() == T_COLON || LA() == T_LBRACE || (LA(0) == T_IDENTIFIER && LA(1) == T_IDENTIFIER &&
(LA(2) == T_COLON || LA(2) == T_LBRACE)))) {
(LA() == T_COLON || LA() == T_LBRACE
|| (LA(0) == T_IDENTIFIER && LA(1) == T_IDENTIFIER // MACRO Name followed by : or {
&& (LA(2) == T_COLON || LA(2) == T_LBRACE))
|| (LA(0) == T_IDENTIFIER && LA(1) == T_IDENTIFIER && LA(2) == T_IDENTIFIER && // MACRO Name final followed by : or {
(LA(3) == T_COLON || LA(3) == T_LBRACE)))) {
rewind(startOfTypeSpecifier);
if (! parseClassSpecifier(*decl_specifier_seq_ptr)) {
error(startOfTypeSpecifier,
......
......@@ -82,6 +82,7 @@ public:
bool parseConstantExpression(ExpressionAST *&node);
bool parseCtorInitializer(CtorInitializerAST *&node);
bool parseCvQualifiers(SpecifierListAST *&node);
bool parseOverrideFinalQualifiers(SpecifierListAST *&node);
bool parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list);
bool parseDeclaration(DeclarationAST *&node);
bool parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *declaringClass = 0);
......
......@@ -358,6 +358,18 @@ bool Function::isVirtual() const
void Function::setVirtual(bool isVirtual)
{ f._isVirtual = isVirtual; }
bool Function::isOverride() const
{ return f._isOverride; }
void Function::setOverride(bool isOverride)
{ f._isOverride = isOverride; }
bool Function::isFinal() const
{ return f._isFinal; }
void Function::setFinal(bool isFinal)
{ f._isFinal = isFinal; }
bool Function::isVariadic() const
{ return f._isVariadic; }
......
......@@ -323,6 +323,12 @@ public:
bool isVirtual() const;
void setVirtual(bool isVirtual);
bool isOverride() const;
void setOverride(bool isOverride);
bool isFinal() const;
void setFinal(bool isFinal);
bool isVariadic() const;
void setVariadic(bool isVariadic);
......@@ -371,6 +377,8 @@ private:
FullySpecifiedType _returnType;
struct Flags {
unsigned _isVirtual: 1;
unsigned _isOverride: 1;
unsigned _isFinal: 1;
unsigned _isVariadic: 1;
unsigned _isPureVirtual: 1;
unsigned _isConst: 1;
......
......@@ -134,6 +134,8 @@ private:
fun->setConst(funTy->isConst());
fun->setVolatile(funTy->isVolatile());
fun->setVirtual(funTy->isVirtual());
fun->setOverride(funTy->isOverride());
fun->setFinal(funTy->isFinal());
fun->setAmbiguous(funTy->isAmbiguous());
fun->setVariadic(funTy->isVariadic());
......
......@@ -2,7 +2,7 @@
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (c) 2012 Konstantin Tokarev <annulen@yandex.ru>
**
** Contact: http://www.qt-project.org/
**
......@@ -28,69 +28,96 @@
**
**************************************************************************/
#ifndef ANCHORTOOL_H
#define ANCHORTOOL_H
#include "bracematcher.h"
#include <QTimeLine>
#include <QTextDocument>
#include <QTextCursor>
#include "abstractformeditortool.h"
/*!
\class Utils::BraceMatcher
\brief Generic autocompleter of braces and quotes.
#include "anchorlineindicator.h"
#include "anchorindicator.h"
#include "anchormanipulator.h"
This is a helper class for autocompleter implementations. To use it,
define "brace", "quote", and "delimiter" characters for given language.
*/
namespace QmlDesigner {
namespace Utils {
class AnchorLineHandleItem;
class AnchorTool : public QObject, public AbstractFormEditorTool
/*!
* Adds a pair of characters, corresponding to opening and closing braces.
*/
void BraceMatcher::addBraceCharPair(const QChar opening, const QChar closing)
{
Q_OBJECT
public:
AnchorTool(FormEditorView* editorView);
~AnchorTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *keyEvent);
m_braceChars[opening] = closing;
}
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event);
void dragMoveEvent(QGraphicsSceneDragDropEvent * event);
/*!
* Adds quote character
*/
void BraceMatcher::addQuoteChar(const QChar quote)
{
m_quoteChars << quote;
}
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList);
/*!
* Adds separator character that should be skipped when overtyping it, e.g.
* it could be ';' or ',' in C-like languages.
*/
void BraceMatcher::addDelimiterChar(const QChar sep)
{
m_delimiterChars << sep;
}
void selectedItemsChanged(const QList<FormEditorItem*> &itemList);
bool BraceMatcher::shouldInsertMatchingText(const QTextCursor &tc) const
{
QTextDocument *doc = tc.document();
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
}
void clear();
bool BraceMatcher::shouldInsertMatchingText(const QChar lookAhead) const
{
return lookAhead.isSpace()
|| isQuote(lookAhead)
|| isDelimiter(lookAhead)
|| isClosingBrace(lookAhead);
}
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList);
QString BraceMatcher::insertMatchingBrace(const QTextCursor &cursor,
const QString &text,
const QChar la,
int *skippedChars) const
{
if (text.length() != 1)
return QString();
void instancesCompleted(const QList<FormEditorItem*> &itemList);
void instancesParentChanged(const QList<FormEditorItem *> &itemList);
if (!shouldInsertMatchingText(cursor))
return QString();
const QChar ch = text.at(0);
if (isQuote(ch)) {
if (la != ch)
return QString(ch);
++*skippedChars;
return QString();
}
static AnchorLineHandleItem* topAnchorLineHandleItem(const QList<QGraphicsItem*> & itemList);
if (isOpeningBrace(ch))
return QString(m_braceChars[ch]);
private slots:
void checkIfStillHovering();
if (isDelimiter(ch) || isClosingBrace(ch)) {
if (la == ch)
++*skippedChars;
}
private: //variables
AnchorLineIndicator m_anchorLineIndicator;
AnchorIndicator m_anchorIndicator;
AnchorManipulator m_anchorManipulator;
QTimeLine m_hoverTimeLine;
QPointF m_lastMousePosition;
AnchorLineHandleItem *m_lastAnchorLineHandleItem;
};
return QString();
}
/*!
* Returns true if given character was added as one of character types.
*/
bool BraceMatcher::isKnownChar(const QChar c) const
{
return isQuote(c) || isDelimiter(c) || isOpeningBrace(c) || isClosingBrace(c);
}
#endif // ANCHORTOOL_H
} // namespace Utils
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Konstantin Tokarev <annulen@yandex.ru>
**
** Contact: http://www.qt-project.org/
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage