aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/3rdparty/botan/botan.qbs3
-rw-r--r--src/libs/3rdparty/cplusplus/AST.cpp170
-rw-r--r--src/libs/3rdparty/cplusplus/AST.h139
-rw-r--r--src/libs/3rdparty/cplusplus/ASTClone.cpp67
-rw-r--r--src/libs/3rdparty/cplusplus/ASTMatch0.cpp24
-rw-r--r--src/libs/3rdparty/cplusplus/ASTMatcher.cpp107
-rw-r--r--src/libs/3rdparty/cplusplus/ASTMatcher.h5
-rw-r--r--src/libs/3rdparty/cplusplus/ASTPatternBuilder.h45
-rw-r--r--src/libs/3rdparty/cplusplus/ASTVisit.cpp34
-rw-r--r--src/libs/3rdparty/cplusplus/ASTVisitor.h10
-rw-r--r--src/libs/3rdparty/cplusplus/ASTfwd.h5
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp55
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.h6
-rw-r--r--src/libs/3rdparty/cplusplus/Keywords.cpp20
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.cpp298
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.h10
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.cpp37
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.h4
-rw-r--r--src/libs/3rdparty/cplusplus/Token.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/Token.h4
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.cpp28
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.h2
-rw-r--r--src/libs/QtcLibrary.qbs14
-rw-r--r--src/libs/aggregation/aggregation.qbs9
-rw-r--r--src/libs/cplusplus/Dumpers.cpp2
-rw-r--r--src/libs/cplusplus/FindUsages.cpp49
-rw-r--r--src/libs/cplusplus/FindUsages.h6
-rw-r--r--src/libs/cplusplus/OverviewModel.cpp3
-rw-r--r--src/libs/cplusplus/cplusplus.qbs78
-rw-r--r--src/libs/extensionsystem/extensionsystem.qbs14
-rw-r--r--src/libs/extensionsystem/optionsparser.cpp2
-rw-r--r--src/libs/glsl/glsl.qbs47
-rw-r--r--src/libs/languageutils/languageutils.qbs12
-rw-r--r--src/libs/qmldebug/qmldebug.qbs18
-rw-r--r--src/libs/qmleditorwidgets/colorbox.h2
-rw-r--r--src/libs/qmleditorwidgets/colorbutton.h2
-rw-r--r--src/libs/qmleditorwidgets/colorwidgets.h2
-rw-r--r--src/libs/qmleditorwidgets/contextpanetextwidget.h2
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidget.cpp46
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidget.h12
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetimage.cpp15
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetimage.h10
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetrectangle.h2
-rw-r--r--src/libs/qmleditorwidgets/customcolordialog.cpp26
-rw-r--r--src/libs/qmleditorwidgets/customcolordialog.h2
-rw-r--r--src/libs/qmleditorwidgets/filewidget.h2
-rw-r--r--src/libs/qmleditorwidgets/fontsizespinbox.h2
-rw-r--r--src/libs/qmleditorwidgets/gradientline.h2
-rw-r--r--src/libs/qmleditorwidgets/huecontrol.h2
-rw-r--r--src/libs/qmleditorwidgets/qmleditorwidgets.pro1
-rw-r--r--src/libs/qmleditorwidgets/qmleditorwidgets.qbs68
-rwxr-xr-xsrc/libs/qmljs/parser/gen-parser.sh10
-rw-r--r--src/libs/qmljs/qmljs.qbs18
-rw-r--r--src/libs/qmljs/qmljscheck.cpp138
-rw-r--r--src/libs/qmljs/qmljscheck.h1
-rw-r--r--src/libs/qmljs/qmljsinterpreter.cpp12
-rw-r--r--src/libs/qmljs/qmljsstaticanalysismessage.cpp11
-rw-r--r--src/libs/qmljs/qmljsstaticanalysismessage.h5
-rw-r--r--src/libs/qtcomponents/styleitem/styleitem.qbs5
-rw-r--r--src/libs/ssh/sftpchannel_p.h11
-rw-r--r--src/libs/ssh/ssh.pro7
-rw-r--r--src/libs/ssh/ssh.qbs27
-rw-r--r--src/libs/ssh/sshchannel.cpp33
-rw-r--r--src/libs/ssh/sshchannel_p.h20
-rw-r--r--src/libs/ssh/sshchannelmanager.cpp11
-rw-r--r--src/libs/ssh/sshchannelmanager_p.h7
-rw-r--r--src/libs/ssh/sshconnection.cpp21
-rw-r--r--src/libs/ssh/sshconnection.h12
-rw-r--r--src/libs/ssh/sshconnection_p.h5
-rw-r--r--src/libs/ssh/sshdirecttcpiptunnel.cpp194
-rw-r--r--src/libs/ssh/sshdirecttcpiptunnel.h90
-rw-r--r--src/libs/ssh/sshdirecttcpiptunnel_p.h84
-rw-r--r--src/libs/ssh/sshkeygenerator.cpp2
-rw-r--r--src/libs/ssh/sshoutgoingpacket.cpp11
-rw-r--r--src/libs/ssh/sshoutgoingpacket_p.h3
-rw-r--r--src/libs/ssh/sshremoteprocess.cpp3
-rw-r--r--src/libs/ssh/sshremoteprocess_p.h13
-rw-r--r--src/libs/ssh/sshsendfacility.cpp9
-rw-r--r--src/libs/ssh/sshsendfacility_p.h3
-rw-r--r--src/libs/utils/buildablehelperlibrary.cpp12
-rw-r--r--src/libs/utils/consoleprocess.cpp2
-rw-r--r--src/libs/utils/consoleprocess_unix.cpp28
-rw-r--r--src/libs/utils/crumblepath.cpp3
-rw-r--r--src/libs/utils/detailsbutton.cpp12
-rw-r--r--src/libs/utils/detailswidget.cpp23
-rw-r--r--src/libs/utils/environment.cpp245
-rw-r--r--src/libs/utils/environment.h2
-rw-r--r--src/libs/utils/environmentmodel.cpp8
-rw-r--r--src/libs/utils/fancymainwindow.cpp4
-rw-r--r--src/libs/utils/fileutils.cpp107
-rw-r--r--src/libs/utils/fileutils.h91
-rw-r--r--src/libs/utils/filewizarddialog.cpp20
-rw-r--r--src/libs/utils/filewizardpage.ui2
-rw-r--r--src/libs/utils/historycompleter.cpp3
-rw-r--r--src/libs/utils/hostosinfo.h108
-rw-r--r--src/libs/utils/networkaccessmanager.cpp8
-rw-r--r--src/libs/utils/pathlisteditor.cpp19
-rw-r--r--src/libs/utils/pathlisteditor.h2
-rw-r--r--src/libs/utils/persistentsettings.cpp7
-rw-r--r--src/libs/utils/portlist.cpp2
-rw-r--r--src/libs/utils/qtcprocess.cpp2
-rw-r--r--src/libs/utils/savefile.cpp3
-rw-r--r--src/libs/utils/stringutils.cpp13
-rw-r--r--src/libs/utils/stylehelper.cpp8
-rw-r--r--src/libs/utils/synchronousprocess.cpp38
-rw-r--r--src/libs/utils/synchronousprocess.h1
-rw-r--r--src/libs/utils/utils-lib.pri7
-rw-r--r--src/libs/utils/utils.pro6
-rw-r--r--src/libs/utils/utils.qbs69
-rw-r--r--src/libs/zeroconf/embeddedLib.cpp2
-rw-r--r--src/libs/zeroconf/zeroconf.qbs21
111 files changed, 2001 insertions, 1170 deletions
diff --git a/src/libs/3rdparty/botan/botan.qbs b/src/libs/3rdparty/botan/botan.qbs
index ee8afc1d033..3743e8d27ab 100644
--- a/src/libs/3rdparty/botan/botan.qbs
+++ b/src/libs/3rdparty/botan/botan.qbs
@@ -7,7 +7,6 @@ QtcLibrary {
Depends { name: "cpp" }
Depends { name: "Qt.core" }
- cpp.includePaths: '.'
cpp.dynamicLibraries: {
if (qbs.targetOS == "windows") {
return [
@@ -65,6 +64,6 @@ QtcLibrary {
return ["-Wl,--enable-auto-import"]
}
}
- cpp.includePaths: '..'
+ cpp.includePaths: ".."
}
}
diff --git a/src/libs/3rdparty/cplusplus/AST.cpp b/src/libs/3rdparty/cplusplus/AST.cpp
index 94cdbc9611a..fd8b4fcfedd 100644
--- a/src/libs/3rdparty/cplusplus/AST.cpp
+++ b/src/libs/3rdparty/cplusplus/AST.cpp
@@ -1077,9 +1077,16 @@ unsigned EnumSpecifierAST::firstToken() const
{
if (enum_token)
return enum_token;
+ if (key_token)
+ return key_token;
if (name)
if (unsigned candidate = name->firstToken())
return candidate;
+ if (colon_token)
+ return colon_token;
+ if (type_specifier_list)
+ if (unsigned candidate = type_specifier_list->firstToken())
+ return candidate;
if (lbrace_token)
return lbrace_token;
if (enumerator_list)
@@ -1104,9 +1111,16 @@ unsigned EnumSpecifierAST::lastToken() const
return candidate;
if (lbrace_token)
return lbrace_token + 1;
+ if (type_specifier_list)
+ if (unsigned candidate = type_specifier_list->lastToken())
+ return candidate;
+ if (colon_token)
+ return colon_token + 1;
if (name)
if (unsigned candidate = name->lastToken())
return candidate;
+ if (key_token)
+ return key_token + 1;
if (enum_token)
return enum_token + 1;
return 1;
@@ -1369,6 +1383,8 @@ unsigned FunctionDeclaratorAST::firstToken() const
if (cv_qualifier_list)
if (unsigned candidate = cv_qualifier_list->firstToken())
return candidate;
+ if (ref_qualifier_token)
+ return ref_qualifier_token;
if (exception_specification)
if (unsigned candidate = exception_specification->firstToken())
return candidate;
@@ -1393,6 +1409,8 @@ unsigned FunctionDeclaratorAST::lastToken() const
if (exception_specification)
if (unsigned candidate = exception_specification->lastToken())
return candidate;
+ if (ref_qualifier_token)
+ return ref_qualifier_token + 1;
if (cv_qualifier_list)
if (unsigned candidate = cv_qualifier_list->lastToken())
return candidate;
@@ -1744,26 +1762,18 @@ unsigned MemInitializerAST::firstToken() const
if (name)
if (unsigned candidate = name->firstToken())
return candidate;
- if (lparen_token)
- return lparen_token;
- if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (expression)
+ if (unsigned candidate = expression->firstToken())
return candidate;
- if (rparen_token)
- return rparen_token;
return 0;
}
/** \generated */
unsigned MemInitializerAST::lastToken() const
{
- if (rparen_token)
- return rparen_token + 1;
- if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (expression)
+ if (unsigned candidate = expression->lastToken())
return candidate;
- if (lparen_token)
- return lparen_token + 1;
if (name)
if (unsigned candidate = name->lastToken())
return candidate;
@@ -2043,33 +2053,7 @@ unsigned NewExpressionAST::lastToken() const
}
/** \generated */
-unsigned NewInitializerAST::firstToken() const
-{
- if (lparen_token)
- return lparen_token;
- if (expression)
- if (unsigned candidate = expression->firstToken())
- return candidate;
- if (rparen_token)
- return rparen_token;
- return 0;
-}
-
-/** \generated */
-unsigned NewInitializerAST::lastToken() const
-{
- if (rparen_token)
- return rparen_token + 1;
- if (expression)
- if (unsigned candidate = expression->lastToken())
- return candidate;
- if (lparen_token)
- return lparen_token + 1;
- return 1;
-}
-
-/** \generated */
-unsigned NewPlacementAST::firstToken() const
+unsigned ExpressionListParenAST::firstToken() const
{
if (lparen_token)
return lparen_token;
@@ -2082,7 +2066,7 @@ unsigned NewPlacementAST::firstToken() const
}
/** \generated */
-unsigned NewPlacementAST::lastToken() const
+unsigned ExpressionListParenAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
@@ -3075,12 +3059,16 @@ unsigned PointerToMemberAST::firstToken() const
if (cv_qualifier_list)
if (unsigned candidate = cv_qualifier_list->firstToken())
return candidate;
+ if (ref_qualifier_token)
+ return ref_qualifier_token;
return 0;
}
/** \generated */
unsigned PointerToMemberAST::lastToken() const
{
+ if (ref_qualifier_token)
+ return ref_qualifier_token + 1;
if (cv_qualifier_list)
if (unsigned candidate = cv_qualifier_list->lastToken())
return candidate;
@@ -3910,26 +3898,18 @@ unsigned TypeConstructorCallAST::firstToken() const
if (type_specifier_list)
if (unsigned candidate = type_specifier_list->firstToken())
return candidate;
- if (lparen_token)
- return lparen_token;
- if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (expression)
+ if (unsigned candidate = expression->firstToken())
return candidate;
- if (rparen_token)
- return rparen_token;
return 0;
}
/** \generated */
unsigned TypeConstructorCallAST::lastToken() const
{
- if (rparen_token)
- return rparen_token + 1;
- if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (expression)
+ if (unsigned candidate = expression->lastToken())
return candidate;
- if (lparen_token)
- return lparen_token + 1;
if (type_specifier_list)
if (unsigned candidate = type_specifier_list->lastToken())
return candidate;
@@ -3998,26 +3978,18 @@ unsigned TypenameCallExpressionAST::firstToken() const
if (name)
if (unsigned candidate = name->firstToken())
return candidate;
- if (lparen_token)
- return lparen_token;
- if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (expression)
+ if (unsigned candidate = expression->firstToken())
return candidate;
- if (rparen_token)
- return rparen_token;
return 0;
}
/** \generated */
unsigned TypenameCallExpressionAST::lastToken() const
{
- if (rparen_token)
- return rparen_token + 1;
- if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (expression)
+ if (unsigned candidate = expression->lastToken())
return candidate;
- if (lparen_token)
- return lparen_token + 1;
if (name)
if (unsigned candidate = name->lastToken())
return candidate;
@@ -4362,9 +4334,6 @@ unsigned RangeBasedForStatementAST::firstToken() const
if (declarator)
if (unsigned candidate = declarator->firstToken())
return candidate;
- if (initializer)
- if (unsigned candidate = initializer->firstToken())
- return candidate;
if (colon_token)
return colon_token;
if (expression)
@@ -4391,9 +4360,6 @@ unsigned RangeBasedForStatementAST::lastToken() const
return candidate;
if (colon_token)
return colon_token + 1;
- if (initializer)
- if (unsigned candidate = initializer->lastToken())
- return candidate;
if (declarator)
if (unsigned candidate = declarator->lastToken())
return candidate;
@@ -4407,3 +4373,67 @@ unsigned RangeBasedForStatementAST::lastToken() const
return 1;
}
+/** \generated */
+unsigned AlignofExpressionAST::firstToken() const
+{
+ if (alignof_token)
+ return alignof_token;
+ if (lparen_token)
+ return lparen_token;
+ if (typeId)
+ if (unsigned candidate = typeId->firstToken())
+ return candidate;
+ if (rparen_token)
+ return rparen_token;
+ return 0;
+}
+
+/** \generated */
+unsigned AlignofExpressionAST::lastToken() const
+{
+ if (rparen_token)
+ return rparen_token + 1;
+ if (typeId)
+ if (unsigned candidate = typeId->lastToken())
+ return candidate;
+ if (lparen_token)
+ return lparen_token + 1;
+ if (alignof_token)
+ return alignof_token + 1;
+ return 1;
+}
+
+/** \generated */
+unsigned AliasDeclarationAST::firstToken() const
+{
+ if (using_token)
+ return using_token;
+ if (identifier_token)
+ return identifier_token;
+ if (equal_token)
+ return equal_token;
+ if (typeId)
+ if (unsigned candidate = typeId->firstToken())
+ return candidate;
+ if (semicolon_token)
+ return semicolon_token;
+ return 0;
+}
+
+/** \generated */
+unsigned AliasDeclarationAST::lastToken() const
+{
+ if (semicolon_token)
+ return semicolon_token + 1;
+ if (typeId)
+ if (unsigned candidate = typeId->lastToken())
+ return candidate;
+ if (equal_token)
+ return equal_token + 1;
+ if (identifier_token)
+ return identifier_token + 1;
+ if (using_token)
+ return using_token + 1;
+ return 1;
+}
+
diff --git a/src/libs/3rdparty/cplusplus/AST.h b/src/libs/3rdparty/cplusplus/AST.h
index 24e031c72e5..c792581d426 100644
--- a/src/libs/3rdparty/cplusplus/AST.h
+++ b/src/libs/3rdparty/cplusplus/AST.h
@@ -125,6 +125,8 @@ public:
virtual AST *clone(MemoryPool *pool) const = 0;
virtual AccessDeclarationAST *asAccessDeclaration() { return 0; }
+ virtual AliasDeclarationAST *asAliasDeclaration() { return 0; }
+ virtual AlignofExpressionAST *asAlignofExpression() { return 0; }
virtual ArrayAccessAST *asArrayAccess() { return 0; }
virtual ArrayDeclaratorAST *asArrayDeclarator() { return 0; }
virtual ArrayInitializerAST *asArrayInitializer() { return 0; }
@@ -168,6 +170,7 @@ public:
virtual ExceptionDeclarationAST *asExceptionDeclaration() { return 0; }
virtual ExceptionSpecificationAST *asExceptionSpecification() { return 0; }
virtual ExpressionAST *asExpression() { return 0; }
+ virtual ExpressionListParenAST *asExpressionListParen() { return 0; }
virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return 0; }
virtual ExpressionStatementAST *asExpressionStatement() { return 0; }
virtual ForStatementAST *asForStatement() { return 0; }
@@ -195,8 +198,6 @@ public:
virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return 0; }
virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
virtual NewExpressionAST *asNewExpression() { return 0; }
- virtual NewInitializerAST *asNewInitializer() { return 0; }
- virtual NewPlacementAST *asNewPlacement() { return 0; }
virtual NewTypeIdAST *asNewTypeId() { return 0; }
virtual NoExceptSpecificationAST *asNoExceptSpecification() { return 0; }
virtual NumericLiteralAST *asNumericLiteral() { return 0; }
@@ -1457,8 +1458,10 @@ public:
ParameterDeclarationClauseAST *parameter_declaration_clause;
unsigned rparen_token;
SpecifierListAST *cv_qualifier_list;
+ unsigned ref_qualifier_token;
ExceptionSpecificationAST *exception_specification;
TrailingReturnTypeAST *trailing_return_type;
+ // Some FunctionDeclarators can also be interpreted as an initializer, like for 'A b(c);'
ExpressionAST *as_cpp_initializer;
public: // annotations
@@ -1470,6 +1473,7 @@ public:
, parameter_declaration_clause(0)
, rparen_token(0)
, cv_qualifier_list(0)
+ , ref_qualifier_token(0)
, exception_specification(0)
, trailing_return_type(0)
, as_cpp_initializer(0)
@@ -1630,7 +1634,10 @@ class CPLUSPLUS_EXPORT EnumSpecifierAST: public SpecifierAST
{
public:
unsigned enum_token;
+ unsigned key_token; // struct, class or 0
NameAST *name;
+ unsigned colon_token; // can be 0 if there is no enum-base
+ SpecifierListAST *type_specifier_list; // ditto
unsigned lbrace_token;
EnumeratorListAST *enumerator_list;
unsigned stray_comma_token;
@@ -1642,7 +1649,10 @@ public: // annotations
public:
EnumSpecifierAST()
: enum_token(0)
+ , key_token(0)
, name(0)
+ , colon_token(0)
+ , type_specifier_list(0)
, lbrace_token(0)
, enumerator_list(0)
, stray_comma_token(0)
@@ -1918,7 +1928,6 @@ public:
SpecifierListAST *type_specifier_list;
DeclaratorAST *declarator;
// or an expression
- ExpressionAST *initializer;
unsigned colon_token;
ExpressionAST *expression;
unsigned rparen_token;
@@ -1933,7 +1942,6 @@ public:
, lparen_token(0)
, type_specifier_list(0)
, declarator(0)
- , initializer(0)
, colon_token(0)
, expression(0)
, rparen_token(0)
@@ -2138,16 +2146,13 @@ class CPLUSPLUS_EXPORT MemInitializerAST: public AST
{
public:
NameAST *name;
- unsigned lparen_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ // either a BracedInitializerAST or a ExpressionListParenAST
+ ExpressionAST *expression;
public:
MemInitializerAST()
: name(0)
- , lparen_token(0)
- , expression_list(0)
- , rparen_token(0)
+ , expression(0)
{}
virtual MemInitializerAST *asMemInitializer() { return this; }
@@ -2402,7 +2407,37 @@ protected:
virtual bool match0(AST *, ASTMatcher *);
};
-class CPLUSPLUS_EXPORT NewPlacementAST: public AST
+class CPLUSPLUS_EXPORT AliasDeclarationAST: public DeclarationAST
+{
+public:
+ unsigned using_token;
+ unsigned identifier_token;
+ unsigned equal_token;
+ TypeIdAST *typeId;
+ unsigned semicolon_token;
+
+public:
+ AliasDeclarationAST()
+ : using_token(0)
+ , identifier_token(0)
+ , equal_token(0)
+ , typeId(0)
+ , semicolon_token(0)
+ {}
+
+ virtual AliasDeclarationAST *asAliasDeclaration() { return this; }
+
+ virtual unsigned firstToken() const;
+ virtual unsigned lastToken() const;
+
+ virtual AliasDeclarationAST *clone(MemoryPool *pool) const;
+
+protected:
+ virtual void accept0(ASTVisitor *visitor);
+ virtual bool match0(AST *, ASTMatcher *);
+};
+
+class CPLUSPLUS_EXPORT ExpressionListParenAST: public ExpressionAST
{
public:
unsigned lparen_token;
@@ -2410,18 +2445,18 @@ public:
unsigned rparen_token;
public:
- NewPlacementAST()
+ ExpressionListParenAST()
: lparen_token(0)
, expression_list(0)
, rparen_token(0)
{}
- virtual NewPlacementAST *asNewPlacement() { return this; }
+ virtual ExpressionListParenAST *asExpressionListParen() { return this; }
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
- virtual NewPlacementAST *clone(MemoryPool *pool) const;
+ virtual ExpressionListParenAST *clone(MemoryPool *pool) const;
protected:
virtual void accept0(ASTVisitor *visitor);
@@ -2459,7 +2494,7 @@ class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
public:
unsigned scope_token;
unsigned new_token;
- NewPlacementAST *new_placement;
+ ExpressionListParenAST *new_placement;
unsigned lparen_token;
ExpressionAST *type_id;
@@ -2467,7 +2502,7 @@ public:
NewTypeIdAST *new_type_id;
- NewInitializerAST *new_initializer;
+ ExpressionAST *new_initializer; // either ExpressionListParenAST or BracedInitializerAST
public:
NewExpressionAST()
@@ -2493,32 +2528,6 @@ protected:
virtual bool match0(AST *, ASTMatcher *);
};
-class CPLUSPLUS_EXPORT NewInitializerAST: public AST
-{
-public:
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
-
-public:
- NewInitializerAST()
- : lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
- virtual NewInitializerAST *asNewInitializer() { return this; }
-
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
-
- virtual NewInitializerAST *clone(MemoryPool *pool) const;
-
-protected:
- virtual void accept0(ASTVisitor *visitor);
- virtual bool match0(AST *, ASTMatcher *);
-};
-
class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
{
public:
@@ -2768,17 +2777,13 @@ class CPLUSPLUS_EXPORT TypenameCallExpressionAST: public ExpressionAST
public:
unsigned typename_token;
NameAST *name;
- unsigned lparen_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ ExpressionAST *expression; // either ExpressionListParenAST or BracedInitializerAST
public:
TypenameCallExpressionAST()
: typename_token(0)
, name(0)
- , lparen_token(0)
- , expression_list(0)
- , rparen_token(0)
+ , expression(0)
{}
virtual TypenameCallExpressionAST *asTypenameCallExpression() { return this; }
@@ -2797,16 +2802,12 @@ class CPLUSPLUS_EXPORT TypeConstructorCallAST: public ExpressionAST
{
public:
SpecifierListAST *type_specifier_list;
- unsigned lparen_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ ExpressionAST *expression; // either ExpressionListParenAST or BracedInitializerAST
public:
TypeConstructorCallAST()
: type_specifier_list(0)
- , lparen_token(0)
- , expression_list(0)
- , rparen_token(0)
+ , expression(0)
{}
virtual TypeConstructorCallAST *asTypeConstructorCall() { return this; }
@@ -2828,6 +2829,7 @@ public:
NestedNameSpecifierListAST *nested_name_specifier_list;
unsigned star_token;
SpecifierListAST *cv_qualifier_list;
+ unsigned ref_qualifier_token;
public:
PointerToMemberAST()
@@ -2835,6 +2837,7 @@ public:
, nested_name_specifier_list(0)
, star_token(0)
, cv_qualifier_list(0)
+ , ref_qualifier_token(0)
{}
virtual PointerToMemberAST *asPointerToMember() { return this; }
@@ -3025,6 +3028,34 @@ protected:
virtual bool match0(AST *, ASTMatcher *);
};
+class CPLUSPLUS_EXPORT AlignofExpressionAST: public ExpressionAST
+{
+public:
+ unsigned alignof_token;
+ unsigned lparen_token;
+ TypeIdAST *typeId;
+ unsigned rparen_token;
+
+public:
+ AlignofExpressionAST()
+ : alignof_token(0)
+ , lparen_token(0)
+ , typeId(0)
+ , rparen_token(0)
+ {}
+
+ virtual AlignofExpressionAST *asAlignofExpression() { return this; }
+
+ virtual unsigned firstToken() const;
+ virtual unsigned lastToken() const;
+
+ virtual AlignofExpressionAST *clone(MemoryPool *pool) const;
+
+protected:
+ virtual void accept0(ASTVisitor *visitor);
+ virtual bool match0(AST *, ASTMatcher *);
+};
+
class CPLUSPLUS_EXPORT PointerLiteralAST: public ExpressionAST
{
public:
diff --git a/src/libs/3rdparty/cplusplus/ASTClone.cpp b/src/libs/3rdparty/cplusplus/ASTClone.cpp
index 6a3b7a5ddac..7c151f09f6d 100644
--- a/src/libs/3rdparty/cplusplus/ASTClone.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTClone.cpp
@@ -487,6 +487,7 @@ FunctionDeclaratorAST *FunctionDeclaratorAST::clone(MemoryPool *pool) const
for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ ast->ref_qualifier_token = ref_qualifier_token;
if (exception_specification)
ast->exception_specification = exception_specification->clone(pool);
if (trailing_return_type)
@@ -557,8 +558,13 @@ EnumSpecifierAST *EnumSpecifierAST::clone(MemoryPool *pool) const
{
EnumSpecifierAST *ast = new (pool) EnumSpecifierAST;
ast->enum_token = enum_token;
+ ast->key_token = key_token;
if (name)
ast->name = name->clone(pool);
+ ast->colon_token = colon_token;
+ for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
+ iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
ast->lbrace_token = lbrace_token;
for (EnumeratorListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
@@ -680,8 +686,6 @@ RangeBasedForStatementAST *RangeBasedForStatementAST::clone(MemoryPool *pool) co
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
if (declarator)
ast->declarator = declarator->clone(pool);
- if (initializer)
- ast->initializer = initializer->clone(pool);
ast->colon_token = colon_token;
if (expression)
ast->expression = expression->clone(pool);
@@ -772,11 +776,8 @@ MemInitializerAST *MemInitializerAST::clone(MemoryPool *pool) const
MemInitializerAST *ast = new (pool) MemInitializerAST;
if (name)
ast->name = name->clone(pool);
- ast->lparen_token = lparen_token;
- for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
- iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
- ast->rparen_token = rparen_token;
+ if (expression)
+ ast->expression = expression->clone(pool);
return ast;
}
@@ -878,9 +879,21 @@ NamespaceAliasDefinitionAST *NamespaceAliasDefinitionAST::clone(MemoryPool *pool
return ast;
}
-NewPlacementAST *NewPlacementAST::clone(MemoryPool *pool) const
+AliasDeclarationAST *AliasDeclarationAST::clone(MemoryPool *pool) const
{
- NewPlacementAST *ast = new (pool) NewPlacementAST;
+ AliasDeclarationAST *ast = new (pool) AliasDeclarationAST;
+ ast->using_token = using_token;
+ ast->identifier_token = identifier_token;
+ ast->equal_token = equal_token;
+ if (typeId)
+ ast->typeId = typeId->clone(pool);
+ ast->semicolon_token = semicolon_token;
+ return ast;
+}
+
+ExpressionListParenAST *ExpressionListParenAST::clone(MemoryPool *pool) const
+{
+ ExpressionListParenAST *ast = new (pool) ExpressionListParenAST;
ast->lparen_token = lparen_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
@@ -917,16 +930,6 @@ NewExpressionAST *NewExpressionAST::clone(MemoryPool *pool) const
return ast;
}
-NewInitializerAST *NewInitializerAST::clone(MemoryPool *pool) const
-{
- NewInitializerAST *ast = new (pool) NewInitializerAST;
- ast->lparen_token = lparen_token;
- if (expression)
- ast->expression = expression->clone(pool);
- ast->rparen_token = rparen_token;
- return ast;
-}
-
NewTypeIdAST *NewTypeIdAST::clone(MemoryPool *pool) const
{
NewTypeIdAST *ast = new (pool) NewTypeIdAST;
@@ -1038,11 +1041,8 @@ TypenameCallExpressionAST *TypenameCallExpressionAST::clone(MemoryPool *pool) co
ast->typename_token = typename_token;
if (name)
ast->name = name->clone(pool);
- ast->lparen_token = lparen_token;
- for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
- iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
- ast->rparen_token = rparen_token;
+ if (expression)
+ ast->expression = expression->clone(pool);
return ast;
}
@@ -1052,11 +1052,8 @@ TypeConstructorCallAST *TypeConstructorCallAST::clone(MemoryPool *pool) const
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
- ast->lparen_token = lparen_token;
- for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
- iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
- ast->rparen_token = rparen_token;
+ if (expression)
+ ast->expression = expression->clone(pool);
return ast;
}
@@ -1071,6 +1068,7 @@ PointerToMemberAST *PointerToMemberAST::clone(MemoryPool *pool) const
for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ ast->ref_qualifier_token = ref_qualifier_token;
return ast;
}
@@ -1138,6 +1136,17 @@ SizeofExpressionAST *SizeofExpressionAST::clone(MemoryPool *pool) const
return ast;
}
+AlignofExpressionAST *AlignofExpressionAST::clone(MemoryPool *pool) const
+{
+ AlignofExpressionAST *ast = new (pool) AlignofExpressionAST;
+ ast->alignof_token = alignof_token;
+ ast->lparen_token = lparen_token;
+ if (typeId)
+ ast->typeId = typeId->clone(pool);
+ ast->rparen_token = rparen_token;
+ return ast;
+}
+
PointerLiteralAST *PointerLiteralAST::clone(MemoryPool *pool) const
{
PointerLiteralAST *ast = new (pool) PointerLiteralAST;
diff --git a/src/libs/3rdparty/cplusplus/ASTMatch0.cpp b/src/libs/3rdparty/cplusplus/ASTMatch0.cpp
index 81e74316b6b..de743a2f7f8 100644
--- a/src/libs/3rdparty/cplusplus/ASTMatch0.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTMatch0.cpp
@@ -592,33 +592,33 @@ bool NamespaceAliasDefinitionAST::match0(AST *pattern, ASTMatcher *matcher)
return false;
}
-bool NewPlacementAST::match0(AST *pattern, ASTMatcher *matcher)
+bool AliasDeclarationAST::match0(AST *pattern, ASTMatcher *matcher)
{
- if (NewPlacementAST *_other = pattern->asNewPlacement())
+ if (AliasDeclarationAST *_other = pattern->asAliasDeclaration())
return matcher->match(this, _other);
return false;
}
-bool NewArrayDeclaratorAST::match0(AST *pattern, ASTMatcher *matcher)
+bool ExpressionListParenAST::match0(AST *pattern, ASTMatcher *matcher)
{
- if (NewArrayDeclaratorAST *_other = pattern->asNewArrayDeclarator())
+ if (ExpressionListParenAST *_other = pattern->asExpressionListParen())
return matcher->match(this, _other);
return false;
}
-bool NewExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
+bool NewArrayDeclaratorAST::match0(AST *pattern, ASTMatcher *matcher)
{
- if (NewExpressionAST *_other = pattern->asNewExpression())
+ if (NewArrayDeclaratorAST *_other = pattern->asNewArrayDeclarator())
return matcher->match(this, _other);
return false;
}
-bool NewInitializerAST::match0(AST *pattern, ASTMatcher *matcher)
+bool NewExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
{
- if (NewInitializerAST *_other = pattern->asNewInitializer())
+ if (NewExpressionAST *_other = pattern->asNewExpression())
return matcher->match(this, _other);
return false;
@@ -776,6 +776,14 @@ bool SizeofExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
return false;
}
+bool AlignofExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
+{
+ if (AlignofExpressionAST *_other = pattern->asAlignofExpression())
+ return matcher->match(this, _other);
+
+ return false;
+}
+
bool PointerLiteralAST::match0(AST *pattern, ASTMatcher *matcher)
{
if (PointerLiteralAST *_other = pattern->asPointerLiteral())
diff --git a/src/libs/3rdparty/cplusplus/ASTMatcher.cpp b/src/libs/3rdparty/cplusplus/ASTMatcher.cpp
index a773c07b3ed..e2df7d75830 100644
--- a/src/libs/3rdparty/cplusplus/ASTMatcher.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTMatcher.cpp
@@ -809,6 +809,8 @@ bool ASTMatcher::match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *patte
else if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
return false;
+ pattern->ref_qualifier_token = node->ref_qualifier_token;
+
if (! pattern->exception_specification)
pattern->exception_specification = node->exception_specification;
else if (! AST::match(node->exception_specification, pattern->exception_specification, this))
@@ -933,11 +935,20 @@ bool ASTMatcher::match(EnumSpecifierAST *node, EnumSpecifierAST *pattern)
pattern->enum_token = node->enum_token;
+ pattern->key_token = node->key_token;
+
if (! pattern->name)
pattern->name = node->name;
else if (! AST::match(node->name, pattern->name, this))
return false;
+ pattern->colon_token = node->colon_token;
+
+ if (! pattern->type_specifier_list)
+ pattern->type_specifier_list = node->type_specifier_list;
+ else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
+ return false;
+
pattern->lbrace_token = node->lbrace_token;
if (! pattern->enumerator_list)
@@ -1152,11 +1163,6 @@ bool ASTMatcher::match(RangeBasedForStatementAST *node, RangeBasedForStatementAS
else if (! AST::match(node->declarator, pattern->declarator, this))
return false;
- if (! pattern->initializer)
- pattern->initializer = node->initializer;
- else if (! AST::match(node->initializer, pattern->initializer, this))
- return false;
-
pattern->colon_token = node->colon_token;
if (! pattern->expression)
@@ -1319,15 +1325,11 @@ bool ASTMatcher::match(MemInitializerAST *node, MemInitializerAST *pattern)
else if (! AST::match(node->name, pattern->name, this))
return false;
- pattern->lparen_token = node->lparen_token;
-
- if (! pattern->expression_list)
- pattern->expression_list = node->expression_list;
- else if (! AST::match(node->expression_list, pattern->expression_list, this))
+ if (! pattern->expression)
+ pattern->expression = node->expression;
+ else if (! AST::match(node->expression, pattern->expression, this))
return false;
- pattern->rparen_token = node->rparen_token;
-
return true;
}
@@ -1492,7 +1494,28 @@ bool ASTMatcher::match(NamespaceAliasDefinitionAST *node, NamespaceAliasDefiniti
return true;
}
-bool ASTMatcher::match(NewPlacementAST *node, NewPlacementAST *pattern)
+bool ASTMatcher::match(AliasDeclarationAST *node, AliasDeclarationAST *pattern)
+{
+ (void) node;
+ (void) pattern;
+
+ pattern->using_token = node->using_token;
+
+ pattern->identifier_token = node->identifier_token;
+
+ pattern->equal_token = node->equal_token;
+
+ if (! pattern->typeId)
+ pattern->typeId = node->typeId;
+ else if (! AST::match(node->typeId, pattern->typeId, this))
+ return false;
+
+ pattern->semicolon_token = node->semicolon_token;
+
+ return true;
+}
+
+bool ASTMatcher::match(ExpressionListParenAST *node, ExpressionListParenAST *pattern)
{
(void) node;
(void) pattern;
@@ -1562,23 +1585,6 @@ bool ASTMatcher::match(NewExpressionAST *node, NewExpressionAST *pattern)
return true;
}
-bool ASTMatcher::match(NewInitializerAST *node, NewInitializerAST *pattern)
-{
- (void) node;
- (void) pattern;
-
- pattern->lparen_token = node->lparen_token;
-
- if (! pattern->expression)
- pattern->expression = node->expression;
- else if (! AST::match(node->expression, pattern->expression, this))
- return false;
-
- pattern->rparen_token = node->rparen_token;
-
- return true;
-}
-
bool ASTMatcher::match(NewTypeIdAST *node, NewTypeIdAST *pattern)
{
(void) node;
@@ -1768,15 +1774,11 @@ bool ASTMatcher::match(TypenameCallExpressionAST *node, TypenameCallExpressionAS
else if (! AST::match(node->name, pattern->name, this))
return false;
- pattern->lparen_token = node->lparen_token;
-
- if (! pattern->expression_list)
- pattern->expression_list = node->expression_list;
- else if (! AST::match(node->expression_list, pattern->expression_list, this))
+ if (! pattern->expression)
+ pattern->expression = node->expression;
+ else if (! AST::match(node->expression, pattern->expression, this))
return false;
- pattern->rparen_token = node->rparen_token;
-
return true;
}
@@ -1790,15 +1792,11 @@ bool ASTMatcher::match(TypeConstructorCallAST *node, TypeConstructorCallAST *pat
else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
return false;
- pattern->lparen_token = node->lparen_token;
-
- if (! pattern->expression_list)
- pattern->expression_list = node->expression_list;
- else if (! AST::match(node->expression_list, pattern->expression_list, this))
+ if (! pattern->expression)
+ pattern->expression = node->expression;
+ else if (! AST::match(node->expression, pattern->expression, this))
return false;
- pattern->rparen_token = node->rparen_token;
-
return true;
}
@@ -1821,6 +1819,8 @@ bool ASTMatcher::match(PointerToMemberAST *node, PointerToMemberAST *pattern)
else if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
return false;
+ pattern->ref_qualifier_token = node->ref_qualifier_token;
+
return true;
}
@@ -1925,6 +1925,25 @@ bool ASTMatcher::match(SizeofExpressionAST *node, SizeofExpressionAST *pattern)
return true;
}
+bool ASTMatcher::match(AlignofExpressionAST *node, AlignofExpressionAST *pattern)
+{
+ (void) node;
+ (void) pattern;
+
+ pattern->alignof_token = node->alignof_token;
+
+ pattern->lparen_token = node->lparen_token;
+
+ if (! pattern->typeId)
+ pattern->typeId = node->typeId;
+ else if (! AST::match(node->typeId, pattern->typeId, this))
+ return false;
+
+ pattern->rparen_token = node->rparen_token;
+
+ return true;
+}
+
bool ASTMatcher::match(PointerLiteralAST *node, PointerLiteralAST *pattern)
{
(void) node;
diff --git a/src/libs/3rdparty/cplusplus/ASTMatcher.h b/src/libs/3rdparty/cplusplus/ASTMatcher.h
index 202a5777414..29842253cda 100644
--- a/src/libs/3rdparty/cplusplus/ASTMatcher.h
+++ b/src/libs/3rdparty/cplusplus/ASTMatcher.h
@@ -32,6 +32,8 @@ public:
virtual ~ASTMatcher();
virtual bool match(AccessDeclarationAST *node, AccessDeclarationAST *pattern);
+ virtual bool match(AliasDeclarationAST *node, AliasDeclarationAST *pattern);
+ virtual bool match(AlignofExpressionAST *node, AlignofExpressionAST *pattern);
virtual bool match(ArrayAccessAST *node, ArrayAccessAST *pattern);
virtual bool match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern);
virtual bool match(ArrayInitializerAST *node, ArrayInitializerAST *pattern);
@@ -71,6 +73,7 @@ public:
virtual bool match(EnumSpecifierAST *node, EnumSpecifierAST *pattern);
virtual bool match(EnumeratorAST *node, EnumeratorAST *pattern);
virtual bool match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern);
+ virtual bool match(ExpressionListParenAST *node, ExpressionListParenAST *pattern);
virtual bool match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern);
virtual bool match(ExpressionStatementAST *node, ExpressionStatementAST *pattern);
virtual bool match(ForStatementAST *node, ForStatementAST *pattern);
@@ -97,8 +100,6 @@ public:
virtual bool match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern);
virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
- virtual bool match(NewInitializerAST *node, NewInitializerAST *pattern);
- virtual bool match(NewPlacementAST *node, NewPlacementAST *pattern);
virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
virtual bool match(NoExceptSpecificationAST *node, NoExceptSpecificationAST *pattern);
virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
diff --git a/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h b/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
index 41ad4964b2d..142737d44e7 100644
--- a/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
+++ b/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
@@ -374,10 +374,11 @@ public:
return __ast;
}
- EnumSpecifierAST *EnumSpecifier(NameAST *name = 0, EnumeratorListAST *enumerator_list = 0)
+ EnumSpecifierAST *EnumSpecifier(NameAST *name = 0, SpecifierListAST *type_specifier_list = 0, EnumeratorListAST *enumerator_list = 0)
{
EnumSpecifierAST *__ast = new (&pool) EnumSpecifierAST;
__ast->name = name;
+ __ast->type_specifier_list = type_specifier_list;
__ast->enumerator_list = enumerator_list;
return __ast;
}
@@ -447,12 +448,11 @@ public:
return __ast;
}
- RangeBasedForStatementAST *RangeBasedForStatement(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *initializer = 0, ExpressionAST *expression = 0, StatementAST *statement = 0)
+ RangeBasedForStatementAST *RangeBasedForStatement(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *expression = 0, StatementAST *statement = 0)
{
RangeBasedForStatementAST *__ast = new (&pool) RangeBasedForStatementAST;
__ast->type_specifier_list = type_specifier_list;
__ast->declarator = declarator;
- __ast->initializer = initializer;
__ast->expression = expression;
__ast->statement = statement;
return __ast;
@@ -505,11 +505,11 @@ public:
return __ast;
}
- MemInitializerAST *MemInitializer(NameAST *name = 0, ExpressionListAST *expression_list = 0)
+ MemInitializerAST *MemInitializer(NameAST *name = 0, ExpressionAST *expression = 0)
{
MemInitializerAST *__ast = new (&pool) MemInitializerAST;
__ast->name = name;
- __ast->expression_list = expression_list;
+ __ast->expression = expression;
return __ast;
}
@@ -578,9 +578,16 @@ public:
return __ast;
}
- NewPlacementAST *NewPlacement(ExpressionListAST *expression_list = 0)
+ AliasDeclarationAST *AliasDeclaration(TypeIdAST *typeId = 0)
{
- NewPlacementAST *__ast = new (&pool) NewPlacementAST;
+ AliasDeclarationAST *__ast = new (&pool) AliasDeclarationAST;
+ __ast->typeId = typeId;
+ return __ast;
+ }
+
+ ExpressionListParenAST *ExpressionListParen(ExpressionListAST *expression_list = 0)
+ {
+ ExpressionListParenAST *__ast = new (&pool) ExpressionListParenAST;
__ast->expression_list = expression_list;
return __ast;
}
@@ -592,7 +599,7 @@ public:
return __ast;
}
- NewExpressionAST *NewExpression(NewPlacementAST *new_placement = 0, ExpressionAST *type_id = 0, NewTypeIdAST *new_type_id = 0, NewInitializerAST *new_initializer = 0)
+ NewExpressionAST *NewExpression(ExpressionListParenAST *new_placement = 0, ExpressionAST *type_id = 0, NewTypeIdAST *new_type_id = 0, ExpressionAST *new_initializer = 0)
{
NewExpressionAST *__ast = new (&pool) NewExpressionAST;
__ast->new_placement = new_placement;
@@ -602,13 +609,6 @@ public:
return __ast;
}
- NewInitializerAST *NewInitializer(ExpressionAST *expression = 0)
- {
- NewInitializerAST *__ast = new (&pool) NewInitializerAST;
- __ast->expression = expression;
- return __ast;
- }
-
NewTypeIdAST *NewTypeId(SpecifierListAST *type_specifier_list = 0, PtrOperatorListAST *ptr_operator_list = 0, NewArrayDeclaratorListAST *new_array_declarator_list = 0)
{
NewTypeIdAST *__ast = new (&pool) NewTypeIdAST;
@@ -678,19 +678,19 @@ public:
return __ast;
}
- TypenameCallExpressionAST *TypenameCallExpression(NameAST *name = 0, ExpressionListAST *expression_list = 0)
+ TypenameCallExpressionAST *TypenameCallExpression(NameAST *name = 0, ExpressionAST *expression = 0)
{
TypenameCallExpressionAST *__ast = new (&pool) TypenameCallExpressionAST;
__ast->name = name;
- __ast->expression_list = expression_list;
+ __ast->expression = expression;
return __ast;
}
- TypeConstructorCallAST *TypeConstructorCall(SpecifierListAST *type_specifier_list = 0, ExpressionListAST *expression_list = 0)
+ TypeConstructorCallAST *TypeConstructorCall(SpecifierListAST *type_specifier_list = 0, ExpressionAST *expression = 0)
{
TypeConstructorCallAST *__ast = new (&pool) TypeConstructorCallAST;
__ast->type_specifier_list = type_specifier_list;
- __ast->expression_list = expression_list;
+ __ast->expression = expression;
return __ast;
}
@@ -747,6 +747,13 @@ public:
return __ast;
}
+ AlignofExpressionAST *AlignofExpression(TypeIdAST *typeId = 0)
+ {
+ AlignofExpressionAST *__ast = new (&pool) AlignofExpressionAST;
+ __ast->typeId = typeId;
+ return __ast;
+ }
+
PointerLiteralAST *PointerLiteral()
{
PointerLiteralAST *__ast = new (&pool) PointerLiteralAST;
diff --git a/src/libs/3rdparty/cplusplus/ASTVisit.cpp b/src/libs/3rdparty/cplusplus/ASTVisit.cpp
index f30523ee538..6434a7c5e2b 100644
--- a/src/libs/3rdparty/cplusplus/ASTVisit.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTVisit.cpp
@@ -410,6 +410,7 @@ void EnumSpecifierAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(name, visitor);
+ accept(type_specifier_list, visitor);
accept(enumerator_list, visitor);
}
visitor->endVisit(this);
@@ -493,7 +494,6 @@ void RangeBasedForStatementAST::accept0(ASTVisitor *visitor)
if (visitor->visit(this)) {
accept(type_specifier_list, visitor);
accept(declarator, visitor);
- accept(initializer, visitor);
accept(expression, visitor);
accept(statement, visitor);
}
@@ -557,7 +557,7 @@ void MemInitializerAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(name, visitor);
- accept(expression_list, visitor);
+ accept(expression, visitor);
}
visitor->endVisit(this);
}
@@ -636,7 +636,15 @@ void NamespaceAliasDefinitionAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
-void NewPlacementAST::accept0(ASTVisitor *visitor)
+void AliasDeclarationAST::accept0(ASTVisitor *visitor)
+{
+ if (visitor->visit(this)) {
+ accept(typeId, visitor);
+ }
+ visitor->endVisit(this);
+}
+
+void ExpressionListParenAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(expression_list, visitor);
@@ -663,14 +671,6 @@ void NewExpressionAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
-void NewInitializerAST::accept0(ASTVisitor *visitor)
-{
- if (visitor->visit(this)) {
- accept(expression, visitor);
- }
- visitor->endVisit(this);
-}
-
void NewTypeIdAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
@@ -753,7 +753,7 @@ void TypenameCallExpressionAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(name, visitor);
- accept(expression_list, visitor);
+ accept(expression, visitor);
}
visitor->endVisit(this);
}
@@ -762,7 +762,7 @@ void TypeConstructorCallAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(type_specifier_list, visitor);
- accept(expression_list, visitor);
+ accept(expression, visitor);
}
visitor->endVisit(this);
}
@@ -828,6 +828,14 @@ void SizeofExpressionAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
+void AlignofExpressionAST::accept0(ASTVisitor *visitor)
+{
+ if (visitor->visit(this)) {
+ accept(typeId, visitor);
+ }
+ visitor->endVisit(this);
+}
+
void PointerLiteralAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
diff --git a/src/libs/3rdparty/cplusplus/ASTVisitor.h b/src/libs/3rdparty/cplusplus/ASTVisitor.h
index eab93a20bba..a7d3f728f63 100644
--- a/src/libs/3rdparty/cplusplus/ASTVisitor.h
+++ b/src/libs/3rdparty/cplusplus/ASTVisitor.h
@@ -74,6 +74,8 @@ public:
virtual void postVisit(AST *) {}
virtual bool visit(AccessDeclarationAST *) { return true; }
+ virtual bool visit(AliasDeclarationAST *) { return true; }
+ virtual bool visit(AlignofExpressionAST *) { return true; }
virtual bool visit(ArrayAccessAST *) { return true; }
virtual bool visit(ArrayDeclaratorAST *) { return true; }
virtual bool visit(ArrayInitializerAST *) { return true; }
@@ -113,6 +115,7 @@ public:
virtual bool visit(EnumSpecifierAST *) { return true; }
virtual bool visit(EnumeratorAST *) { return true; }
virtual bool visit(ExceptionDeclarationAST *) { return true; }
+ virtual bool visit(ExpressionListParenAST *) { return true; }
virtual bool visit(ExpressionOrDeclarationStatementAST *) { return true; }
virtual bool visit(ExpressionStatementAST *) { return true; }
virtual bool visit(ForStatementAST *) { return true; }
@@ -139,8 +142,6 @@ public:
virtual bool visit(NestedNameSpecifierAST *) { return true; }
virtual bool visit(NewArrayDeclaratorAST *) { return true; }
virtual bool visit(NewExpressionAST *) { return true; }
- virtual bool visit(NewInitializerAST *) { return true; }
- virtual bool visit(NewPlacementAST *) { return true; }
virtual bool visit(NewTypeIdAST *) { return true; }
virtual bool visit(NoExceptSpecificationAST *) { return true; }
virtual bool visit(NumericLiteralAST *) { return true; }
@@ -218,6 +219,8 @@ public:
virtual bool visit(WhileStatementAST *) { return true; }
virtual void endVisit(AccessDeclarationAST *) {}
+ virtual void endVisit(AliasDeclarationAST *) {}
+ virtual void endVisit(AlignofExpressionAST *) {}
virtual void endVisit(ArrayAccessAST *) {}
virtual void endVisit(ArrayDeclaratorAST *) {}
virtual void endVisit(ArrayInitializerAST *) {}
@@ -257,6 +260,7 @@ public:
virtual void endVisit(EnumSpecifierAST *) {}
virtual void endVisit(EnumeratorAST *) {}
virtual void endVisit(ExceptionDeclarationAST *) {}
+ virtual void endVisit(ExpressionListParenAST *) {}
virtual void endVisit(ExpressionOrDeclarationStatementAST *) {}
virtual void endVisit(ExpressionStatementAST *) {}
virtual void endVisit(ForStatementAST *) {}
@@ -283,8 +287,6 @@ public:
virtual void endVisit(NestedNameSpecifierAST *) {}
virtual void endVisit(NewArrayDeclaratorAST *) {}
virtual void endVisit(NewExpressionAST *) {}
- virtual void endVisit(NewInitializerAST *) {}
- virtual void endVisit(NewPlacementAST *) {}
virtual void endVisit(NewTypeIdAST *) {}
virtual void endVisit(NoExceptSpecificationAST *) {}
virtual void endVisit(NumericLiteralAST *) {}
diff --git a/src/libs/3rdparty/cplusplus/ASTfwd.h b/src/libs/3rdparty/cplusplus/ASTfwd.h
index f429fe71011..722a5b0d38d 100644
--- a/src/libs/3rdparty/cplusplus/ASTfwd.h
+++ b/src/libs/3rdparty/cplusplus/ASTfwd.h
@@ -32,6 +32,8 @@ class ASTVisitor;
class ASTMatcher;
class AccessDeclarationAST;
+class AliasDeclarationAST;
+class AlignofExpressionAST;
class ArrayAccessAST;
class ArrayDeclaratorAST;
class ArrayInitializerAST;
@@ -75,6 +77,7 @@ class EnumeratorAST;
class ExceptionDeclarationAST;
class ExceptionSpecificationAST;
class ExpressionAST;
+class ExpressionListParenAST;
class ExpressionOrDeclarationStatementAST;
class ExpressionStatementAST;
class ForStatementAST;
@@ -102,8 +105,6 @@ class NestedExpressionAST;
class NestedNameSpecifierAST;
class NewArrayDeclaratorAST;
class NewExpressionAST;
-class NewInitializerAST;
-class NewPlacementAST;
class NewTypeIdAST;
class NoExceptSpecificationAST;
class NumericLiteralAST;
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 380b0ccaef4..0aa0f437126 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -517,9 +517,7 @@ void Bind::memInitializer(MemInitializerAST *ast, Function *fun)
/*const Name *name =*/ this->name(ast->name);
Scope *previousScope = switchScope(fun);
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- /*ExpressionTy value =*/ this->expression(it->value);
- }
+ this->expression(ast->expression);
(void) switchScope(previousScope);
}
@@ -539,14 +537,18 @@ const Name *Bind::nestedNameSpecifier(NestedNameSpecifierAST *ast)
return class_or_namespace_name;
}
-bool Bind::visit(NewPlacementAST *ast)
+bool Bind::visit(ExpressionListParenAST *ast)
{
- (void) ast;
- assert(!"unreachable");
+ // unsigned lparen_token = ast->lparen_token;
+ for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
+ /*ExpressionTy value =*/ this->expression(it->value);
+ }
+ // unsigned rparen_token = ast->rparen_token;
+
return false;
}
-void Bind::newPlacement(NewPlacementAST *ast)
+void Bind::newPlacement(ExpressionListParenAST *ast)
{
if (! ast)
return;
@@ -578,23 +580,6 @@ FullySpecifiedType Bind::newArrayDeclarator(NewArrayDeclaratorAST *ast, const Fu
return type;
}
-bool Bind::visit(NewInitializerAST *ast)
-{
- (void) ast;
- assert(!"unreachable");
- return false;
-}
-
-void Bind::newInitializer(NewInitializerAST *ast)
-{
- if (! ast)
- return;
-
- // unsigned lparen_token = ast->lparen_token;
- ExpressionTy expression = this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
-}
-
bool Bind::visit(NewTypeIdAST *ast)
{
(void) ast;
@@ -1330,7 +1315,6 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
block->addMember(decl);
}
- /*ExpressionTy initializer =*/ this->expression(ast->initializer);
/*ExpressionTy expression =*/ this->expression(ast->expression);
this->statement(ast->statement);
(void) switchScope(previousScope);
@@ -1636,7 +1620,7 @@ bool Bind::visit(NewExpressionAST *ast)
ExpressionTy type_id = this->expression(ast->type_id);
// unsigned rparen_token = ast->rparen_token;
this->newTypeId(ast->new_type_id);
- this->newInitializer(ast->new_initializer);
+ this->expression(ast->new_initializer);
return false;
}
@@ -1653,11 +1637,7 @@ bool Bind::visit(TypenameCallExpressionAST *ast)
{
// unsigned typename_token = ast->typename_token;
/*const Name *name =*/ this->name(ast->name);
- // unsigned lparen_token = ast->lparen_token;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- ExpressionTy value = this->expression(it->value);
- }
- // unsigned rparen_token = ast->rparen_token;
+ this->expression(ast->expression);
return false;
}
@@ -1667,11 +1647,7 @@ bool Bind::visit(TypeConstructorCallAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- // unsigned lparen_token = ast->lparen_token;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- ExpressionTy value = this->expression(it->value);
- }
- // unsigned rparen_token = ast->rparen_token;
+ this->expression(ast->expression);
return false;
}
@@ -1804,7 +1780,7 @@ bool Bind::visit(BracedInitializerAST *ast)
{
// unsigned lbrace_token = ast->lbrace_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- ExpressionTy value = this->expression(it->value);
+ /*ExpressionTy value =*/ this->expression(it->value);
}
// unsigned comma_token = ast->comma_token;
// unsigned rbrace_token = ast->rbrace_token;
@@ -1901,7 +1877,10 @@ bool Bind::visit(SimpleDeclarationAST *ast)
if (Function *funTy = decl->type()->asFunctionType()) {
funTy->setMethodKey(methodKey);
- if (funTy->isVirtual() && it->value->equal_token)
+ bool pureVirtualInit = it->value->equal_token
+ && it->value->initializer
+ && it->value->initializer->asNumericLiteral();
+ if (funTy->isVirtual() && pureVirtualInit)
funTy->setPureVirtual(true);
}
}
diff --git a/src/libs/3rdparty/cplusplus/Bind.h b/src/libs/3rdparty/cplusplus/Bind.h
index de0cf125573..93022b9af77 100644
--- a/src/libs/3rdparty/cplusplus/Bind.h
+++ b/src/libs/3rdparty/cplusplus/Bind.h
@@ -85,9 +85,8 @@ protected:
FullySpecifiedType exceptionSpecification(ExceptionSpecificationAST *ast, const FullySpecifiedType &init);
void memInitializer(MemInitializerAST *ast, Function *fun);
const Name *nestedNameSpecifier(NestedNameSpecifierAST *ast);
- void newPlacement(NewPlacementAST *ast);
+ void newPlacement(ExpressionListParenAST *ast);
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
- void newInitializer(NewInitializerAST *ast);
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
OperatorNameId::Kind cppOperator(OperatorAST *ast);
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun);
@@ -122,9 +121,7 @@ protected:
virtual bool visit(DynamicExceptionSpecificationAST *ast);
virtual bool visit(MemInitializerAST *ast);
virtual bool visit(NestedNameSpecifierAST *ast);
- virtual bool visit(NewPlacementAST *ast);
virtual bool visit(NewArrayDeclaratorAST *ast);
- virtual bool visit(NewInitializerAST *ast);
virtual bool visit(NewTypeIdAST *ast);
virtual bool visit(OperatorAST *ast);
virtual bool visit(ParameterDeclarationClauseAST *ast);
@@ -199,6 +196,7 @@ protected:
virtual bool visit(ObjCSelectorExpressionAST *ast);
virtual bool visit(LambdaExpressionAST *ast);
virtual bool visit(BracedInitializerAST *ast);
+ virtual bool visit(ExpressionListParenAST *ast);
// DeclarationAST
virtual bool visit(SimpleDeclarationAST *ast);
diff --git a/src/libs/3rdparty/cplusplus/Keywords.cpp b/src/libs/3rdparty/cplusplus/Keywords.cpp
index cac51a4fd68..1da78381ac0 100644
--- a/src/libs/3rdparty/cplusplus/Keywords.cpp
+++ b/src/libs/3rdparty/cplusplus/Keywords.cpp
@@ -573,6 +573,26 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
+ else if (x && s[0] == 'a') {
+ if (s[1] == 'l') {
+ if (s[2] == 'i') {
+ if (s[3] == 'g') {
+ if (s[4] == 'n') {
+ if (s[5] == 'a') {
+ if (s[6] == 's') {
+ return T_ALIGNAS;
+ }
+ }
+ else if (s[5] == 'o') {
+ if (s[6] == 'f') {
+ return T_ALIGNOF;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
else if (s[0] == 'd') {
if (s[1] == 'e') {
if (s[2] == 'f') {
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp
index e1800229e72..c2a579af38b 100644
--- a/src/libs/3rdparty/cplusplus/Parser.cpp
+++ b/src/libs/3rdparty/cplusplus/Parser.cpp
@@ -28,7 +28,7 @@
#include "QtContextKeywords.h"
#include <string>
#include <cstdio> // for putchar
-
+#include <QDebug>
#ifdef _MSC_VER
# define va_copy(dst, src) ((dst) = (src))
#elif defined(__INTEL_COMPILER) && !defined(va_copy)
@@ -107,7 +107,7 @@ inline int precedence(int tokenKind, bool templateArguments)
{
// ### this will/might need some tuning for C++0x
// (see: [temp.names]p3)
- if (templateArguments && tokenKind == T_GREATER)
+ if (templateArguments && (tokenKind == T_GREATER || tokenKind == T_GREATER_GREATER))
return -1;
if (lookAtAssignmentOperator(tokenKind))
@@ -212,6 +212,11 @@ bool Parser::switchTemplateArguments(bool templateArguments)
return previousTemplateArguments;
}
+bool Parser::maybeSplitGreaterGreaterToken(int n)
+{
+ return _translationUnit->maybeSplitGreaterGreaterToken(_tokenIndex + n - 1);
+}
+
bool Parser::blockErrors(bool block)
{ return _translationUnit->blockErrors(block); }
@@ -367,6 +372,18 @@ bool Parser::skip(int l, int r)
return false;
}
+int Parser::find(int token, int stopAt)
+{
+ for (int i = 1; ; ++i) {
+ const int tk = LA(i);
+ if (!tk || tk == stopAt)
+ return 0;
+ if (tk == token)
+ return i;
+ }
+ return 0;
+}
+
void Parser::match(int kind, unsigned *token)
{
if (LA() == kind)
@@ -421,9 +438,9 @@ bool Parser::parseTemplateId(NameAST *&node, unsigned template_token)
ast->template_token = template_token;
ast->identifier_token = consumeToken();
ast->less_token = consumeToken();
- if (LA() == T_GREATER || parseTemplateArgumentList(
+ if (maybeSplitGreaterGreaterToken() || LA() == T_GREATER || parseTemplateArgumentList(
ast->template_argument_list)) {
- if (LA() == T_GREATER) {
+ if (maybeSplitGreaterGreaterToken() || LA() == T_GREATER) {
ast->greater_token = consumeToken();
node = ast;
return true;
@@ -811,6 +828,9 @@ bool Parser::parseUsing(DeclarationAST *&node)
if (LA(2) == T_NAMESPACE)
return parseUsingDirective(node);
+ if (_cxx0xEnabled && LA(2) == T_IDENTIFIER && parseAliasDeclaration(node))
+ return true;
+
UsingAST *ast = new (_pool) UsingAST;
ast->using_token = consumeToken();
@@ -840,6 +860,37 @@ bool Parser::parseUsingDirective(DeclarationAST *&node)
return false;
}
+// alias-declaration = 'using' identifier attribute-specifier-seq(opt) '=' type-id ';'
+bool Parser::parseAliasDeclaration(DeclarationAST *&node)
+{
+ DEBUG_THIS_RULE();
+ if (LA() != T_USING || LA(2) != T_IDENTIFIER)
+ return false;
+
+ if (!find(T_EQUAL, T_SEMICOLON))
+ return false;
+
+ AliasDeclarationAST *alias = new (_pool) AliasDeclarationAST;
+ alias->using_token = consumeToken();
+ alias->identifier_token = consumeToken();
+
+ // ### attributes!
+ while (LA() != T_EQUAL)
+ consumeToken();
+
+ alias->equal_token = consumeToken();
+
+ ExpressionAST *expr = 0;
+ parseTypeId(expr);
+ if (expr)
+ alias->typeId = expr->asTypeId();
+
+ match(T_SEMICOLON, &alias->semicolon_token);
+
+ node = alias;
+ return true;
+}
+
bool Parser::parseConversionFunctionId(NameAST *&node)
{
DEBUG_THIS_RULE();
@@ -1057,7 +1108,7 @@ bool Parser::parseTemplateDeclaration(DeclarationAST *&node)
if (LA() == T_LESS) {
ast->less_token = consumeToken();
- if (LA() == T_GREATER || parseTemplateParameterList(ast->template_parameter_list))
+ if (maybeSplitGreaterGreaterToken() || LA() == T_GREATER || parseTemplateParameterList(ast->template_parameter_list))
match(T_GREATER, &ast->greater_token);
}
@@ -1176,6 +1227,21 @@ bool Parser::parseCvQualifiers(SpecifierListAST *&node)
return start != cursor();
}
+bool Parser::parseRefQualifier(unsigned &ref_qualifier)
+{
+ DEBUG_THIS_RULE();
+
+ if (!_cxx0xEnabled)
+ return false;
+
+ if (LA() == T_AMPER || LA() == T_AMPER_AMPER) {
+ ref_qualifier = consumeToken();
+ return true;
+ }
+
+ return false;
+}
+
/**
* \brief Handles override and final from C++ 2011, they are pseudo keywords and has special meaning only in function declaration
*/
@@ -1257,7 +1323,7 @@ bool Parser::parseTemplateArgument(ExpressionAST *&node)
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
index = 2;
- if (LA(index) == T_COMMA || LA(index) == T_GREATER)
+ if (LA(index) == T_COMMA || maybeSplitGreaterGreaterToken(index) || LA(index) == T_GREATER)
return true;
}
@@ -1425,11 +1491,12 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
bool blocked = blockErrors(true);
if (parseInitializer(initializer, &node->equal_token)) {
- NestedExpressionAST *expr = 0;
+ // maybe the initializer also parses as a FunctionDeclarator?
+ ExpressionListParenAST *expr = 0;
if (initializer)
- expr = initializer->asNestedExpression();
+ expr = initializer->asExpressionListParen();
if (expr) {
- if (expr->expression && expr->rparen_token && (LA() == T_COMMA || LA() == T_SEMICOLON)) {
+ if (expr->expression_list && expr->rparen_token && (LA() == T_COMMA || LA() == T_SEMICOLON)) {
rewind(lparen_token);
// check for ambiguous declarators.
@@ -1474,8 +1541,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
+ parseRefQualifier(ast->ref_qualifier_token);
parseExceptionSpecification(ast->exception_specification);
if (_cxx0xEnabled && ! node->ptr_operator_list && LA() == T_ARROW) {
@@ -1494,6 +1560,8 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
parseTrailingReturnType(ast->trailing_return_type);
}
+ parseOverrideFinalQualifiers(ast->cv_qualifier_list);
+
*postfix_ptr = new (_pool) PostfixDeclaratorListAST(ast);
postfix_ptr = &(*postfix_ptr)->next;
} else if (LA() == T_LBRACKET) {
@@ -1579,6 +1647,7 @@ bool Parser::parseAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *dec
ast->rparen_token = consumeToken();
}
parseCvQualifiers(ast->cv_qualifier_list);
+ parseRefQualifier(ast->ref_qualifier_token);
parseExceptionSpecification(ast->exception_specification);
*postfix_ptr = new (_pool) PostfixDeclaratorListAST(ast);
postfix_ptr = &(*postfix_ptr)->next;
@@ -1621,16 +1690,19 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_ENUM) {
- unsigned enum_token = consumeToken();
- if (_cxx0xEnabled && LA() == T_CLASS)
- consumeToken();
+ EnumSpecifierAST *ast = new (_pool) EnumSpecifierAST;
- NameAST *name = 0;
- parseName(name);
+ ast->enum_token = consumeToken();
+ if (_cxx0xEnabled && (LA() == T_CLASS || LA() == T_STRUCT))
+ ast->key_token = consumeToken();
+
+ parseName(ast->name);
+
+ if (_cxx0xEnabled && LA() == T_COLON) {
+ ast->colon_token = consumeToken();
+ parseTypeSpecifier(ast->type_specifier_list);
+ }
if (LA() == T_LBRACE) {
- EnumSpecifierAST *ast = new (_pool) EnumSpecifierAST;
- ast->enum_token = enum_token;
- ast->name = name;
ast->lbrace_token = consumeToken();
unsigned comma_token = 0;
EnumeratorListAST **enumerator_ptr = &ast->enumerator_list;
@@ -1654,9 +1726,12 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
match(T_COMMA, &comma_token);
}
match(T_RBRACE, &ast->rbrace_token);
- node = new (_pool) SpecifierListAST(ast);
- return true;
+ } else if (!_cxx0xEnabled) {
+ return false;
}
+
+ node = new (_pool) SpecifierListAST(ast);
+ return true;
}
return false;
}
@@ -1727,7 +1802,7 @@ bool Parser::parseTemplateTypeParameter(DeclarationAST *&node)
if (LA() == T_LESS)
ast->less_token = consumeToken();
parseTemplateParameterList(ast->template_parameter_list);
- if (LA() == T_GREATER)
+ if (maybeSplitGreaterGreaterToken() || LA() == T_GREATER)
ast->greater_token = consumeToken();
if (LA() == T_CLASS)
ast->class_token = consumeToken();
@@ -1747,7 +1822,7 @@ bool Parser::parseTemplateTypeParameter(DeclarationAST *&node)
return false;
}
-bool Parser::lookAtTypeParameter() const
+bool Parser::lookAtTypeParameter()
{
if (LA() == T_CLASS || LA() == T_TYPENAME) {
if (LA(2) == T_IDENTIFIER) {
@@ -1758,7 +1833,7 @@ bool Parser::lookAtTypeParameter() const
return true;
default:
- return false;
+ return maybeSplitGreaterGreaterToken(3);
}
} else if (LA(2) == T_COLON_COLON) {
// found something like template <typename ::foo::bar>...
@@ -1872,7 +1947,10 @@ bool Parser::parseParameterDeclaration(ParameterDeclarationAST *&node)
parseDeclaratorOrAbstractDeclarator(ast->declarator, decl_specifier_seq);
if (LA() == T_EQUAL) {
ast->equal_token = consumeToken();
- parseLogicalOrExpression(ast->expression);
+ if (!_cxx0xEnabled)
+ parseLogicalOrExpression(ast->expression);
+ else
+ parseInitializerClause0x(ast->expression);
}
node = ast;
@@ -2446,7 +2524,9 @@ bool Parser::parseExceptionSpecification(ExceptionSpecificationAST *&node)
} else if (_cxx0xEnabled && LA() == T_NOEXCEPT) {
NoExceptSpecificationAST *ast = new (_pool) NoExceptSpecificationAST;
ast->noexcept_token = consumeToken();
- if (LA() == T_LPAREN && parseConstantExpression(ast->expression)) {
+ if (LA() == T_LPAREN) {
+ ast->lparen_token = consumeToken();
+ parseConstantExpression(ast->expression);
match(T_RPAREN, &ast->rparen_token);
}
node = ast;
@@ -2493,6 +2573,10 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
consumeToken();
}
+ const bool isFunctionDeclarator = node
+ && node->postfix_declarator_list
+ && node->postfix_declarator_list->lastValue()
+ && node->postfix_declarator_list->lastValue()->asFunctionDeclarator();
if (declaringClass && LA() == T_COLON
&& (! node || ! node->postfix_declarator_list)) {
unsigned colon_token = consumeToken();
@@ -2506,7 +2590,20 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
return true;
}
rewind(colon_token);
- } else if (node->core_declarator && (LA() == T_EQUAL || (! declaringClass && LA() == T_LPAREN))) {
+ } else if (isFunctionDeclarator && declaringClass && node->core_declarator && LA() == T_EQUAL && LA(3) == T_SEMICOLON) { // = 0, = delete, = default
+ if (!_cxx0xEnabled || LA(2) == T_NUMERIC_LITERAL) {
+ parseInitializer(node->initializer, &node->equal_token);
+ } else {
+ node->equal_token = consumeToken();
+
+ IdExpressionAST *id_expr = new (_pool) IdExpressionAST;
+ node->initializer = id_expr;
+
+ SimpleNameAST *simple_name = new (_pool) SimpleNameAST;
+ id_expr->name = simple_name;
+ simple_name->identifier_token = consumeToken();
+ }
+ } else if (node->core_declarator && (LA() == T_EQUAL || (_cxx0xEnabled && !isFunctionDeclarator && LA() == T_LBRACE) || (! declaringClass && LA() == T_LPAREN))) {
parseInitializer(node->initializer, &node->equal_token);
}
return true;
@@ -2555,7 +2652,7 @@ bool Parser::parseInitializer0x(ExpressionAST *&node, unsigned *equals_token)
}
else if (LA() == T_LPAREN) {
- return parsePrimaryExpression(node);
+ return parseExpressionListParen(node);
}
return false;
@@ -2581,8 +2678,7 @@ bool Parser::parseInitializerClause0x(ExpressionAST *&node)
if (LA() == T_LBRACE)
return parseBracedInitList0x(node);
- parseAssignmentExpression(node);
- return true;
+ return parseAssignmentExpression(node);
}
bool Parser::parseInitializerList0x(ExpressionListAST *&node)
@@ -2650,7 +2746,9 @@ bool Parser::parseMemInitializerList(MemInitializerListAST *&node)
else if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && LA(2) == T_LBRACE)
break;
- else if (LA() == T_COMMA || (LA() == T_IDENTIFIER && (LA(2) == T_LPAREN || LA(2) == T_COLON_COLON))) {
+ else if (LA() == T_COMMA
+ || (LA() == T_IDENTIFIER
+ && (LA(2) == T_LPAREN || LA(2) == T_COLON_COLON || (_cxx0xEnabled && LA(2) == T_LBRACE)))) {
if (LA() != T_COMMA)
error(cursor(), "expected `,'");
else
@@ -2687,9 +2785,18 @@ bool Parser::parseMemInitializer(MemInitializerListAST *&node)
MemInitializerAST *ast = new (_pool) MemInitializerAST;
ast->name = name;
- match(T_LPAREN, &ast->lparen_token);
- parseExpressionList(ast->expression_list);
- match(T_RPAREN, &ast->rparen_token);
+
+ if (LA() == T_LPAREN) {
+ parseExpressionListParen(ast->expression);
+ } else if (_cxx0xEnabled && LA() == T_LBRACE) {
+ parseBracedInitList0x(ast->expression);
+ } else {
+ if (!_cxx0xEnabled)
+ error(cursor(), "expected '('");
+ else
+ error(cursor(), "expected '(' or '{'");
+ return false;
+ }
node = new (_pool) MemInitializerListAST;
node->value = ast;
@@ -2731,12 +2838,9 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
-#ifdef CPLUSPLUS_WITH_CXXOX_INITIALIZER_LIST
if (_cxx0xEnabled)
return parseInitializerList0x(node);
-#endif
- // ### remove me
ExpressionListAST **expression_list_ptr = &node;
ExpressionAST *expression = 0;
if (parseAssignmentExpression(expression)) {
@@ -2846,7 +2950,7 @@ bool Parser::parseUnqualifiedName(NameAST *&node, bool acceptTemplateId)
if (acceptTemplateId && LA(2) == T_LESS) {
bool blocked = blockErrors(true);
if (parseTemplateId(node)
- && (! _templateArguments || (LA() == T_COMMA || LA() == T_GREATER ||
+ && (! _templateArguments || (LA() == T_COMMA || maybeSplitGreaterGreaterToken() || LA() == T_GREATER ||
LA() == T_LPAREN || LA() == T_RPAREN ||
LA() == T_STAR || LA() == T_AMPER || // ptr-operators
LA() == T_COLON_COLON))) {
@@ -3088,7 +3192,10 @@ bool Parser::parseReturnStatement(StatementAST *&node)
if (LA() == T_RETURN) {
ReturnStatementAST *ast = new (_pool) ReturnStatementAST;
ast->return_token = consumeToken();
- parseExpression(ast->expression);
+ if (_cxx0xEnabled && LA() == T_LBRACE)
+ parseBracedInitList0x(ast->expression);
+ else
+ parseExpression(ast->expression);
match(T_SEMICOLON, &ast->semicolon_token);
node = ast;
return true;
@@ -3377,7 +3484,11 @@ bool Parser::parseForStatement(StatementAST *&node)
ast->colon_token = consumeToken();
blockErrors(blocked);
- parseExpression(ast->expression);
+ if (LA() == T_LBRACE) {
+ parseBracedInitList0x(ast->expression);
+ } else {
+ parseExpression(ast->expression);
+ }
match(T_RPAREN, &ast->rparen_token);
parseStatement(ast->statement);
@@ -3755,7 +3866,6 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierListAST *&node)
if (parseExpression(ast->expression))
match(T_RPAREN, &ast->rparen_token);
node = new (_pool) SpecifierListAST(ast);
- skipUntilDeclaration();
return true;
} else if (lookAtBuiltinTypeSpecifier()) {
SimpleSpecifierAST *ast = new (_pool) SimpleSpecifierAST;
@@ -3818,7 +3928,9 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
}
} else if (! has_type_specifier && LA() == T_ENUM) {
unsigned startOfTypeSpecifier = cursor();
- if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr) || LA() == T_LBRACE) {
+ if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)
+ || LA() == T_LBRACE
+ || (_cxx0xEnabled && LA() == T_COLON)) {
rewind(startOfTypeSpecifier);
if (! parseEnumSpecifier(*decl_specifier_seq_ptr)) {
error(startOfTypeSpecifier,
@@ -4599,13 +4711,16 @@ bool Parser::parseTypenameCallExpression(ExpressionAST *&node)
if (LA() == T_TYPENAME) {
unsigned typename_token = consumeToken();
NameAST *name = 0;
- if (parseName(name) && LA() == T_LPAREN) {
+ if (parseName(name)
+ && (LA() == T_LPAREN || (_cxx0xEnabled && LA() == T_LBRACE))) {
TypenameCallExpressionAST *ast = new (_pool) TypenameCallExpressionAST;
ast->typename_token = typename_token;
ast->name = name;
- ast->lparen_token = consumeToken();
- parseExpressionList(ast->expression_list);
- match(T_RPAREN, &ast->rparen_token);
+ if (LA() == T_LPAREN) {
+ parseExpressionListParen(ast->expression);
+ } else { // T_LBRACE
+ parseBracedInitList0x(ast->expression);
+ }
node = ast;
return true;
}
@@ -4658,21 +4773,19 @@ bool Parser::parseCorePostfixExpression(ExpressionAST *&node)
bool blocked = blockErrors(true);
if (lookAtBuiltinTypeSpecifier() &&
parseSimpleTypeSpecifier(type_specifier) &&
- LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionListAST *expression_list = 0;
- parseExpressionList(expression_list);
- if (LA() == T_RPAREN) {
- unsigned rparen_token = consumeToken();
- TypeConstructorCallAST *ast = new (_pool) TypeConstructorCallAST;
- ast->type_specifier_list = type_specifier;
- ast->lparen_token = lparen_token;
- ast->expression_list = expression_list;
- ast->rparen_token = rparen_token;
- node = ast;
- blockErrors(blocked);
- return true;
+ (LA() == T_LPAREN || (_cxx0xEnabled && LA() == T_LBRACE))) {
+ ExpressionAST *expr = 0;
+ if (LA() == T_LPAREN) {
+ parseExpressionListParen(expr);
+ } else { // T_LBRACE
+ parseBracedInitList0x(expr);
}
+ TypeConstructorCallAST *ast = new (_pool) TypeConstructorCallAST;
+ ast->type_specifier_list = type_specifier;
+ ast->expression = expr;
+ node = ast;
+ blockErrors(blocked);
+ return true;
}
rewind(start);
@@ -4722,6 +4835,14 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
match(T_RBRACKET, &ast->rbracket_token);
ast->base_expression = node;
node = ast;
+ } else if (_cxx0xEnabled && LA() == T_LBRACE && node->asIdExpression()) {
+ // this is slightly inconsistent: simple-type-specifier '(' expression-list ')'
+ // gets parsed as a CallAST while simple-type-specifier brace-init-list
+ // is a TypenameCallExpressionAST
+ TypenameCallExpressionAST *ast = new (_pool) TypenameCallExpressionAST;
+ ast->name = node->asIdExpression()->name;
+ parseBracedInitList0x(ast->expression);
+ node = ast;
} else if (LA() == T_PLUS_PLUS || LA() == T_MINUS_MINUS) {
PostIncrDecrAST *ast = new (_pool) PostIncrDecrAST;
ast->incr_decr_token = consumeToken();
@@ -4808,6 +4929,24 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
return true;
}
+ case T_ALIGNOF: {
+ if (!_cxx0xEnabled)
+ break;
+
+ AlignofExpressionAST *ast = new (_pool) AlignofExpressionAST;
+ ast->alignof_token = consumeToken();
+
+ match(T_LPAREN, &ast->lparen_token);
+ ExpressionAST *temp = 0;
+ parseTypeId(temp);
+ if (temp)
+ ast->typeId = temp->asTypeId();
+ match(T_RPAREN, &ast->rparen_token);
+
+ node = ast;
+ return true;
+ }
+
default:
break;
} // switch
@@ -4823,15 +4962,15 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
}
// new-placement ::= T_LPAREN expression-list T_RPAREN
-bool Parser::parseNewPlacement(NewPlacementAST *&node)
+bool Parser::parseExpressionListParen(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_LPAREN) {
unsigned lparen_token = consumeToken();
ExpressionListAST *expression_list = 0;
- if (parseExpressionList(expression_list) && expression_list && LA() == T_RPAREN) {
+ if (parseExpressionList(expression_list) && LA() == T_RPAREN) {
unsigned rparen_token = consumeToken();
- NewPlacementAST *ast = new (_pool) NewPlacementAST;
+ ExpressionListParenAST *ast = new (_pool) ExpressionListParenAST;
ast->lparen_token = lparen_token;
ast->expression_list = expression_list;
ast->rparen_token = rparen_token;
@@ -4843,6 +4982,7 @@ bool Parser::parseNewPlacement(NewPlacementAST *&node)
return false;
}
+
// new-expression ::= T_COLON_COLON? T_NEW new-placement.opt
// new-type-id new-initializer.opt
// new-expression ::= T_COLON_COLON? T_NEW new-placement.opt
@@ -4859,14 +4999,14 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
ast->new_token = consumeToken();
- NewPlacementAST *new_placement = 0;
+ ExpressionAST *parenExpressionList = 0;
- if (parseNewPlacement(new_placement)) {
+ if (parseExpressionListParen(parenExpressionList)) {
unsigned after_new_placement = cursor();
NewTypeIdAST *new_type_id = 0;
if (parseNewTypeId(new_type_id)) {
- ast->new_placement = new_placement;
+ ast->new_placement = parenExpressionList->asExpressionListParen();
ast->new_type_id = new_type_id;
parseNewInitializer(ast->new_initializer);
// recognized new-placement.opt new-type-id new-initializer.opt
@@ -4879,7 +5019,7 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
unsigned lparen_token = consumeToken();
ExpressionAST *type_id = 0;
if (parseTypeId(type_id) && LA() == T_RPAREN) {
- ast->new_placement = new_placement;
+ ast->new_placement = parenExpressionList->asExpressionListParen();
ast->lparen_token = lparen_token;
ast->type_id = type_id;
ast->rparen_token = consumeToken();
@@ -4950,20 +5090,13 @@ bool Parser::parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node)
return true;
}
-bool Parser::parseNewInitializer(NewInitializerAST *&node)
+bool Parser::parseNewInitializer(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionAST *expression = 0;
- if (LA() == T_RPAREN || parseExpression(expression)) {
- NewInitializerAST *ast = new (_pool) NewInitializerAST;
- ast->lparen_token = lparen_token;
- ast->expression = expression;
- match(T_RPAREN, &ast->rparen_token);
- node = ast;
- return true;
- }
+ return parseExpressionListParen(node);
+ } else if (_cxx0xEnabled && LA() == T_LBRACE) {
+ return parseBracedInitList0x(node);
}
return false;
}
@@ -5188,8 +5321,13 @@ void Parser::parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minP
if (operPrecedence <= Prec::Conditional && isCPlusPlus) {
// in C++ you can put a throw in the right-most expression of a conditional expression,
// or an assignment, so some special handling:
- if (!parseAssignmentExpression(rhs))
- return;
+ if (_cxx0xEnabled) {
+ if (!parseInitializerClause0x(rhs))
+ return;
+ } else {
+ if (!parseAssignmentExpression(rhs))
+ return;
+ }
} else {
// for C & all other expressions:
if (!parseCastExpression(rhs))
diff --git a/src/libs/3rdparty/cplusplus/Parser.h b/src/libs/3rdparty/cplusplus/Parser.h
index 406e8f2d69e..f5971e40400 100644
--- a/src/libs/3rdparty/cplusplus/Parser.h
+++ b/src/libs/3rdparty/cplusplus/Parser.h
@@ -82,6 +82,7 @@ public:
bool parseConstantExpression(ExpressionAST *&node);
bool parseCtorInitializer(CtorInitializerAST *&node);
bool parseCvQualifiers(SpecifierListAST *&node);
+ bool parseRefQualifier(unsigned &ref_qualifier);
bool parseOverrideFinalQualifiers(SpecifierListAST *&node);
bool parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list);
bool parseDeclaration(DeclarationAST *&node);
@@ -131,8 +132,8 @@ public:
bool parseNamespaceAliasDefinition(DeclarationAST *&node);
bool parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node);
bool parseNewExpression(ExpressionAST *&node);
- bool parseNewPlacement(NewPlacementAST *&node);
- bool parseNewInitializer(NewInitializerAST *&node);
+ bool parseExpressionListParen(ExpressionAST *&node);
+ bool parseNewInitializer(ExpressionAST *&node);
bool parseNewTypeId(NewTypeIdAST *&node);
bool parseOperator(OperatorAST *&node);
bool parseConversionFunctionId(NameAST *&node);
@@ -189,6 +190,7 @@ public:
bool parseUnqualifiedName(NameAST *&node, bool acceptTemplateId = true);
bool parseUsing(DeclarationAST *&node);
bool parseUsingDirective(DeclarationAST *&node);
+ bool parseAliasDeclaration(DeclarationAST *&node);
bool parseWhileStatement(StatementAST *&node);
void parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minPrecedence);
@@ -254,8 +256,9 @@ public:
void skipUntilDeclaration();
bool skipUntilStatement();
bool skip(int l, int r);
+ int find(int token, int stopAt);
- bool lookAtTypeParameter() const;
+ bool lookAtTypeParameter();
bool lookAtCVQualifier() const;
bool lookAtFunctionSpecifier() const;
bool lookAtStorageClassSpecifier() const;
@@ -273,6 +276,7 @@ public:
int peekAtQtContextKeyword() const;
bool switchTemplateArguments(bool templateArguments);
+ bool maybeSplitGreaterGreaterToken(int n = 1);
bool blockErrors(bool block);
void warning(unsigned index, const char *format, ...);
diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp
index 2ac8075f1c2..e47a405767f 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbols.cpp
@@ -231,12 +231,6 @@ bool Function::isEqualTo(const Type *other) const
return false;
else if (isVolatile() != o->isVolatile())
return false;
-#ifdef ICHECK_BUILD
- else if (isInvokable() != o->isInvokable())
- return false;
- else if (isSignal() != o->isSignal())
- return false;
-#endif
const Name *l = unqualifiedName();
const Name *r = o->unqualifiedName();
@@ -256,37 +250,6 @@ bool Function::isEqualTo(const Type *other) const
return false;
}
-#ifdef ICHECK_BUILD
-bool Function::isEqualTo(const Function* fct, bool ignoreName/* = false*/) const
-{
- if (!ignoreName)
- return isEqualTo((Type*)fct);
-
- if (! fct)
- return false;
- else if (isConst() != fct->isConst())
- return false;
- else if (isVolatile() != fct->isVolatile())
- return false;
- else if (isInvokable() != fct->isInvokable())
- return false;
- else if (isSignal() != fct->isSignal())
- return false;
-
- if (_arguments->symbolCount() != fct->_arguments->symbolCount())
- return false;
- else if (! _returnType.isEqualTo(fct->_returnType))
- return false;
- for (unsigned i = 0; i < _arguments->symbolCount(); ++i) {
- Symbol *l = _arguments->symbolAt(i);
- Symbol *r = fct->_arguments->symbolAt(i);
- if (! l->type().isEqualTo(r->type()))
- return false;
- }
- return true;
-}
-#endif
-
void Function::accept0(TypeVisitor *visitor)
{ visitor->visit(this); }
diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h
index e7fae948925..097a7f7d030 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.h
+++ b/src/libs/3rdparty/cplusplus/Symbols.h
@@ -341,10 +341,6 @@ public:
bool isPureVirtual() const;
void setPureVirtual(bool isPureVirtual);
-#ifdef ICHECK_BUILD
- bool isEqualTo(const Function* fct, bool ignoreName = false) const;
-#endif
-
// Symbol's interface
virtual FullySpecifiedType type() const;
diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp
index dcc18601c21..ed3319aeab0 100644
--- a/src/libs/3rdparty/cplusplus/Token.cpp
+++ b/src/libs/3rdparty/cplusplus/Token.cpp
@@ -46,7 +46,7 @@ static const char *token_names[] = {
("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"),
("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="),
- ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"),
+ ("alignas"), ("alignof"), ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"),
("char"), ("char16_t"), ("char32_t"),
("class"), ("const"), ("const_cast"), ("constexpr"), ("continue"),
("decltype"), ("default"),
diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h
index a89e5522561..3d253151bdc 100644
--- a/src/libs/3rdparty/cplusplus/Token.h
+++ b/src/libs/3rdparty/cplusplus/Token.h
@@ -115,7 +115,9 @@ enum Kind {
T_LAST_OPERATOR = T_TILDE_EQUAL,
T_FIRST_KEYWORD,
- T_ASM = T_FIRST_KEYWORD,
+ T_ALIGNAS = T_FIRST_KEYWORD,
+ T_ALIGNOF,
+ T_ASM,
T_AUTO,
T_BOOL,
T_BREAK,
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
index a26a23eabce..7afef149ef1 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
@@ -552,6 +552,34 @@ unsigned TranslationUnit::findPreviousLineOffset(unsigned tokenIndex) const
return lineOffset;
}
+bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
+{
+ Token &tok = _tokens->at(tokenIndex);
+ if (tok.kind() != T_GREATER_GREATER)
+ return false;
+
+ tok.f.kind = T_GREATER;
+ tok.f.length = 1;
+
+ Token newGreater;
+ newGreater.f.kind = T_GREATER;
+ newGreater.f.expanded = tok.f.expanded;
+ newGreater.f.generated = tok.f.generated;
+ newGreater.f.length = 1;
+ newGreater.offset = tok.offset + 1;
+
+ _tokens->insert(_tokens->begin() + tokenIndex + 1, newGreater);
+
+ std::map<unsigned, std::pair<unsigned, unsigned> >::const_iterator it =
+ _expandedLineColumn.find(tok.offset);
+ if (it != _expandedLineColumn.end()) {
+ const std::pair<unsigned, unsigned> newPosition(it->second.first, it->second.second + 1);
+ _expandedLineColumn.insert(std::make_pair(newGreater.offset, newPosition));
+ }
+
+ return true;
+}
+
void TranslationUnit::showErrorLine(unsigned index, unsigned column, FILE *out)
{
unsigned lineOffset = _lineOffsets[findLineNumber(_tokens->at(index).offset)];
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h
index 95832f43281..f6ac1959dbf 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.h
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h
@@ -134,6 +134,8 @@ public:
unsigned findPreviousLineOffset(unsigned tokenIndex) const;
+ bool maybeSplitGreaterGreaterToken(unsigned tokenIndex);
+
public:
struct PPLine {
unsigned offset;
diff --git a/src/libs/QtcLibrary.qbs b/src/libs/QtcLibrary.qbs
index 1145ddd40e5..3e97e4a59d2 100644
--- a/src/libs/QtcLibrary.qbs
+++ b/src/libs/QtcLibrary.qbs
@@ -1,12 +1,19 @@
import qbs.base 1.0
+import "../../qbs/defaults.js" as Defaults
DynamicLibrary {
Depends { name: "cpp" }
- cpp.defines: project.additionalCppDefines
+ Depends {
+ condition: Defaults.testsEnabled(qbs)
+ name: "Qt.test"
+ }
+
+ cpp.defines: Defaults.defines(qbs)
cpp.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
return ["-Wl,-s"]
}
+ cpp.includePaths: [ "." ]
destination: {
if (qbs.targetOS == "windows")
@@ -14,4 +21,9 @@ DynamicLibrary {
else
return "lib/qtcreator"
}
+
+ ProductModule {
+ Depends { name: "cpp" }
+ cpp.includePaths: [ "." ]
+ }
}
diff --git a/src/libs/aggregation/aggregation.qbs b/src/libs/aggregation/aggregation.qbs
index 1c817669958..a5e8e84d396 100644
--- a/src/libs/aggregation/aggregation.qbs
+++ b/src/libs/aggregation/aggregation.qbs
@@ -4,18 +4,13 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "Aggregation"
- cpp.includePaths: [
- ".",
- ".."
- ]
cpp.defines: base.concat("AGGREGATION_LIBRARY")
-
Depends { name: "cpp" }
Depends { name: "Qt.core" }
files: [
- "aggregation_global.h",
+ "aggregate.cpp",
"aggregate.h",
- "aggregate.cpp"
+ "aggregation_global.h",
]
}
diff --git a/src/libs/cplusplus/Dumpers.cpp b/src/libs/cplusplus/Dumpers.cpp
index c91a5bdbba2..be6dcaa2652 100644
--- a/src/libs/cplusplus/Dumpers.cpp
+++ b/src/libs/cplusplus/Dumpers.cpp
@@ -72,7 +72,7 @@ QString CPlusPlus::toString(const Symbol *s, QString id)
return QString("%0: %1 (%2) at %3:%4:%5\n%6").arg(
id,
QString::fromLatin1(typeid(*s).name()),
- QString::fromUtf8(s->identifier()->chars()),
+ s->identifier() ? QString::fromUtf8(s->identifier()->chars()) : "no id",
QString::fromLatin1(s->fileName()),
QString::number(s->line()),
QString::number(s->column()),
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 8dc0637279c..4353e0b226e 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -535,11 +535,7 @@ void FindUsages::memInitializer(MemInitializerAST *ast)
(void) switchScope(previousScope);
}
}
- // unsigned lparen_token = ast->lparen_token;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- this->expression(it->value);
- }
- // unsigned rparen_token = ast->rparen_token;
+ this->expression(ast->expression);
}
bool FindUsages::visit(NestedNameSpecifierAST *ast)
@@ -558,14 +554,17 @@ void FindUsages::nestedNameSpecifier(NestedNameSpecifierAST *ast)
// unsigned scope_token = ast->scope_token;
}
-bool FindUsages::visit(NewPlacementAST *ast)
+bool FindUsages::visit(ExpressionListParenAST *ast)
{
- (void) ast;
- Q_ASSERT(!"unreachable");
+ // unsigned lparen_token = ast->lparen_token;
+ for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
+ this->expression(it->value);
+ }
+ // unsigned rparen_token = ast->rparen_token;
return false;
}
-void FindUsages::newPlacement(NewPlacementAST *ast)
+void FindUsages::newPlacement(ExpressionListParenAST *ast)
{
if (! ast)
return;
@@ -594,23 +593,6 @@ void FindUsages::newArrayDeclarator(NewArrayDeclaratorAST *ast)
// unsigned rbracket_token = ast->rbracket_token;
}
-bool FindUsages::visit(NewInitializerAST *ast)
-{
- (void) ast;
- Q_ASSERT(!"unreachable");
- return false;
-}
-
-void FindUsages::newInitializer(NewInitializerAST *ast)
-{
- if (! ast)
- return;
-
- // unsigned lparen_token = ast->lparen_token;
- this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
-}
-
bool FindUsages::visit(NewTypeIdAST *ast)
{
(void) ast;
@@ -1025,7 +1007,6 @@ bool FindUsages::visit(RangeBasedForStatementAST *ast)
this->specifier(it->value);
}
this->declarator(ast->declarator);
- this->expression(ast->initializer);
// unsigned comma_token = ast->comma_token;
this->expression(ast->expression);
// unsigned rparen_token = ast->rparen_token;
@@ -1296,7 +1277,7 @@ bool FindUsages::visit(NewExpressionAST *ast)
this->expression(ast->type_id);
// unsigned rparen_token = ast->rparen_token;
this->newTypeId(ast->new_type_id);
- this->newInitializer(ast->new_initializer);
+ this->expression(ast->new_initializer);
return false;
}
@@ -1313,11 +1294,7 @@ bool FindUsages::visit(TypenameCallExpressionAST *ast)
{
// unsigned typename_token = ast->typename_token;
/*const Name *name =*/ this->name(ast->name);
- // unsigned lparen_token = ast->lparen_token;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- this->expression(it->value);
- }
- // unsigned rparen_token = ast->rparen_token;
+ this->expression(ast->expression);
return false;
}
@@ -1326,11 +1303,7 @@ bool FindUsages::visit(TypeConstructorCallAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
this->specifier(it->value);
}
- // unsigned lparen_token = ast->lparen_token;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
- this->expression(it->value);
- }
- // unsigned rparen_token = ast->rparen_token;
+ this->expression(ast->expression);
return false;
}
diff --git a/src/libs/cplusplus/FindUsages.h b/src/libs/cplusplus/FindUsages.h
index 5d4bdeb379e..c4a25ff4de1 100644
--- a/src/libs/cplusplus/FindUsages.h
+++ b/src/libs/cplusplus/FindUsages.h
@@ -103,9 +103,8 @@ protected:
void exceptionSpecification(ExceptionSpecificationAST *ast);
void memInitializer(MemInitializerAST *ast);
void nestedNameSpecifier(NestedNameSpecifierAST *ast);
- void newPlacement(NewPlacementAST *ast);
+ void newPlacement(ExpressionListParenAST *ast);
void newArrayDeclarator(NewArrayDeclaratorAST *ast);
- void newInitializer(NewInitializerAST *ast);
void newTypeId(NewTypeIdAST *ast);
void cppOperator(OperatorAST *ast);
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast);
@@ -136,9 +135,7 @@ protected:
virtual bool visit(DynamicExceptionSpecificationAST *ast);
virtual bool visit(MemInitializerAST *ast);
virtual bool visit(NestedNameSpecifierAST *ast);
- virtual bool visit(NewPlacementAST *ast);
virtual bool visit(NewArrayDeclaratorAST *ast);
- virtual bool visit(NewInitializerAST *ast);
virtual bool visit(NewTypeIdAST *ast);
virtual bool visit(OperatorAST *ast);
virtual bool visit(ParameterDeclarationClauseAST *ast);
@@ -213,6 +210,7 @@ protected:
virtual bool visit(ObjCSelectorExpressionAST *ast);
virtual bool visit(LambdaExpressionAST *ast);
virtual bool visit(BracedInitializerAST *ast);
+ virtual bool visit(ExpressionListParenAST *ast);
// DeclarationAST
virtual bool visit(SimpleDeclarationAST *ast);
diff --git a/src/libs/cplusplus/OverviewModel.cpp b/src/libs/cplusplus/OverviewModel.cpp
index a3bb567cd7c..df537c3854e 100644
--- a/src/libs/cplusplus/OverviewModel.cpp
+++ b/src/libs/cplusplus/OverviewModel.cpp
@@ -238,6 +238,7 @@ Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
void OverviewModel::rebuild(Document::Ptr doc)
{
+ beginResetModel();
_cppDocument = doc;
- reset();
+ endResetModel();
}
diff --git a/src/libs/cplusplus/cplusplus.qbs b/src/libs/cplusplus/cplusplus.qbs
index 6038fc6a2c4..db321ded657 100644
--- a/src/libs/cplusplus/cplusplus.qbs
+++ b/src/libs/cplusplus/cplusplus.qbs
@@ -4,12 +4,7 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "CPlusPlus"
- cpp.includePaths: [
- ".",
- "..",
- "../3rdparty/cplusplus",
- "../../plugins"
- ]
+ cpp.includePaths: base.concat("../3rdparty/cplusplus")
cpp.defines: base.concat([
"NDEBUG",
"CPLUSPLUS_BUILD_LIB"
@@ -22,13 +17,21 @@ QtcLibrary {
Group {
prefix: "../3rdparty/cplusplus/"
files: [
+ "AST.cpp",
+ "AST.h",
+ "ASTClone.cpp",
+ "ASTMatch0.cpp",
+ "ASTMatcher.cpp",
+ "ASTMatcher.h",
"ASTPatternBuilder.cpp",
- "CPlusPlus.h",
- "LiteralTable.cpp",
- "ObjectiveCTypeQualifiers.h",
- "Templates.cpp",
- "Templates.h",
+ "ASTPatternBuilder.h",
+ "ASTVisit.cpp",
"ASTVisitor.cpp",
+ "ASTVisitor.h",
+ "ASTfwd.h",
+ "Bind.cpp",
+ "Bind.h",
+ "CPlusPlus.h",
"Control.cpp",
"Control.h",
"CoreTypes.cpp",
@@ -37,8 +40,12 @@ QtcLibrary {
"DiagnosticClient.h",
"FullySpecifiedType.cpp",
"FullySpecifiedType.h",
+ "Keywords.cpp",
+ "Lexer.cpp",
"Lexer.h",
+ "LiteralTable.cpp",
"LiteralTable.h",
+ "Literals.cpp",
"Literals.h",
"MemoryPool.cpp",
"MemoryPool.h",
@@ -50,48 +57,35 @@ QtcLibrary {
"Names.h",
"ObjectiveCAtKeywords.cpp",
"ObjectiveCTypeQualifiers.cpp",
+ "ObjectiveCTypeQualifiers.h",
+ "Parser.cpp",
+ "Parser.h",
+ "QtContextKeywords.cpp",
+ "QtContextKeywords.h",
"Scope.cpp",
"Scope.h",
+ "Symbol.cpp",
+ "Symbol.h",
"SymbolVisitor.cpp",
"SymbolVisitor.h",
+ "Symbols.cpp",
"Symbols.h",
+ "Templates.cpp",
+ "Templates.h",
+ "Token.cpp",
+ "Token.h",
+ "TranslationUnit.cpp",
+ "TranslationUnit.h",
"Type.cpp",
"Type.h",
"TypeMatcher.cpp",
"TypeMatcher.h",
"TypeVisitor.cpp",
"TypeVisitor.h",
- "AST.cpp",
- "AST.h",
- "ASTClone.cpp",
- "ASTMatch0.cpp",
- "ASTMatcher.cpp",
- "ASTMatcher.h",
- "ASTPatternBuilder.h",
- "ASTVisit.cpp",
- "ASTVisitor.h",
- "ASTfwd.h",
- "Bind.cpp",
- "Bind.h",
- "Keywords.cpp",
- "Lexer.cpp",
- "Literals.cpp",
- "Parser.cpp",
- "Parser.h",
- "QtContextKeywords.cpp",
- "QtContextKeywords.h",
- "Symbol.cpp",
- "Symbol.h",
- "Symbols.cpp",
- "Token.cpp",
- "Token.h",
- "TranslationUnit.cpp",
- "TranslationUnit.h"
]
}
files: [
- "cplusplus.qrc",
"ASTParent.cpp",
"ASTParent.h",
"ASTPath.cpp",
@@ -128,6 +122,8 @@ QtcLibrary {
"Overview.h",
"OverviewModel.cpp",
"OverviewModel.h",
+ "PPToken.cpp",
+ "PPToken.h",
"PreprocessorClient.cpp",
"PreprocessorClient.h",
"PreprocessorEnvironment.cpp",
@@ -144,13 +140,12 @@ QtcLibrary {
"TypeOfExpression.h",
"TypePrettyPrinter.cpp",
"TypePrettyPrinter.h",
+ "cplusplus.qrc",
"findcdbbreakpoint.cpp",
"findcdbbreakpoint.h",
"pp-cctype.h",
"pp-engine.cpp",
"pp-engine.h",
- "PPToken.cpp",
- "PPToken.h",
"pp-scanner.cpp",
"pp-scanner.h",
"pp.h",
@@ -169,7 +164,7 @@ QtcLibrary {
"images/slot_prot.png",
"images/var.png",
"images/var_priv.png",
- "images/var_prot.png"
+ "images/var_prot.png",
]
ProductModule {
@@ -181,4 +176,3 @@ QtcLibrary {
]
}
}
-
diff --git a/src/libs/extensionsystem/extensionsystem.qbs b/src/libs/extensionsystem/extensionsystem.qbs
index bbdd8b74b31..f7a90814cb2 100644
--- a/src/libs/extensionsystem/extensionsystem.qbs
+++ b/src/libs/extensionsystem/extensionsystem.qbs
@@ -4,10 +4,6 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "ExtensionSystem"
- cpp.includePaths: [
- ".",
- ".."
- ]
cpp.defines: base.concat([
"EXTENSIONSYSTEM_LIBRARY",
"IDE_TEST_DIR=\".\""
@@ -18,10 +14,6 @@ QtcLibrary {
Depends { name: "Aggregation" }
files: [
- "plugindetailsview.ui",
- "pluginerrorview.ui",
- "pluginview.qrc",
- "pluginview.ui",
"extensionsystem_global.h",
"invoker.cpp",
"invoker.h",
@@ -34,19 +26,23 @@ QtcLibrary {
"plugincollection.h",
"plugindetailsview.cpp",
"plugindetailsview.h",
+ "plugindetailsview.ui",
"pluginerroroverview.cpp",
"pluginerroroverview.h",
"pluginerroroverview.ui",
"pluginerrorview.cpp",
"pluginerrorview.h",
+ "pluginerrorview.ui",
"pluginmanager.cpp",
"pluginmanager.h",
"pluginmanager_p.h",
+ "pluginspec.cpp",
"pluginspec.h",
"pluginspec_p.h",
"pluginview.cpp",
"pluginview.h",
- "pluginspec.cpp",
+ "pluginview.qrc",
+ "pluginview.ui",
"images/error.png",
"images/notloaded.png",
"images/ok.png",
diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp
index e4aaf4d761b..b718f31965d 100644
--- a/src/libs/extensionsystem/optionsparser.cpp
+++ b/src/libs/extensionsystem/optionsparser.cpp
@@ -72,8 +72,10 @@ bool OptionsParser::parse()
continue;
if (checkForProfilingOption())
continue;
+#ifdef WITH_TESTS
if (checkForTestOption())
continue;
+#endif
if (checkForAppOption())
continue;
if (checkForPluginOption())
diff --git a/src/libs/glsl/glsl.qbs b/src/libs/glsl/glsl.qbs
index 7ee3557673d..0a49bc50db1 100644
--- a/src/libs/glsl/glsl.qbs
+++ b/src/libs/glsl/glsl.qbs
@@ -4,10 +4,6 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "GLSL"
- cpp.includePaths: [
- ".",
- ".."
- ]
cpp.defines: base.concat([
"QT_CREATOR",
"GLSL_BUILD_LIB"
@@ -17,40 +13,35 @@ QtcLibrary {
Depends { name: "Qt.gui" }
files: [
+ "glsl.g",
"glsl.h",
- "glsllexer.h",
- "glslparser.h",
- "glslparsertable_p.h",
+ "glslast.cpp",
"glslast.h",
+ "glslastdump.cpp",
+ "glslastdump.h",
+ "glslastvisitor.cpp",
"glslastvisitor.h",
+ "glslengine.cpp",
"glslengine.h",
- "glslmemorypool.h",
- "glslastdump.h",
- "glslsemantic.h",
- "glsltype.h",
- "glsltypes.h",
- "glslsymbol.h",
- "glslsymbols.h",
"glslkeywords.cpp",
- "glslparser.cpp",
- "glslparsertable.cpp",
"glsllexer.cpp",
- "glslast.cpp",
- "glslastvisitor.cpp",
- "glslengine.cpp",
+ "glsllexer.h",
"glslmemorypool.cpp",
- "glslastdump.cpp",
+ "glslmemorypool.h",
+ "glslparser.cpp",
+ "glslparser.h",
+ "glslparsertable.cpp",
+ "glslparsertable_p.h",
"glslsemantic.cpp",
- "glsltype.cpp",
- "glsltypes.cpp",
+ "glslsemantic.h",
"glslsymbol.cpp",
+ "glslsymbol.h",
"glslsymbols.cpp",
- "glsl.g"
+ "glslsymbols.h",
+ "glsltype.cpp",
+ "glsltype.h",
+ "glsltypes.cpp",
+ "glsltypes.h",
]
-
- ProductModule {
- Depends { name: "cpp" }
- cpp.includePaths: ["."]
- }
}
diff --git a/src/libs/languageutils/languageutils.qbs b/src/libs/languageutils/languageutils.qbs
index abd23f95c86..811c4a96090 100644
--- a/src/libs/languageutils/languageutils.qbs
+++ b/src/libs/languageutils/languageutils.qbs
@@ -4,11 +4,7 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "LanguageUtils"
- cpp.includePaths: [
- ".",
- "..",
- "../3rdparty/cplusplus"
- ]
+ cpp.includePaths: base.concat("../3rdparty/cplusplus")
cpp.defines: base.concat([
"QT_CREATOR",
"LANGUAGEUTILS_BUILD_DIR"
@@ -19,11 +15,11 @@ QtcLibrary {
Depends { name: "Qt.core" }
files: [
- "languageutils_global.h",
- "fakemetaobject.h",
+ "componentversion.cpp",
"componentversion.h",
"fakemetaobject.cpp",
- "componentversion.cpp"
+ "fakemetaobject.h",
+ "languageutils_global.h",
]
}
diff --git a/src/libs/qmldebug/qmldebug.qbs b/src/libs/qmldebug/qmldebug.qbs
index c2e8a40996c..6dbfd8d7768 100644
--- a/src/libs/qmldebug/qmldebug.qbs
+++ b/src/libs/qmldebug/qmldebug.qbs
@@ -4,10 +4,6 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "QmlDebug"
- cpp.includePaths: [
- ".",
- ".."
- ]
cpp.defines: base.concat([
"QMLDEBUG_LIB"
])
@@ -27,28 +23,24 @@ QtcLibrary {
"declarativetoolsclient.h",
"qdebugmessageclient.cpp",
"qdebugmessageclient.h",
+ "qmldebug_global.h",
"qmldebugclient.cpp",
"qmldebugclient.h",
"qmldebugconstants.h",
- "qmldebug_global.h",
+ "qmlenginedebugclient.cpp",
+ "qmlenginedebugclient.h",
"qmloutputparser.cpp",
"qmloutputparser.h",
"qmlprofilereventlocation.h",
"qmlprofilereventtypes.h",
"qmlprofilertraceclient.cpp",
"qmlprofilertraceclient.h",
+ "qmltoolsclient.cpp",
+ "qmltoolsclient.h",
"qpacketprotocol.cpp",
"qpacketprotocol.h",
- "qmlenginedebugclient.h",
"qv8profilerclient.cpp",
"qv8profilerclient.h",
- "qmltoolsclient.cpp",
- "qmltoolsclient.h"
]
-
- ProductModule {
- Depends { name: "cpp" }
- cpp.includePaths: ["."]
- }
}
diff --git a/src/libs/qmleditorwidgets/colorbox.h b/src/libs/qmleditorwidgets/colorbox.h
index cd2ec8bd30a..1dff3be0038 100644
--- a/src/libs/qmleditorwidgets/colorbox.h
+++ b/src/libs/qmleditorwidgets/colorbox.h
@@ -30,7 +30,7 @@
#ifndef COLORBOX_H
#define COLORBOX_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
#include <qdeclarative.h>
diff --git a/src/libs/qmleditorwidgets/colorbutton.h b/src/libs/qmleditorwidgets/colorbutton.h
index dedc3f7411e..4caa377fe48 100644
--- a/src/libs/qmleditorwidgets/colorbutton.h
+++ b/src/libs/qmleditorwidgets/colorbutton.h
@@ -30,7 +30,7 @@
#ifndef COLORBUTTON_H
#define COLORBUTTON_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QToolButton>
#include <qdeclarative.h>
diff --git a/src/libs/qmleditorwidgets/colorwidgets.h b/src/libs/qmleditorwidgets/colorwidgets.h
index c7a210296b7..fdc667d091a 100644
--- a/src/libs/qmleditorwidgets/colorwidgets.h
+++ b/src/libs/qmleditorwidgets/colorwidgets.h
@@ -30,7 +30,7 @@
#ifndef COLORWIDGET_H
#define COLORWIDGET_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
namespace QmlEditorWidgets {
diff --git a/src/libs/qmleditorwidgets/contextpanetextwidget.h b/src/libs/qmleditorwidgets/contextpanetextwidget.h
index a53228329ff..a8611815b2a 100644
--- a/src/libs/qmleditorwidgets/contextpanetextwidget.h
+++ b/src/libs/qmleditorwidgets/contextpanetextwidget.h
@@ -30,7 +30,7 @@
#ifndef CONTEXTPANETEXTWIDGET_H
#define CONTEXTPANETEXTWIDGET_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
diff --git a/src/libs/qmleditorwidgets/contextpanewidget.cpp b/src/libs/qmleditorwidgets/contextpanewidget.cpp
index 4a6fc752ae4..ee885078357 100644
--- a/src/libs/qmleditorwidgets/contextpanewidget.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidget.cpp
@@ -28,6 +28,9 @@
****************************************************************************/
#include "contextpanewidget.h"
+
+#include <utils/hostosinfo.h>
+
#include <QToolButton>
#include <QFontComboBox>
#include <QComboBox>
@@ -48,6 +51,8 @@
#include "customcolordialog.h"
#include "colorbutton.h"
+using namespace Utils;
+
namespace QmlEditorWidgets {
/* XPM */
@@ -101,12 +106,12 @@ DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- m_dropShadowEffect = new QGraphicsDropShadowEffect;
- m_dropShadowEffect->setBlurRadius(6);
- m_dropShadowEffect->setOffset(2, 2);
- setGraphicsEffect(m_dropShadowEffect);
-#endif
+ if (!HostOsInfo::isMacHost()) {
+ m_dropShadowEffect = new QGraphicsDropShadowEffect;
+ m_dropShadowEffect->setBlurRadius(6);
+ m_dropShadowEffect->setOffset(2, 2);
+ setGraphicsEffect(m_dropShadowEffect);
+ }
}
void DragWidget::mousePressEvent(QMouseEvent * event)
@@ -126,12 +131,12 @@ void DragWidget::mouseReleaseEvent(QMouseEvent *event)
m_startPos = QPoint(-1, -1);
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- m_dropShadowEffect = new QGraphicsDropShadowEffect;
- m_dropShadowEffect->setBlurRadius(6);
- m_dropShadowEffect->setOffset(2, 2);
- setGraphicsEffect(m_dropShadowEffect);
-#endif
+ if (!HostOsInfo::isMacHost()) {
+ m_dropShadowEffect = new QGraphicsDropShadowEffect;
+ m_dropShadowEffect->setBlurRadius(6);
+ m_dropShadowEffect->setOffset(2, 2);
+ setGraphicsEffect(m_dropShadowEffect);
+ }
}
QFrame::mouseReleaseEvent(event);
}
@@ -176,16 +181,14 @@ void DragWidget::protectedMoved()
void DragWidget::leaveEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- unsetCursor();
-#endif
+ if (HostOsInfo::isMacHost())
+ unsetCursor();
}
void DragWidget::enterEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- setCursor(Qt::ArrowCursor);
-#endif
+ if (HostOsInfo::isMacHost())
+ setCursor(Qt::ArrowCursor);
}
ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
@@ -231,9 +234,8 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false;
-#ifdef Q_OS_MAC
- setCursor(Qt::ArrowCursor);
-#endif
+ if (HostOsInfo::isMacHost())
+ setCursor(Qt::ArrowCursor);
}
ContextPaneWidget::~ContextPaneWidget()
@@ -241,7 +243,7 @@ ContextPaneWidget::~ContextPaneWidget()
//if the pane was never activated the widget is not in a widget tree
if (!m_bauhausColorDialog.isNull())
delete m_bauhausColorDialog.data();
- m_bauhausColorDialog.clear();
+ m_bauhausColorDialog = 0;
}
void ContextPaneWidget::activate(const QPoint &pos, const QPoint &alternative, const QPoint &alternative2, bool pinned)
diff --git a/src/libs/qmleditorwidgets/contextpanewidget.h b/src/libs/qmleditorwidgets/contextpanewidget.h
index ce6d2f900be..3fffe1a1b77 100644
--- a/src/libs/qmleditorwidgets/contextpanewidget.h
+++ b/src/libs/qmleditorwidgets/contextpanewidget.h
@@ -30,9 +30,9 @@
#ifndef CONTEXTPANEWIDGET_H
#define CONTEXTPANEWIDGET_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QFrame>
-#include <QWeakPointer>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QToolButton;
@@ -75,7 +75,7 @@ private:
QGraphicsDropShadowEffect *m_dropShadowEffect;
QGraphicsOpacityEffect *m_opacityEffect;
QPoint m_startPos;
- QWeakPointer<QWidget> m_secondaryTarget;
+ QPointer<QWidget> m_secondaryTarget;
};
class QMLEDITORWIDGETS_EXPORT ContextPaneWidget : public DragWidget
@@ -137,9 +137,9 @@ private:
ContextPaneWidgetImage *m_imageWidget;
ContextPaneWidgetImage *m_borderImageWidget;
ContextPaneWidgetRectangle *m_rectangleWidget;
- QWeakPointer<CustomColorDialog> m_bauhausColorDialog;
- QWeakPointer<QAction> m_resetAction;
- QWeakPointer<QAction> m_disableAction;
+ QPointer<CustomColorDialog> m_bauhausColorDialog;
+ QPointer<QAction> m_resetAction;
+ QPointer<QAction> m_disableAction;
QString m_colorName;
QPoint m_originalPos;
bool m_pinned;
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
index 5758e7384f2..bab194ef89b 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
@@ -28,6 +28,9 @@
****************************************************************************/
#include "contextpanewidgetimage.h"
+
+#include <utils/hostosinfo.h>
+
#include "ui_contextpanewidgetimage.h"
#include "ui_contextpanewidgetborderimage.h"
#include <qmljs/qmljspropertyreader.h>
@@ -610,12 +613,12 @@ PreviewLabel::PreviewLabel(QWidget *parent)
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
- dropShadowEffect->setBlurRadius(4);
- dropShadowEffect->setOffset(2, 2);
- m_hooverInfo->setGraphicsEffect(dropShadowEffect);
-#endif
+ if (!Utils::HostOsInfo::isMacHost()) {
+ QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
+ dropShadowEffect->setBlurRadius(4);
+ dropShadowEffect->setOffset(2, 2);
+ m_hooverInfo->setGraphicsEffect(dropShadowEffect);
+ }
m_hooverInfo->setAutoFillBackground(true);
m_hooverInfo->raise();
}
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.h b/src/libs/qmleditorwidgets/contextpanewidgetimage.h
index 9f057ea6297..39df5fa38d7 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetimage.h
+++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.h
@@ -30,11 +30,13 @@
#ifndef CONTEXTPANEWIDGETIMAGE_H
#define CONTEXTPANEWIDGETIMAGE_H
-#include <qmleditorwidgets_global.h>
-#include <QLabel>
-#include <contextpanewidget.h>
+#include "qmleditorwidgets_global.h"
+#include "contextpanewidget.h"
#include <qdrawutil.h>
+#include <QLabel>
+#include <QPointer>
+
QT_BEGIN_NAMESPACE
namespace Ui {
class ContextPaneWidgetImage;
@@ -156,7 +158,7 @@ private:
Ui::ContextPaneWidgetImage *ui;
Ui::ContextPaneWidgetBorderImage *uiBorderImage;
QString m_path;
- QWeakPointer<PreviewDialog> m_previewDialog;
+ QPointer<PreviewDialog> m_previewDialog;
FileWidget *m_fileWidget;
QLabel *m_sizeLabel;
bool m_borderImage;
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
index c881647f381..02c14929244 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
+++ b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
@@ -30,7 +30,7 @@
#ifndef CONTEXTPANEWIDGETRECTANGLE_H
#define CONTEXTPANEWIDGETRECTANGLE_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
diff --git a/src/libs/qmleditorwidgets/customcolordialog.cpp b/src/libs/qmleditorwidgets/customcolordialog.cpp
index e727a67cb76..195de19d8a1 100644
--- a/src/libs/qmleditorwidgets/customcolordialog.cpp
+++ b/src/libs/qmleditorwidgets/customcolordialog.cpp
@@ -31,6 +31,8 @@
#include "huecontrol.h"
#include "colorbox.h"
+#include <utils/hostosinfo.h>
+
#include <QHBoxLayout>
#include <QLabel>
#include <QPainter>
@@ -40,6 +42,8 @@
#include <QDialogButtonBox>
#include <QGraphicsEffect>
+using namespace Utils;
+
namespace QmlEditorWidgets {
CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
@@ -51,12 +55,12 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
- dropShadowEffect->setBlurRadius(6);
- dropShadowEffect->setOffset(2, 2);
- setGraphicsEffect(dropShadowEffect);
-#endif
+ if (!HostOsInfo::isMacHost()) {
+ QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
+ dropShadowEffect->setBlurRadius(6);
+ dropShadowEffect->setOffset(2, 2);
+ setGraphicsEffect(dropShadowEffect);
+ }
setAutoFillBackground(true);
m_hueControl = new HueControl(this);
@@ -183,16 +187,14 @@ void CustomColorDialog::setupWidgets()
void CustomColorDialog::leaveEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- unsetCursor();
-#endif
+ if (HostOsInfo::isMacHost())
+ unsetCursor();
}
void CustomColorDialog::enterEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- setCursor(Qt::ArrowCursor);
-#endif
+ if (HostOsInfo::isMacHost())
+ setCursor(Qt::ArrowCursor);
}
diff --git a/src/libs/qmleditorwidgets/customcolordialog.h b/src/libs/qmleditorwidgets/customcolordialog.h
index 55fe43d1f0d..24acc341fe4 100644
--- a/src/libs/qmleditorwidgets/customcolordialog.h
+++ b/src/libs/qmleditorwidgets/customcolordialog.h
@@ -30,7 +30,7 @@
#ifndef CUSTOMCOLORDIALOG_H
#define CUSTOMCOLORDIALOG_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QFrame>
QT_BEGIN_NAMESPACE
diff --git a/src/libs/qmleditorwidgets/filewidget.h b/src/libs/qmleditorwidgets/filewidget.h
index 9aa917e5406..2c30ce1ceb7 100644
--- a/src/libs/qmleditorwidgets/filewidget.h
+++ b/src/libs/qmleditorwidgets/filewidget.h
@@ -31,7 +31,7 @@
#ifndef FILEWIDGET_H
#define FILEWIDGET_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
diff --git a/src/libs/qmleditorwidgets/fontsizespinbox.h b/src/libs/qmleditorwidgets/fontsizespinbox.h
index a82291ffc69..c494b9405b9 100644
--- a/src/libs/qmleditorwidgets/fontsizespinbox.h
+++ b/src/libs/qmleditorwidgets/fontsizespinbox.h
@@ -30,7 +30,7 @@
#ifndef FONTSIZESPINBOX_H
#define FONTSIZESPINBOX_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QAbstractSpinBox>
namespace QmlEditorWidgets {
diff --git a/src/libs/qmleditorwidgets/gradientline.h b/src/libs/qmleditorwidgets/gradientline.h
index 433373f205e..247f8fbe7f1 100644
--- a/src/libs/qmleditorwidgets/gradientline.h
+++ b/src/libs/qmleditorwidgets/gradientline.h
@@ -30,7 +30,7 @@
#ifndef GRADIENTLINE_H
#define GRADIENTLINE_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
#include <QLinearGradient>
diff --git a/src/libs/qmleditorwidgets/huecontrol.h b/src/libs/qmleditorwidgets/huecontrol.h
index b4323c2a39b..f9e6d1d88eb 100644
--- a/src/libs/qmleditorwidgets/huecontrol.h
+++ b/src/libs/qmleditorwidgets/huecontrol.h
@@ -30,7 +30,7 @@
#ifndef HUECONTROL_H
#define HUECONTROL_H
-#include <qmleditorwidgets_global.h>
+#include "qmleditorwidgets_global.h"
#include <QWidget>
#include <qdeclarative.h>
diff --git a/src/libs/qmleditorwidgets/qmleditorwidgets.pro b/src/libs/qmleditorwidgets/qmleditorwidgets.pro
index c449baac719..99eced93756 100644
--- a/src/libs/qmleditorwidgets/qmleditorwidgets.pro
+++ b/src/libs/qmleditorwidgets/qmleditorwidgets.pro
@@ -7,5 +7,6 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
include(../../qtcreatorlibrary.pri)
include(../qmljs/qmljs.pri)
+include(../utils/utils.pri)
include(qmleditorwidgets-lib.pri)
diff --git a/src/libs/qmleditorwidgets/qmleditorwidgets.qbs b/src/libs/qmleditorwidgets/qmleditorwidgets.qbs
index 7310ed8d037..8f8e1808afb 100644
--- a/src/libs/qmleditorwidgets/qmleditorwidgets.qbs
+++ b/src/libs/qmleditorwidgets/qmleditorwidgets.qbs
@@ -4,11 +4,7 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "QmlEditorWidgets"
- cpp.includePaths: [
- ".",
- "..",
- "easingpane"
- ]
+ cpp.includePaths: base.concat("easingpane")
cpp.defines: base.concat([
"QWEAKPOINTER_ENABLE_ARROW",
"BUILD_QMLEDITORWIDGETS_LIB",
@@ -19,49 +15,45 @@ QtcLibrary {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "quick1", "script"] }
Depends { name: "QmlJS" }
+ Depends { name: "Utils" }
files: [
- "resources.qrc",
- "fontsizespinbox.h",
- "filewidget.h",
- "contextpanewidgetrectangle.h",
- "contextpanewidgetimage.h",
- "contextpanewidget.h",
- "contextpanetextwidget.h",
- "colorwidgets.h",
- "colorbutton.h",
+ "colorbox.cpp",
"colorbox.h",
+ "colorbutton.cpp",
+ "colorbutton.h",
+ "colorwidgets.cpp",
+ "colorwidgets.h",
+ "contextpanetext.ui",
+ "contextpanetextwidget.cpp",
+ "contextpanetextwidget.h",
+ "contextpanewidget.cpp",
+ "contextpanewidget.h",
+ "contextpanewidgetborderimage.ui",
+ "contextpanewidgetimage.cpp",
+ "contextpanewidgetimage.h",
+ "contextpanewidgetimage.ui",
+ "contextpanewidgetrectangle.cpp",
+ "contextpanewidgetrectangle.h",
+ "contextpanewidgetrectangle.ui",
+ "customcolordialog.cpp",
"customcolordialog.h",
+ "filewidget.cpp",
+ "filewidget.h",
+ "fontsizespinbox.cpp",
+ "fontsizespinbox.h",
+ "gradientline.cpp",
"gradientline.h",
+ "huecontrol.cpp",
"huecontrol.h",
"qmleditorwidgets_global.h",
- "fontsizespinbox.cpp",
- "filewidget.cpp",
- "contextpanewidgetrectangle.cpp",
- "contextpanewidgetimage.cpp",
- "contextpanewidget.cpp",
- "contextpanetextwidget.cpp",
- "colorwidgets.cpp",
- "colorbox.cpp",
- "customcolordialog.cpp",
- "huecontrol.cpp",
- "gradientline.cpp",
- "colorbutton.cpp",
- "contextpanewidgetrectangle.ui",
- "contextpanewidgetimage.ui",
- "contextpanewidgetborderimage.ui",
- "contextpanetext.ui",
- "easingpane/easinggraph.cpp",
+ "resources.qrc",
"easingpane/easingcontextpane.cpp",
- "easingpane/easinggraph.h",
"easingpane/easingcontextpane.h",
+ "easingpane/easingcontextpane.ui",
+ "easingpane/easinggraph.cpp",
+ "easingpane/easinggraph.h",
"easingpane/easingpane.qrc",
- "easingpane/easingcontextpane.ui"
]
-
- ProductModule {
- Depends { name: "cpp" }
- cpp.includePaths: ["."]
- }
}
diff --git a/src/libs/qmljs/parser/gen-parser.sh b/src/libs/qmljs/parser/gen-parser.sh
index 1a755052e91..e6fdadf6757 100755
--- a/src/libs/qmljs/parser/gen-parser.sh
+++ b/src/libs/qmljs/parser/gen-parser.sh
@@ -1,5 +1,15 @@
#!/bin/bash
+# This is the script that generates the copy of the QmlJS parser from the sources
+# in the qtdeclarative source tree.
+#
+# It applies a bunch of renames to make the source compatible with the Qt Creator
+# sources as well as rewrites of the licenses.
+#
+# Example:
+# cd src/libs/qmljs/parser
+# QTDIR=~/path/to/qtdeclarative-checkout ./gen-parser.sh
+
me=$(dirname $0)
for i in $QTDIR/src/qml/qml/parser/*.{g,h,cpp,pri}; do
diff --git a/src/libs/qmljs/qmljs.qbs b/src/libs/qmljs/qmljs.qbs
index d7b556b06bd..6a4e8b0c21e 100644
--- a/src/libs/qmljs/qmljs.qbs
+++ b/src/libs/qmljs/qmljs.qbs
@@ -4,11 +4,7 @@ import "../QtcLibrary.qbs" as QtcLibrary
QtcLibrary {
name: "QmlJS"
- cpp.includePaths: [
- ".",
- "..",
- "parser"
- ]
+ cpp.includePaths: base.concat("parser")
cpp.defines: base.concat([
"QMLJS_BUILD_DIR",
"QT_CREATOR"
@@ -21,6 +17,8 @@ QtcLibrary {
Depends { name: "Qt"; submodules: ["widgets", "script"] }
files: [
+ "jsoncheck.cpp",
+ "jsoncheck.h",
"qmljs.qrc",
"qmljs_global.h",
"qmljsbind.cpp",
@@ -55,6 +53,7 @@ QtcLibrary {
"qmljspropertyreader.cpp",
"qmljspropertyreader.h",
"qmljsreformatter.cpp",
+ "qmljsreformatter.h",
"qmljsrewriter.cpp",
"qmljsrewriter.h",
"qmljsscanner.cpp",
@@ -73,9 +72,6 @@ QtcLibrary {
"qmljsutils.h",
"qmljsvalueowner.cpp",
"qmljsvalueowner.h",
- "qmljsreformatter.h",
- "jsoncheck.cpp",
- "jsoncheck.h",
"images/element.png",
"images/func.png",
"images/property.png",
@@ -99,16 +95,12 @@ QtcLibrary {
"parser/qmljslexer_p.h",
"parser/qmljsmemorypool_p.h",
"parser/qmljsparser.cpp",
- "parser/qmljsparser_p.h"
+ "parser/qmljsparser_p.h",
]
ProductModule {
Depends { name: "cpp" }
Depends { name: "LanguageUtils" }
- cpp.includePaths: [
- ".",
- "parser"
- ]
cpp.defines: [
"QT_CREATOR"
]
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index 1f46e4c58f4..0fe58a6d155 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -502,8 +502,44 @@ private:
bool _seenNonDeclarationStatement;
};
+class VisualAspectsPropertyBlackList : public QStringList
+{
+public:
+ VisualAspectsPropertyBlackList()
+ {
+ (*this) << QLatin1String("x") << QLatin1String("y") << QLatin1String("z")
+ << QLatin1String("width") << QLatin1String("height") << QLatin1String("color")
+ << QLatin1String("opacity") << QLatin1String("scale")
+ << QLatin1String("rotation") << QLatin1String("margins")
+ << QLatin1String("verticalCenterOffset") << QLatin1String("horizontalCenterOffset")
+ << QLatin1String("baselineOffset") << QLatin1String("bottomMargin")
+ << QLatin1String("topMargin") << QLatin1String("leftMargin")
+ << QLatin1String("rightMargin") << QLatin1String("baseline")
+ << QLatin1String("centerIn") << QLatin1String("fill")
+ << QLatin1String("left") << QLatin1String("right")
+ << QLatin1String("mirrored") << QLatin1String("verticalCenter")
+ << QLatin1String("horizontalCenter");
+
+ }
+};
+
+class UnsupportedTypesByVisualDesigner : public QStringList
+{
+public:
+ UnsupportedTypesByVisualDesigner()
+ {
+ (*this) << QLatin1String("Transform") << QLatin1String("Timer")
+ << QLatin1String("Rotation") << QLatin1String("Scale")
+ << QLatin1String("Translate") << QLatin1String("Package")
+ << QLatin1String("Particles");
+ }
+
+};
} // end of anonymous namespace
+Q_GLOBAL_STATIC(VisualAspectsPropertyBlackList, visualAspectsPropertyBlackList)
+Q_GLOBAL_STATIC(UnsupportedTypesByVisualDesigner, unsupportedTypesByVisualDesigner)
+
Check::Check(Document::Ptr doc, const ContextPtr &context)
: _doc(doc)
, _context(context)
@@ -523,6 +559,11 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
disableMessage(HintBinaryOperatorSpacing);
disableMessage(HintOneStatementPerLine);
disableMessage(HintExtraParentheses);
+ disableMessage(WarnImperativeCodeNotEditableInVisualDesigner);
+ disableMessage(WarnUnsupportedTypeInVisualDesigner);
+ disableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner);
+ disableMessage(WarnUndefinedValueForVisualDesigner);
+ disableMessage(WarnStatesOnlyInRootItemForVisualDesigner);
}
Check::~Check()
@@ -568,21 +609,28 @@ bool Check::visit(UiProgram *)
bool Check::visit(UiObjectInitializer *)
{
+ QString typeName;
m_propertyStack.push(StringSet());
- UiObjectDefinition *objectDefinition = cast<UiObjectDefinition *>(parent());
- if (objectDefinition && objectDefinition->qualifiedTypeNameId->name == "Component")
- m_idStack.push(StringSet());
- UiObjectBinding *objectBinding = cast<UiObjectBinding *>(parent());
- if (objectBinding && objectBinding->qualifiedTypeNameId->name == "Component")
- m_idStack.push(StringSet());
+ UiQualifiedId *qualifiedTypeId = qualifiedTypeNameId(parent());
+ if (qualifiedTypeId) {
+ typeName = qualifiedTypeId->name.toString();
+ if (typeName == QLatin1String("Component"))
+ m_idStack.push(StringSet());
+ }
+
+ if (!typeName.isEmpty() && typeName.at(0).isUpper())
+ m_typeStack.push(typeName);
+
if (m_idStack.isEmpty())
m_idStack.push(StringSet());
+
return true;
}
void Check::endVisit(UiObjectInitializer *)
{
m_propertyStack.pop();
+ m_typeStack.pop();
UiObjectDefinition *objectDenition = cast<UiObjectDefinition *>(parent());
if (objectDenition && objectDenition->qualifiedTypeNameId->name == "Component")
m_idStack.pop();
@@ -618,6 +666,57 @@ bool Check::visit(UiObjectBinding *ast)
return false;
}
+static bool expressionAffectsVisualAspects(BinaryExpression *expression)
+{
+ if (expression->op == QSOperator::Assign
+ || expression->op == QSOperator::InplaceSub
+ || expression->op == QSOperator::InplaceAdd
+ || expression->op == QSOperator::InplaceDiv
+ || expression->op == QSOperator::InplaceMul
+ || expression->op == QSOperator::InplaceOr
+ || expression->op == QSOperator::InplaceXor
+ || expression->op == QSOperator::InplaceAnd) {
+
+ const ExpressionNode *lhsValue = expression->left;
+
+ if (const IdentifierExpression* identifierExpression = cast<const IdentifierExpression *>(lhsValue)) {
+ if (visualAspectsPropertyBlackList()->contains(identifierExpression->name.toString()))
+ return true;
+ } else if (const FieldMemberExpression* fieldMemberExpression = cast<const FieldMemberExpression *>(lhsValue)) {
+ if (visualAspectsPropertyBlackList()->contains(fieldMemberExpression->name.toString()))
+ return true;
+ }
+ }
+ return false;
+}
+
+static UiQualifiedId *getRightMostIdentifier(UiQualifiedId *typeId)
+{
+ if (typeId->next)
+ return getRightMostIdentifier(typeId->next);
+
+ return typeId;
+}
+
+static bool checkTypeForDesignerSupport(UiQualifiedId *typeId)
+{
+ return unsupportedTypesByVisualDesigner()->contains(getRightMostIdentifier(typeId)->name.toString());
+}
+
+static bool checkTopLevelBindingForParentReference(ExpressionStatement *expStmt, const QString &source)
+{
+ if (!expStmt)
+ return false;
+
+ SourceLocation location = locationFromRange(expStmt->firstSourceLocation(), expStmt->lastSourceLocation());
+ QString stmtSource = source.mid(location.begin(), location.length);
+
+ if (stmtSource.contains(QRegExp("(^|\\W)parent\\.")))
+ return true;
+
+ return false;
+}
+
void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
UiObjectInitializer *initializer)
{
@@ -629,9 +728,16 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
return;
}
+ const SourceLocation typeErrorLocation = fullLocationForQualifiedId(typeId);
+
+ if (checkTypeForDesignerSupport(typeId))
+ addMessage(WarnUnsupportedTypeInVisualDesigner, typeErrorLocation);
+
+ if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State"))
+ addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation);
+
bool typeError = false;
if (_importsOk) {
- const SourceLocation typeErrorLocation = fullLocationForQualifiedId(typeId);
const ObjectValue *prototype = _context->lookupType(_doc.data(), typeId);
if (!prototype) {
typeError = true;
@@ -711,6 +817,13 @@ bool Check::visit(UiScriptBinding *ast)
m_idStack.top().insert(id);
}
+ if (m_typeStack.count() == 1
+ && visualAspectsPropertyBlackList()->contains(ast->qualifiedId->name.toString())
+ && checkTopLevelBindingForParentReference(cast<ExpressionStatement *>(ast->statement), _doc->source())) {
+ addMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner,
+ locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()));
+ }
+
checkProperty(ast->qualifiedId);
if (!ast->statement)
@@ -721,6 +834,12 @@ bool Check::visit(UiScriptBinding *ast)
Evaluate evaluator(&_scopeChain);
const Value *rhsValue = evaluator(ast->statement);
+ if (visualAspectsPropertyBlackList()->contains(ast->qualifiedId->name.toString()) &&
+ rhsValue->asUndefinedValue()) {
+ addMessage(WarnUndefinedValueForVisualDesigner,
+ locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()));
+ }
+
const SourceLocation loc = locationFromRange(ast->statement->firstSourceLocation(),
ast->statement->lastSourceLocation());
AssignmentCheck assignmentCheck;
@@ -910,6 +1029,11 @@ bool Check::visit(BinaryExpression *ast)
addMessage(HintBinaryOperatorSpacing, op);
}
+ SourceLocation expressionSourceLocation = locationFromRange(ast->firstSourceLocation(),
+ ast->lastSourceLocation());
+ if (expressionAffectsVisualAspects(ast))
+ addMessage(WarnImperativeCodeNotEditableInVisualDesigner, expressionSourceLocation);
+
// check ==, !=
if (ast->op == QSOperator::Equal || ast->op == QSOperator::NotEqual) {
Evaluate eval(&_scopeChain);
diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h
index e39493cf3c5..9cdb0df1ad5 100644
--- a/src/libs/qmljs/qmljscheck.h
+++ b/src/libs/qmljs/qmljscheck.h
@@ -132,6 +132,7 @@ private:
QList<AST::Node *> _chain;
QStack<StringSet> m_idStack;
QStack<StringSet> m_propertyStack;
+ QStack<QString> m_typeStack;
class MessageTypeAndSuppression
{
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 1ab8d8d7a91..0c7126582f2 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -1357,7 +1357,8 @@ template void CppQmlTypes::load< QHash<QString, FakeMetaObject::ConstPtr> >(cons
QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QString &package, ComponentVersion version)
{
- QList<const CppComponentValue *> exportedObjects;
+ QHash<QString, const CppComponentValue *> exportedObjects;
+
QList<const CppComponentValue *> newObjects;
// make new exported objects
@@ -1397,8 +1398,11 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri
// use package.cppname importversion as key
_objectsByQualifiedName.insert(key, newComponent);
- if (exported)
- exportedObjects += newComponent;
+ if (exported) {
+ if (!exportedObjects.contains(name) // we might have the same type in different versions
+ || (newComponent->componentVersion() > exportedObjects.value(name)->componentVersion()))
+ exportedObjects.insert(name, newComponent);
+ }
newObjects += newComponent;
}
}
@@ -1436,7 +1440,7 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri
}
}
- return exportedObjects;
+ return exportedObjects.values();
}
bool CppQmlTypes::hasModule(const QString &module) const
diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp
index bd0a79e79df..8da87b317e4 100644
--- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp
+++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp
@@ -214,6 +214,17 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("maximum string value length is %1"), 1);
newMsg(ErrInvalidArrayValueLength, Error,
tr("%1 elements expected in array value"), 1);
+ newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Warning,
+ tr("Imperative code is not supported in the Qt Quick Designer"));
+ newMsg(WarnUnsupportedTypeInVisualDesigner, Warning,
+ tr("This type is not supported in the Qt Quick Designer"));
+ newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Warning,
+ tr("Reference to parent item cannot be resolved correctly by the Qt Quick Designer"));
+ newMsg(WarnUndefinedValueForVisualDesigner, Warning,
+ tr("This visual property binding cannot be evaluted in the local context "
+ "and might not show up in Qt Quick Designer as expected"));
+ newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning,
+ tr("Qt Quick Designer only supports states in the root item "));
}
} // anonymous namespace
diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h
index b1f5999775b..6b40ebfb017 100644
--- a/src/libs/qmljs/qmljsstaticanalysismessage.h
+++ b/src/libs/qmljs/qmljsstaticanalysismessage.h
@@ -100,6 +100,11 @@ enum Type
WarnConfusingExpressionStatement = 127,
HintDeclarationsShouldBeAtStartOfFunction = 201,
HintOneStatementPerLine = 202,
+ WarnImperativeCodeNotEditableInVisualDesigner = 203,
+ WarnUnsupportedTypeInVisualDesigner = 204,
+ WarnReferenceToParentItemNotSupportedByVisualDesigner = 205,
+ WarnUndefinedValueForVisualDesigner = 206,
+ WarnStatesOnlyInRootItemForVisualDesigner = 207,
ErrUnknownComponent = 300,
ErrCouldNotResolvePrototypeOf = 301,
ErrCouldNotResolvePrototype = 302,
diff --git a/src/libs/qtcomponents/styleitem/styleitem.qbs b/src/libs/qtcomponents/styleitem/styleitem.qbs
index e4e8d45e365..f633b59c47c 100644
--- a/src/libs/qtcomponents/styleitem/styleitem.qbs
+++ b/src/libs/qtcomponents/styleitem/styleitem.qbs
@@ -1,4 +1,5 @@
import qbs.base 1.0
+import "../../../../qbs/defaults.js" as Defaults
DynamicLibrary {
name: "styleplugin"
@@ -7,7 +8,7 @@ DynamicLibrary {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core", "widgets", "quick1", "script"] }
- cpp.defines: project.additionalCppDefines
+ cpp.defines: Defaults.defines(qbs)
files: [
"qdeclarativefolderlistmodel.cpp",
@@ -26,7 +27,7 @@ DynamicLibrary {
"qtmenuitem.cpp",
"qtmenuitem.h",
"qwheelarea.cpp",
- "qwheelarea.h"
+ "qwheelarea.h",
]
}
diff --git a/src/libs/ssh/sftpchannel_p.h b/src/libs/ssh/sftpchannel_p.h
index f3a46189f13..482f82753a6 100644
--- a/src/libs/ssh/sftpchannel_p.h
+++ b/src/libs/ssh/sftpchannel_p.h
@@ -48,14 +48,8 @@ class SftpChannelPrivate : public AbstractSshChannel
Q_OBJECT
friend class QSsh::SftpChannel;
public:
-
enum SftpState { Inactive, SubsystemRequested, InitSent, Initialized };
- virtual void handleChannelSuccess();
- virtual void handleChannelFailure();
-
- virtual void closeHook();
-
signals:
void initialized();
void initializationFailed(const QString &reason);
@@ -71,6 +65,9 @@ private:
SftpChannel *sftp);
SftpJobId createJob(const AbstractSftpOperation::Ptr &job);
+ virtual void handleChannelSuccess();
+ virtual void handleChannelFailure();
+
virtual void handleOpenSuccessInternal();
virtual void handleOpenFailureInternal(const QString &reason);
virtual void handleChannelDataInternal(const QByteArray &data);
@@ -79,6 +76,8 @@ private:
virtual void handleExitStatus(const SshChannelExitStatus &exitStatus);
virtual void handleExitSignal(const SshChannelExitSignal &signal);
+ virtual void closeHook();
+
void handleCurrentPacket();
void handleServerVersion();
void handleHandle();
diff --git a/src/libs/ssh/ssh.pro b/src/libs/ssh/ssh.pro
index 2df5b0430b0..3b4ce049627 100644
--- a/src/libs/ssh/ssh.pro
+++ b/src/libs/ssh/ssh.pro
@@ -29,7 +29,8 @@ SOURCES = $$PWD/sshsendfacility.cpp \
$$PWD/sshconnectionmanager.cpp \
$$PWD/sshkeypasswordretriever.cpp \
$$PWD/sftpfilesystemmodel.cpp \
- $$PWD/sshkeycreationdialog.cpp
+ $$PWD/sshkeycreationdialog.cpp \
+ $$PWD/sshdirecttcpiptunnel.cpp
HEADERS = $$PWD/sshsendfacility_p.h \
$$PWD/sshremoteprocess.h \
@@ -62,6 +63,8 @@ HEADERS = $$PWD/sshsendfacility_p.h \
$$PWD/sshkeypasswordretriever_p.h \
$$PWD/sftpfilesystemmodel.h \
$$PWD/sshkeycreationdialog.h \
- $$PWD/ssh_global.h
+ $$PWD/ssh_global.h \
+ $$PWD/sshdirecttcpiptunnel_p.h \
+ $$PWD/sshdirecttcpiptunnel.h
FORMS = $$PWD/sshkeycreationdialog.ui
diff --git a/src/libs/ssh/ssh.qbs b/src/libs/ssh/ssh.qbs
index 755bb221b39..9b772cd9604 100644
--- a/src/libs/ssh/ssh.qbs
+++ b/src/libs/ssh/ssh.qbs
@@ -5,12 +5,6 @@ QtcLibrary {
name: "QtcSsh"
cpp.defines: base.concat(["QSSH_LIBRARY"])
- cpp.includePaths: [
- ".",
- "..",
- "../..",
- buildDirectory
- ]
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "network" ] }
@@ -19,38 +13,37 @@ QtcLibrary {
files: [
"sftpchannel.h", "sftpchannel_p.h", "sftpchannel.cpp",
"sftpdefs.cpp", "sftpdefs.h",
+ "sftpfilesystemmodel.cpp", "sftpfilesystemmodel.h",
"sftpincomingpacket.cpp", "sftpincomingpacket_p.h",
"sftpoperation.cpp", "sftpoperation_p.h",
"sftpoutgoingpacket.cpp", "sftpoutgoingpacket_p.h",
"sftppacket.cpp", "sftppacket_p.h",
+ "sshbotanconversions_p.h",
"sshcapabilities_p.h", "sshcapabilities.cpp",
"sshchannel.cpp", "sshchannel_p.h",
"sshchannelmanager.cpp", "sshchannelmanager_p.h",
"sshconnection.h", "sshconnection_p.h", "sshconnection.cpp",
"sshconnectionmanager.cpp", "sshconnectionmanager.h",
"sshcryptofacility.cpp", "sshcryptofacility_p.h",
+ "sshdirecttcpiptunnel.h", "sshdirecttcpiptunnel_p.h", "sshdirecttcpiptunnel.cpp",
+ "ssherrors.h",
+ "sshexception_p.h",
+ "sshincomingpacket_p.h", "sshincomingpacket.cpp",
+ "sshkeycreationdialog.cpp", "sshkeycreationdialog.h", "sshkeycreationdialog.ui",
"sshkeyexchange.cpp", "sshkeyexchange_p.h",
+ "sshkeygenerator.cpp", "sshkeygenerator.h",
+ "sshkeypasswordretriever.cpp",
"sshkeypasswordretriever_p.h",
"sshoutgoingpacket.cpp", "sshoutgoingpacket_p.h",
"sshpacket.cpp", "sshpacket_p.h",
"sshpacketparser.cpp", "sshpacketparser_p.h",
+ "sshpseudoterminal.h",
"sshremoteprocess.cpp", "sshremoteprocess.h", "sshremoteprocess_p.h",
"sshremoteprocessrunner.cpp", "sshremoteprocessrunner.h",
"sshsendfacility.cpp", "sshsendfacility_p.h",
- "sshkeypasswordretriever.cpp",
- "sshkeygenerator.cpp", "sshkeygenerator.h",
- "sshkeycreationdialog.cpp", "sshkeycreationdialog.h", "sshkeycreationdialog.ui",
- "sftpfilesystemmodel.cpp", "sftpfilesystemmodel.h",
- "sshincomingpacket_p.h", "sshincomingpacket.cpp",
- "ssherrors.h",
- "sshexception_p.h",
- "sshpseudoterminal.h",
- "sshbotanconversions_p.h"
]
ProductModule {
- Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "network"] }
- cpp.includePaths: [".."]
}
}
diff --git a/src/libs/ssh/sshchannel.cpp b/src/libs/ssh/sshchannel.cpp
index 915d7cb6987..dada1ad12c6 100644
--- a/src/libs/ssh/sshchannel.cpp
+++ b/src/libs/ssh/sshchannel.cpp
@@ -39,18 +39,14 @@
namespace QSsh {
namespace Internal {
-namespace {
- const quint32 MinMaxPacketSize = 32768;
- const quint32 MaxPacketSize = 16 * 1024 * 1024;
- const quint32 InitialWindowSize = MaxPacketSize;
- const quint32 NoChannel = 0xffffffffu;
-} // anonymous namespace
+const quint32 MinMaxPacketSize = 32768;
+const quint32 NoChannel = 0xffffffffu;
AbstractSshChannel::AbstractSshChannel(quint32 channelId,
SshSendFacility &sendFacility)
: m_sendFacility(sendFacility), m_timeoutTimer(new QTimer(this)),
m_localChannel(channelId), m_remoteChannel(NoChannel),
- m_localWindowSize(InitialWindowSize), m_remoteWindowSize(0),
+ m_localWindowSize(initialWindowSize()), m_remoteWindowSize(0),
m_state(Inactive)
{
m_timeoutTimer->setSingleShot(true);
@@ -76,8 +72,7 @@ void AbstractSshChannel::requestSessionStart()
// with our cryptography stuff, it would have hit us before, on
// establishing the connection.
try {
- m_sendFacility.sendSessionPacket(m_localChannel, InitialWindowSize,
- MaxPacketSize);
+ m_sendFacility.sendSessionPacket(m_localChannel, initialWindowSize(), maxPacketSize());
setChannelState(SessionRequested);
m_timeoutTimer->start(ReplyTimeout);
} catch (Botan::Exception &e) {
@@ -97,6 +92,16 @@ void AbstractSshChannel::sendData(const QByteArray &data)
}
}
+quint32 AbstractSshChannel::initialWindowSize()
+{
+ return maxPacketSize();
+}
+
+quint32 AbstractSshChannel::maxPacketSize()
+{
+ return 16 * 1024 * 1024;
+}
+
void AbstractSshChannel::handleWindowAdjust(quint32 bytesToAdd)
{
checkChannelActive();
@@ -173,6 +178,7 @@ void AbstractSshChannel::handleChannelEof()
"Unexpected SSH_MSG_CHANNEL_EOF message.");
}
m_localWindowSize = 0;
+ emit eof();
}
void AbstractSshChannel::handleChannelClose()
@@ -223,10 +229,9 @@ int AbstractSshChannel::handleChannelOrExtendedChannelData(const QByteArray &dat
qWarning("Misbehaving server does not respect local window, clipping.");
m_localWindowSize -= bytesToDeliver;
- if (m_localWindowSize < MaxPacketSize) {
- m_localWindowSize += MaxPacketSize;
- m_sendFacility.sendWindowAdjustPacket(m_remoteChannel,
- MaxPacketSize);
+ if (m_localWindowSize < maxPacketSize()) {
+ m_localWindowSize += maxPacketSize();
+ m_sendFacility.sendWindowAdjustPacket(m_remoteChannel, maxPacketSize());
}
return bytesToDeliver;
}
@@ -255,7 +260,7 @@ void AbstractSshChannel::checkChannelActive()
quint32 AbstractSshChannel::maxDataSize() const
{
- return qMin(m_localWindowSize, MaxPacketSize);
+ return qMin(m_localWindowSize, maxPacketSize());
}
} // namespace Internal
diff --git a/src/libs/ssh/sshchannel_p.h b/src/libs/ssh/sshchannel_p.h
index 087c8202f2f..43dc5f2ae42 100644
--- a/src/libs/ssh/sshchannel_p.h
+++ b/src/libs/ssh/sshchannel_p.h
@@ -52,17 +52,12 @@ public:
Inactive, SessionRequested, SessionEstablished, CloseRequested, Closed
};
- ChannelState channelState() const { return m_state; }
- void setChannelState(ChannelState state);
-
quint32 localChannelId() const { return m_localChannel; }
quint32 remoteChannel() const { return m_remoteChannel; }
virtual void handleChannelSuccess() = 0;
virtual void handleChannelFailure() = 0;
- virtual void closeHook() = 0;
-
void handleOpenSuccess(quint32 remoteChannelId, quint32 remoteWindowSize,
quint32 remoteMaxPacketSize);
void handleOpenFailure(const QString &reason);
@@ -73,8 +68,6 @@ public:
void handleChannelExtendedData(quint32 type, const QByteArray &data);
void handleChannelRequest(const SshIncomingPacket &packet);
- void requestSessionStart();
- void sendData(const QByteArray &data);
void closeChannel();
virtual ~AbstractSshChannel();
@@ -83,10 +76,20 @@ public:
signals:
void timeout();
+ void eof();
protected:
AbstractSshChannel(quint32 channelId, SshSendFacility &sendFacility);
+ void setChannelState(ChannelState state);
+ ChannelState channelState() const { return m_state; }
+
+ void requestSessionStart();
+ void sendData(const QByteArray &data);
+
+ static quint32 initialWindowSize();
+ static quint32 maxPacketSize();
+
quint32 maxDataSize() const;
void checkChannelActive();
@@ -102,7 +105,8 @@ private:
virtual void handleExitStatus(const SshChannelExitStatus &exitStatus) = 0;
virtual void handleExitSignal(const SshChannelExitSignal &signal) = 0;
- void setState(ChannelState newState);
+ virtual void closeHook() = 0;
+
void flushSendBuffer();
int handleChannelOrExtendedChannelData(const QByteArray &data);
diff --git a/src/libs/ssh/sshchannelmanager.cpp b/src/libs/ssh/sshchannelmanager.cpp
index 01cba876a14..005f87094d0 100644
--- a/src/libs/ssh/sshchannelmanager.cpp
+++ b/src/libs/ssh/sshchannelmanager.cpp
@@ -31,6 +31,8 @@
#include "sftpchannel.h"
#include "sftpchannel_p.h"
+#include "sshdirecttcpiptunnel.h"
+#include "sshdirecttcpiptunnel_p.h"
#include "sshincomingpacket_p.h"
#include "sshremoteprocess.h"
#include "sshremoteprocess_p.h"
@@ -167,6 +169,15 @@ QSsh::SftpChannel::Ptr SshChannelManager::createSftpChannel()
return sftp;
}
+SshDirectTcpIpTunnel::Ptr SshChannelManager::createTunnel(quint16 remotePort,
+ const SshConnectionInfo &connectionInfo)
+{
+ SshDirectTcpIpTunnel::Ptr tunnel(new SshDirectTcpIpTunnel(m_nextLocalChannelId++, remotePort,
+ connectionInfo, m_sendFacility));
+ insertChannel(tunnel->d, tunnel);
+ return tunnel;
+}
+
void SshChannelManager::insertChannel(AbstractSshChannel *priv,
const QSharedPointer<QObject> &pub)
{
diff --git a/src/libs/ssh/sshchannelmanager_p.h b/src/libs/ssh/sshchannelmanager_p.h
index 50b11cbd368..f6e6010e4ac 100644
--- a/src/libs/ssh/sshchannelmanager_p.h
+++ b/src/libs/ssh/sshchannelmanager_p.h
@@ -35,8 +35,9 @@
#include <QSharedPointer>
namespace QSsh {
-
class SftpChannel;
+class SshConnectionInfo;
+class SshDirectTcpIpTunnel;
class SshRemoteProcess;
namespace Internal {
@@ -54,8 +55,10 @@ public:
QSharedPointer<SshRemoteProcess> createRemoteProcess(const QByteArray &command);
QSharedPointer<SshRemoteProcess> createRemoteShell();
QSharedPointer<SftpChannel> createSftpChannel();
- int channelCount() const;
+ QSharedPointer<SshDirectTcpIpTunnel> createTunnel(quint16 remotePort,
+ const SshConnectionInfo &connectionInfo);
+ int channelCount() const;
enum CloseAllMode { CloseAllRegular, CloseAllAndReset };
int closeAllChannels(CloseAllMode mode);
diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp
index 82aae29cf2c..8c4abf2347c 100644
--- a/src/libs/ssh/sshconnection.cpp
+++ b/src/libs/ssh/sshconnection.cpp
@@ -34,8 +34,10 @@
#include "sshcapabilities_p.h"
#include "sshchannelmanager_p.h"
#include "sshcryptofacility_p.h"
+#include "sshdirecttcpiptunnel.h"
#include "sshexception_p.h"
#include "sshkeyexchange_p.h"
+#include "sshremoteprocess.h"
#include <botan/botan.h>
@@ -79,7 +81,7 @@ namespace {
SshConnectionParameters::SshConnectionParameters() :
- timeout(0), authenticationType(AuthenticationByKey), port(0), proxyType(NoProxy)
+ timeout(0), authenticationType(AuthenticationByKey), port(0), options(SshIgnoreDefaultProxy)
{
}
@@ -191,6 +193,12 @@ QSharedPointer<SftpChannel> SshConnection::createSftpChannel()
return d->createSftpChannel();
}
+SshDirectTcpIpTunnel::Ptr SshConnection::createTunnel(quint16 remotePort)
+{
+ QSSH_ASSERT_AND_RETURN_VALUE(state() == Connected, SshDirectTcpIpTunnel::Ptr());
+ return d->createTunnel(remotePort);
+}
+
int SshConnection::closeAllChannels()
{
try {
@@ -217,8 +225,8 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
m_conn(conn)
{
setupPacketHandlers();
- m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
- ? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
+ m_socket->setProxy((m_connParams.options & SshIgnoreDefaultProxy)
+ ? QNetworkProxy::NoProxy : QNetworkProxy::DefaultProxy);
m_timeoutTimer.setSingleShot(true);
m_timeoutTimer.setInterval(m_connParams.timeout * 1000);
m_keepAliveTimer.setSingleShot(true);
@@ -331,7 +339,7 @@ void SshConnectionPrivate::handleIncomingData()
e.errorString);
} catch (Botan::Exception &e) {
closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "",
- tr("Botan library exception: %1").arg(QString::fromAscii(e.what())));
+ tr("Botan library exception: %1").arg(QString::fromLatin1(e.what())));
}
}
@@ -771,6 +779,11 @@ QSharedPointer<SftpChannel> SshConnectionPrivate::createSftpChannel()
return m_channelManager->createSftpChannel();
}
+SshDirectTcpIpTunnel::Ptr SshConnectionPrivate::createTunnel(quint16 remotePort)
+{
+ return m_channelManager->createTunnel(remotePort, m_conn->connectionInfo());
+}
+
const quint64 SshConnectionPrivate::InvalidSeqNr = static_cast<quint64>(-1);
} // namespace Internal
diff --git a/src/libs/ssh/sshconnection.h b/src/libs/ssh/sshconnection.h
index 1ebfe7e8032..07746f94420 100644
--- a/src/libs/ssh/sshconnection.h
+++ b/src/libs/ssh/sshconnection.h
@@ -35,6 +35,7 @@
#include "ssh_global.h"
#include <QByteArray>
+#include <QFlags>
#include <QObject>
#include <QSharedPointer>
#include <QString>
@@ -42,16 +43,22 @@
namespace QSsh {
class SftpChannel;
+class SshDirectTcpIpTunnel;
class SshRemoteProcess;
namespace Internal {
class SshConnectionPrivate;
} // namespace Internal
+enum SshConnectionOption {
+ SshIgnoreDefaultProxy = 0x1
+};
+
+Q_DECLARE_FLAGS(SshConnectionOptions, SshConnectionOption)
+
class QSSH_EXPORT SshConnectionParameters
{
public:
- enum ProxyType { DefaultProxy, NoProxy };
enum AuthenticationType { AuthenticationByPassword, AuthenticationByKey };
SshConnectionParameters();
@@ -62,7 +69,7 @@ public:
int timeout; // In seconds.
AuthenticationType authenticationType;
quint16 port;
- ProxyType proxyType;
+ SshConnectionOptions options;
};
QSSH_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
@@ -102,6 +109,7 @@ public:
QSharedPointer<SshRemoteProcess> createRemoteProcess(const QByteArray &command);
QSharedPointer<SshRemoteProcess> createRemoteShell();
QSharedPointer<SftpChannel> createSftpChannel();
+ QSharedPointer<SshDirectTcpIpTunnel> createTunnel(quint16 remotePort);
// -1 if an error occurred, number of channels closed otherwise.
int closeAllChannels();
diff --git a/src/libs/ssh/sshconnection_p.h b/src/libs/ssh/sshconnection_p.h
index 0a5be8814f0..55b6de56541 100644
--- a/src/libs/ssh/sshconnection_p.h
+++ b/src/libs/ssh/sshconnection_p.h
@@ -33,7 +33,6 @@
#include "sshconnection.h"
#include "sshexception_p.h"
#include "sshincomingpacket_p.h"
-#include "sshremoteprocess.h"
#include "sshsendfacility_p.h"
#include <QHash>
@@ -49,6 +48,8 @@ QT_END_NAMESPACE
namespace QSsh {
class SftpChannel;
+class SshRemoteProcess;
+class SshDirectTcpIpTunnel;
namespace Internal {
class SshChannelManager;
@@ -87,6 +88,8 @@ public:
QSharedPointer<SshRemoteProcess> createRemoteProcess(const QByteArray &command);
QSharedPointer<SshRemoteProcess> createRemoteShell();
QSharedPointer<SftpChannel> createSftpChannel();
+ QSharedPointer<SshDirectTcpIpTunnel> createTunnel(quint16 remotePort);
+
SshStateInternal state() const { return m_state; }
SshError error() const { return m_error; }
QString errorString() const { return m_errorString; }
diff --git a/src/libs/ssh/sshdirecttcpiptunnel.cpp b/src/libs/ssh/sshdirecttcpiptunnel.cpp
new file mode 100644
index 00000000000..ef0cada6536
--- /dev/null
+++ b/src/libs/ssh/sshdirecttcpiptunnel.cpp
@@ -0,0 +1,194 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation ([email protected])
+**
+**
+** 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
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at [email protected].
+**
+**************************************************************************/
+#include "sshdirecttcpiptunnel.h"
+#include "sshdirecttcpiptunnel_p.h"
+
+#include "sshincomingpacket_p.h"
+#include "sshsendfacility_p.h"
+
+#include <QTimer>
+
+namespace QSsh {
+namespace Internal {
+
+SshDirectTcpIpTunnelPrivate::SshDirectTcpIpTunnelPrivate(quint32 channelId, quint16 remotePort,
+ const SshConnectionInfo &connectionInfo, SshSendFacility &sendFacility)
+ : AbstractSshChannel(channelId, sendFacility),
+ m_remotePort(remotePort),
+ m_connectionInfo(connectionInfo)
+{
+ connect(this, SIGNAL(eof()), SLOT(handleEof()));
+}
+
+void SshDirectTcpIpTunnelPrivate::handleChannelSuccess()
+{
+ throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
+ "Unexpected SSH_MSG_CHANNEL_SUCCESS message.");
+}
+
+void SshDirectTcpIpTunnelPrivate::handleChannelFailure()
+{
+ throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
+ "Unexpected SSH_MSG_CHANNEL_FAILURE message.");
+}
+
+void SshDirectTcpIpTunnelPrivate::handleOpenSuccessInternal()
+{
+ emit initialized();
+}
+
+void SshDirectTcpIpTunnelPrivate::handleOpenFailureInternal(const QString &reason)
+{
+ emit error(reason);
+ closeChannel();
+}
+
+void SshDirectTcpIpTunnelPrivate::handleChannelDataInternal(const QByteArray &data)
+{
+ m_data += data;
+ emit readyRead();
+}
+
+void SshDirectTcpIpTunnelPrivate::handleChannelExtendedDataInternal(quint32 type,
+ const QByteArray &data)
+{
+ qDebug("%s: Unexpected extended channel data. Type is %u, content is '%s'.", Q_FUNC_INFO, type,
+ data.constData());
+}
+
+void SshDirectTcpIpTunnelPrivate::handleExitStatus(const SshChannelExitStatus &exitStatus)
+{
+ qDebug("%s: Unexpected exit status %d.", Q_FUNC_INFO, exitStatus.exitStatus);
+}
+
+void SshDirectTcpIpTunnelPrivate::handleExitSignal(const SshChannelExitSignal &signal)
+{
+ qDebug("%s: Unexpected exit signal %s.", Q_FUNC_INFO, signal.signal.constData());
+}
+
+void SshDirectTcpIpTunnelPrivate::closeHook()
+{
+ emit closed();
+}
+
+void SshDirectTcpIpTunnelPrivate::handleEof()
+{
+ /*
+ * For some reason, the OpenSSH server only sends EOF when the remote port goes away,
+ * but does not close the channel, even though it becomes useless in that case.
+ * So we close it ourselves.
+ */
+ closeChannel();
+}
+
+} // namespace Internal
+
+using namespace Internal;
+
+SshDirectTcpIpTunnel::SshDirectTcpIpTunnel(quint32 channelId, quint16 remotePort,
+ const SshConnectionInfo &connectionInfo, SshSendFacility &sendFacility)
+ : d(new SshDirectTcpIpTunnelPrivate(channelId, remotePort, connectionInfo, sendFacility))
+{
+ connect(d, SIGNAL(initialized()), SIGNAL(initialized()), Qt::QueuedConnection);
+ connect(d, SIGNAL(readyRead()), SIGNAL(readyRead()), Qt::QueuedConnection);
+ connect(d, SIGNAL(closed()), SIGNAL(tunnelClosed()), Qt::QueuedConnection);
+ connect(d, SIGNAL(error(QString)), SLOT(handleError(QString)), Qt::QueuedConnection);
+}
+
+SshDirectTcpIpTunnel::~SshDirectTcpIpTunnel()
+{
+ d->closeChannel();
+ delete d;
+}
+
+bool SshDirectTcpIpTunnel::atEnd() const
+{
+ return QIODevice::atEnd() && d->m_data.isEmpty();
+}
+
+qint64 SshDirectTcpIpTunnel::bytesAvailable() const
+{
+ return QIODevice::bytesAvailable() + d->m_data.count();
+}
+
+bool SshDirectTcpIpTunnel::canReadLine() const
+{
+ return QIODevice::canReadLine() || d->m_data.contains('\n');
+}
+
+void SshDirectTcpIpTunnel::close()
+{
+ d->closeChannel();
+ QIODevice::close();
+}
+
+void SshDirectTcpIpTunnel::initialize()
+{
+ QSSH_ASSERT_AND_RETURN(d->channelState() == AbstractSshChannel::Inactive);
+
+ try {
+ QIODevice::open(QIODevice::ReadWrite);
+ d->m_sendFacility.sendDirectTcpIpPacket(d->localChannelId(), d->initialWindowSize(),
+ d->maxPacketSize(), d->m_connectionInfo.peerAddress.toString().toUtf8(),
+ d->m_remotePort, d->m_connectionInfo.localAddress.toString().toUtf8(),
+ d->m_connectionInfo.localPort);
+ d->setChannelState(AbstractSshChannel::SessionRequested);
+ d->m_timeoutTimer->start(d->ReplyTimeout);
+ } catch (Botan::Exception &e) { // Won't happen, but let's play it safe.
+ qDebug("Botan error: %s", e.what());
+ d->closeChannel();
+ }
+}
+
+qint64 SshDirectTcpIpTunnel::readData(char *data, qint64 maxlen)
+{
+ const qint64 bytesRead = qMin(qint64(d->m_data.count()), maxlen);
+ memcpy(data, d->m_data.constData(), bytesRead);
+ d->m_data.remove(0, bytesRead);
+ return bytesRead;
+}
+
+qint64 SshDirectTcpIpTunnel::writeData(const char *data, qint64 len)
+{
+ QSSH_ASSERT_AND_RETURN_VALUE(d->channelState() == AbstractSshChannel::SessionEstablished, 0);
+
+ d->sendData(QByteArray(data, len));
+ return len;
+}
+
+void SshDirectTcpIpTunnel::handleError(const QString &reason)
+{
+ setErrorString(reason);
+ emit error(reason);
+}
+
+} // namespace QSsh
diff --git a/src/libs/ssh/sshdirecttcpiptunnel.h b/src/libs/ssh/sshdirecttcpiptunnel.h
new file mode 100644
index 00000000000..b451c96afcd
--- /dev/null
+++ b/src/libs/ssh/sshdirecttcpiptunnel.h
@@ -0,0 +1,90 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation ([email protected])
+**
+**
+** 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
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at [email protected].
+**
+**************************************************************************/
+
+#ifndef SSHDIRECTTCPIPTUNNEL_H
+#define SSHDIRECTTCPIPTUNNEL_H
+
+#include "ssh_global.h"
+
+#include <QIODevice>
+#include <QSharedPointer>
+
+namespace QSsh {
+class SshConnectionInfo;
+
+namespace Internal {
+class SshChannelManager;
+class SshDirectTcpIpTunnelPrivate;
+class SshSendFacility;
+} // namespace Internal
+
+class QSSH_EXPORT SshDirectTcpIpTunnel : public QIODevice
+{
+ Q_OBJECT
+
+ friend class Internal::SshChannelManager;
+
+public:
+ typedef QSharedPointer<SshDirectTcpIpTunnel> Ptr;
+
+ ~SshDirectTcpIpTunnel();
+
+ // QIODevice stuff
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ bool canReadLine() const;
+ void close();
+ bool isSequential() const { return true; }
+
+ void initialize();
+
+signals:
+ void initialized();
+ void error(const QString &reason);
+ void tunnelClosed();
+
+private:
+ SshDirectTcpIpTunnel(quint32 channelId, quint16 remotePort,
+ const SshConnectionInfo &connectionInfo, Internal::SshSendFacility &sendFacility);
+
+ // QIODevice stuff
+ qint64 readData(char *data, qint64 maxlen);
+ qint64 writeData(const char *data, qint64 len);
+
+ Q_SLOT void handleError(const QString &reason);
+
+ Internal::SshDirectTcpIpTunnelPrivate * const d;
+};
+
+} // namespace QSsh
+
+#endif // SSHDIRECTTCPIPTUNNEL_H
diff --git a/src/libs/ssh/sshdirecttcpiptunnel_p.h b/src/libs/ssh/sshdirecttcpiptunnel_p.h
new file mode 100644
index 00000000000..7122c4dc2a3
--- /dev/null
+++ b/src/libs/ssh/sshdirecttcpiptunnel_p.h
@@ -0,0 +1,84 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation ([email protected])
+**
+**
+** 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
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at [email protected].
+**
+**************************************************************************/
+#ifndef DIRECTTCPIPCHANNEL_P_H
+#define DIRECTTCPIPCHANNEL_P_H
+
+#include "sshchannel_p.h"
+
+#include "sshconnection.h"
+
+namespace QSsh {
+class SshDirectTcpIpTunnel;
+
+namespace Internal {
+
+class SshDirectTcpIpTunnelPrivate : public AbstractSshChannel
+{
+ Q_OBJECT
+
+ friend class QSsh::SshDirectTcpIpTunnel;
+
+public:
+ explicit SshDirectTcpIpTunnelPrivate(quint32 channelId, quint16 remotePort,
+ const SshConnectionInfo &connectionInfo, SshSendFacility &sendFacility);
+
+signals:
+ void initialized();
+ void readyRead();
+ void error(const QString &reason);
+ void closed();
+
+private slots:
+ void handleEof();
+
+private:
+ void handleChannelSuccess();
+ void handleChannelFailure();
+
+ void handleOpenSuccessInternal();
+ void handleOpenFailureInternal(const QString &reason);
+ void handleChannelDataInternal(const QByteArray &data);
+ void handleChannelExtendedDataInternal(quint32 type, const QByteArray &data);
+ void handleExitStatus(const SshChannelExitStatus &exitStatus);
+ void handleExitSignal(const SshChannelExitSignal &signal);
+
+ void closeHook();
+
+ const quint16 m_remotePort;
+ const SshConnectionInfo m_connectionInfo;
+ QByteArray m_data;
+};
+
+} // namespace Internal
+} // namespace QSsh
+
+#endif // DIRECTTCPIPCHANNEL_P_H
diff --git a/src/libs/ssh/sshkeygenerator.cpp b/src/libs/ssh/sshkeygenerator.cpp
index e6aa9676cc5..4fc9da5af4d 100644
--- a/src/libs/ssh/sshkeygenerator.cpp
+++ b/src/libs/ssh/sshkeygenerator.cpp
@@ -76,7 +76,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke
}
return true;
} catch (Botan::Exception &e) {
- m_error = tr("Error generating key: %1").arg(QString::fromAscii(e.what()));
+ m_error = tr("Error generating key: %1").arg(QString::fromLatin1(e.what()));
return false;
}
}
diff --git a/src/libs/ssh/sshoutgoingpacket.cpp b/src/libs/ssh/sshoutgoingpacket.cpp
index 85c644b990b..2724ab8e373 100644
--- a/src/libs/ssh/sshoutgoingpacket.cpp
+++ b/src/libs/ssh/sshoutgoingpacket.cpp
@@ -142,7 +142,16 @@ void SshOutgoingPacket::generateSessionPacket(quint32 channelId,
quint32 windowSize, quint32 maxPacketSize)
{
init(SSH_MSG_CHANNEL_OPEN).appendString("session").appendInt(channelId)
- .appendInt(windowSize).appendInt(maxPacketSize).finalize();
+ .appendInt(windowSize).appendInt(maxPacketSize).finalize();
+}
+
+void SshOutgoingPacket::generateDirectTcpIpPacket(quint32 channelId, quint32 windowSize,
+ quint32 maxPacketSize, const QByteArray &remoteHost, quint32 remotePort,
+ const QByteArray &localIpAddress, quint32 localPort)
+{
+ init(SSH_MSG_CHANNEL_OPEN).appendString("direct-tcpip").appendInt(channelId)
+ .appendInt(windowSize).appendInt(maxPacketSize).appendString(remoteHost)
+ .appendInt(remotePort).appendString(localIpAddress).appendInt(localPort).finalize();
}
void SshOutgoingPacket::generateEnvPacket(quint32 remoteChannel,
diff --git a/src/libs/ssh/sshoutgoingpacket_p.h b/src/libs/ssh/sshoutgoingpacket_p.h
index 612ffb90a52..7f9c6db1043 100644
--- a/src/libs/ssh/sshoutgoingpacket_p.h
+++ b/src/libs/ssh/sshoutgoingpacket_p.h
@@ -61,6 +61,9 @@ public:
void generateInvalidMessagePacket();
void generateSessionPacket(quint32 channelId, quint32 windowSize,
quint32 maxPacketSize);
+ void generateDirectTcpIpPacket(quint32 channelId, quint32 windowSize,
+ quint32 maxPacketSize, const QByteArray &remoteHost, quint32 remotePort,
+ const QByteArray &localIpAddress, quint32 localPort);
void generateEnvPacket(quint32 remoteChannel, const QByteArray &var,
const QByteArray &value);
void generatePtyRequestPacket(quint32 remoteChannel,
diff --git a/src/libs/ssh/sshremoteprocess.cpp b/src/libs/ssh/sshremoteprocess.cpp
index 98ec11b7cbc..fac94be3c13 100644
--- a/src/libs/ssh/sshremoteprocess.cpp
+++ b/src/libs/ssh/sshremoteprocess.cpp
@@ -166,6 +166,7 @@ void SshRemoteProcess::init()
connect(d, SIGNAL(readyReadStandardError()), this,
SIGNAL(readyReadStandardError()), Qt::QueuedConnection);
connect(d, SIGNAL(closed(int)), this, SIGNAL(closed(int)), Qt::QueuedConnection);
+ connect(d, SIGNAL(eof()), SIGNAL(readChannelFinished()), Qt::QueuedConnection);
}
void SshRemoteProcess::addToEnvironment(const QByteArray &var, const QByteArray &value)
@@ -205,7 +206,7 @@ void SshRemoteProcess::sendSignal(Signal signal)
d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString);
}
} catch (Botan::Exception &e) {
- setErrorString(QString::fromAscii(e.what()));
+ setErrorString(QString::fromLatin1(e.what()));
d->closeChannel();
}
}
diff --git a/src/libs/ssh/sshremoteprocess_p.h b/src/libs/ssh/sshremoteprocess_p.h
index e70acc77c0f..cd1bcf27541 100644
--- a/src/libs/ssh/sshremoteprocess_p.h
+++ b/src/libs/ssh/sshremoteprocess_p.h
@@ -53,13 +53,6 @@ public:
NotYetStarted, ExecRequested, StartFailed, Running, Exited
};
- virtual void handleChannelSuccess();
- virtual void handleChannelFailure();
-
- virtual void closeHook();
-
- QByteArray &data();
-
signals:
void started();
void readyRead();
@@ -73,6 +66,9 @@ private:
SshRemoteProcessPrivate(quint32 channelId, SshSendFacility &sendFacility,
SshRemoteProcess *proc);
+ virtual void handleChannelSuccess();
+ virtual void handleChannelFailure();
+
virtual void handleOpenSuccessInternal();
virtual void handleOpenFailureInternal(const QString &reason);
virtual void handleChannelDataInternal(const QByteArray &data);
@@ -81,8 +77,11 @@ private:
virtual void handleExitStatus(const SshChannelExitStatus &exitStatus);
virtual void handleExitSignal(const SshChannelExitSignal &signal);
+ virtual void closeHook();
+
void init();
void setProcState(ProcessState newState);
+ QByteArray &data();
QProcess::ProcessChannel m_readChannel;
diff --git a/src/libs/ssh/sshsendfacility.cpp b/src/libs/ssh/sshsendfacility.cpp
index 46c3a21e2af..966022f4368 100644
--- a/src/libs/ssh/sshsendfacility.cpp
+++ b/src/libs/ssh/sshsendfacility.cpp
@@ -149,6 +149,15 @@ void SshSendFacility::sendSessionPacket(quint32 channelId, quint32 windowSize,
sendPacket();
}
+void SshSendFacility::sendDirectTcpIpPacket(quint32 channelId, quint32 windowSize,
+ quint32 maxPacketSize, const QByteArray &remoteHost, quint32 remotePort,
+ const QByteArray &localIpAddress, quint32 localPort)
+{
+ m_outgoingPacket.generateDirectTcpIpPacket(channelId, windowSize, maxPacketSize, remoteHost,
+ remotePort, localIpAddress, localPort);
+ sendPacket();
+}
+
void SshSendFacility::sendPtyRequestPacket(quint32 remoteChannel,
const SshPseudoTerminal &terminal)
{
diff --git a/src/libs/ssh/sshsendfacility_p.h b/src/libs/ssh/sshsendfacility_p.h
index 597973dbab8..8d7e793a745 100644
--- a/src/libs/ssh/sshsendfacility_p.h
+++ b/src/libs/ssh/sshsendfacility_p.h
@@ -68,6 +68,9 @@ public:
void sendInvalidPacket();
void sendSessionPacket(quint32 channelId, quint32 windowSize,
quint32 maxPacketSize);
+ void sendDirectTcpIpPacket(quint32 channelId, quint32 windowSize, quint32 maxPacketSize,
+ const QByteArray &remoteHost, quint32 remotePort, const QByteArray &localIpAddress,
+ quint32 localPort);
void sendPtyRequestPacket(quint32 remoteChannel,
const SshPseudoTerminal &terminal);
void sendEnvPacket(quint32 remoteChannel, const QByteArray &var,
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp
index 75396f33c93..873fe679219 100644
--- a/src/libs/utils/buildablehelperlibrary.cpp
+++ b/src/libs/utils/buildablehelperlibrary.cpp
@@ -37,8 +37,9 @@
#include <QDateTime>
#include <utils/environment.h>
-#include <utils/synchronousprocess.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
+#include <utils/synchronousprocess.h>
#include <QDesktopServices>
#include <QDebug>
@@ -122,15 +123,14 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool
QStringList BuildableHelperLibrary::possibleQMakeCommands()
{
// On windows no one has renamed qmake, right?
-#ifdef Q_OS_WIN
- return QStringList(QLatin1String("qmake.exe"));
-#else
+ if (HostOsInfo::isWindowsHost())
+ return QStringList(QLatin1String("qmake.exe"));
+
// On unix some distributions renamed qmake to avoid clashes
QStringList result;
result << QLatin1String("qmake-qt4") << QLatin1String("qmake4")
<< QLatin1String("qmake-qt5") << QLatin1String("qmake5") << QLatin1String("qmake");
return result;
-#endif
}
// Copy helper source files to a target directory, replacing older files.
@@ -140,7 +140,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
QString *errorMessage)
{
// try remove the directory
- if (!FileUtils::removeRecursively(targetDirectory, errorMessage))
+ if (!FileUtils::removeRecursively(FileName::fromString(targetDirectory), errorMessage))
return false;
if (!QDir().mkpath(targetDirectory)) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The target directory %1 could not be created.").arg(targetDirectory);
diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp
index b7f1f3fd73a..a4876a9b5d5 100644
--- a/src/libs/utils/consoleprocess.cpp
+++ b/src/libs/utils/consoleprocess.cpp
@@ -124,7 +124,7 @@ QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QStrin
QString ConsoleProcess::msgUnexpectedOutput(const QByteArray &what)
{
- return tr("Unexpected output from helper program (%1).").arg(QString::fromAscii(what));
+ return tr("Unexpected output from helper program (%1).").arg(QString::fromLatin1(what));
}
QString ConsoleProcess::msgCannotChangeToWorkDir(const QString & dir, const QString &why)
diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp
index c13430e33cb..6607e71ed70 100644
--- a/src/libs/utils/consoleprocess_unix.cpp
+++ b/src/libs/utils/consoleprocess_unix.cpp
@@ -32,6 +32,8 @@
#include "environment.h"
#include "qtcprocess.h"
+#include <utils/hostosinfo.h>
+
#include <QCoreApplication>
#include <QDir>
#include <QSettings>
@@ -133,12 +135,14 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
}
}
+ if (Utils::HostOsInfo::isMacHost()) {
+ xtermArgs << (QCoreApplication::applicationDirPath()
+ + QLatin1String("/../Resources/qtcreator_process_stub"));
+ } else {
+ xtermArgs << (QCoreApplication::applicationDirPath()
+ + QLatin1String("/qtcreator_process_stub"));
+ }
xtermArgs
-#ifdef Q_OS_MAC
- << (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/qtcreator_process_stub"))
-#else
- << (QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub"))
-#endif
<< modeOption(d->m_mode)
<< d->m_stubServer.fullServerName()
<< msgPromptToClose()
@@ -295,9 +299,9 @@ static const Terminal knownTerminals[] =
QString ConsoleProcess::defaultTerminalEmulator()
{
-#ifdef Q_OS_MAC
- return QLatin1String("/usr/X11/bin/xterm -e");
-#else
+ if (Utils::HostOsInfo::isMacHost())
+ return QLatin1String("/usr/X11/bin/xterm");
+
const Environment env = Environment::systemEnvironment();
const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0]));
for (int i = 0; i < terminalCount; ++i) {
@@ -309,14 +313,13 @@ QString ConsoleProcess::defaultTerminalEmulator()
}
}
return QLatin1String("xterm -e");
-#endif
}
QStringList ConsoleProcess::availableTerminalEmulators()
{
-#ifdef Q_OS_MAC
- return QStringList(defaultTerminalEmulator());
-#else
+ if (Utils::HostOsInfo::isMacHost())
+ return QStringList(defaultTerminalEmulator());
+
QStringList result;
const Environment env = Environment::systemEnvironment();
const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0]));
@@ -330,7 +333,6 @@ QStringList ConsoleProcess::availableTerminalEmulators()
}
result.sort();
return result;
-#endif
}
QString ConsoleProcess::terminalEmulator(const QSettings *settings)
diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp
index 2829e5f3fc1..5ae6ced83ef 100644
--- a/src/libs/utils/crumblepath.cpp
+++ b/src/libs/utils/crumblepath.cpp
@@ -28,6 +28,7 @@
****************************************************************************/
#include "crumblepath.h"
+#include "qtcassert.h"
#include "stylehelper.h"
#include <QList>
@@ -39,8 +40,6 @@
#include <QPainter>
#include <QImage>
-#include <qtcassert.h>
-
namespace Utils {
static const int ArrowBorderSize = 12;
diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp
index dad496b8d12..35f8f232b72 100644
--- a/src/libs/utils/detailsbutton.cpp
+++ b/src/libs/utils/detailsbutton.cpp
@@ -29,6 +29,7 @@
#include "detailsbutton.h"
+#include <utils/hostosinfo.h>
#include <utils/stylehelper.h>
#include <QPropertyAnimation>
@@ -82,11 +83,9 @@ QSize DetailsButton::sizeHint() const
{
// TODO: Adjust this when icons become available!
const int w = fontMetrics().width(text()) + 32;
-#ifdef Q_OS_MAC
- return QSize(w, 34);
-#else
+ if (HostOsInfo::isMacHost())
+ return QSize(w, 34);
return QSize(w, 22);
-#endif
}
bool DetailsButton::event(QEvent *e)
@@ -119,11 +118,10 @@ void DetailsButton::paintEvent(QPaintEvent *e)
QWidget::paintEvent(e);
QPainter p(this);
-#ifndef Q_OS_MAC
+
// draw hover animation
- if (!isDown() && m_fader > 0)
+ if (!HostOsInfo::isMacHost() && !isDown() && m_fader > 0)
p.fillRect(rect().adjusted(1, 1, -2, -2), QColor(255, 255, 255, int(m_fader*180)));
-#endif
if (isChecked()) {
if (m_checkedPixmap.isNull() || m_checkedPixmap.size() != contentsRect().size())
diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp
index b7aee2c8d36..0b27d0d7878 100644
--- a/src/libs/utils/detailswidget.cpp
+++ b/src/libs/utils/detailswidget.cpp
@@ -29,6 +29,7 @@
#include "detailswidget.h"
#include "detailsbutton.h"
+#include "hostosinfo.h"
#include <QStack>
#include <QPropertyAnimation>
@@ -142,10 +143,10 @@ QPixmap DetailsWidgetPrivate::cacheBackground(const QSize &size)
QRect topRect(0, 0, size.width(), topHeight);
QRect fullRect(0, 0, size.width(), size.height());
-#ifdef Q_OS_MAC
- p.fillRect(fullRect, qApp->palette().window().color());
-#endif
- p.fillRect(fullRect, QColor(255, 255, 255, 40));
+ if (HostOsInfo::isMacHost())
+ p.fillRect(fullRect, qApp->palette().window().color());
+ else
+ p.fillRect(fullRect, QColor(255, 255, 255, 40));
QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft());
lg.setColorAt(0, QColor(255, 255, 255, 130));
@@ -187,11 +188,10 @@ void DetailsWidgetPrivate::changeHoverState(bool hovered)
{
if (!m_toolWidget)
return;
-#ifdef Q_OS_MAC
- m_toolWidget->setOpacity(hovered ? 1.0 : 0);
-#else
- m_toolWidget->fadeTo(hovered ? 1.0 : 0);
-#endif
+ if (HostOsInfo::isMacHost())
+ m_toolWidget->setOpacity(hovered ? 1.0 : 0);
+ else
+ m_toolWidget->fadeTo(hovered ? 1.0 : 0);
m_hovered = hovered;
}
@@ -380,9 +380,8 @@ void DetailsWidget::setToolWidget(Utils::FadingPanel *widget)
d->m_toolWidget->adjustSize();
d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight);
-#ifdef Q_OS_MAC
- d->m_toolWidget->setOpacity(1.0);
-#endif
+ if (HostOsInfo::isMacHost())
+ d->m_toolWidget->setOpacity(1.0);
d->changeHoverState(d->m_hovered);
}
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp
index fff002ef879..7a5849823ba 100644
--- a/src/libs/utils/environment.cpp
+++ b/src/libs/utils/environment.cpp
@@ -29,6 +29,8 @@
#include "environment.h"
+#include "hostosinfo.h"
+
#include <QDir>
#include <QProcess>
#include <QString>
@@ -40,18 +42,18 @@ public:
SystemEnvironment()
: Environment(QProcess::systemEnvironment())
{
-#ifdef Q_OS_LINUX
- QString ldLibraryPath = value(QLatin1String("LD_LIBRARY_PATH"));
- QDir lib(QCoreApplication::applicationDirPath());
- lib.cd("../lib");
- QString toReplace = lib.path();
- lib.cd("qtcreator");
- toReplace.append(QLatin1String(":"));
- toReplace.append(lib.path());
-
- if (ldLibraryPath.startsWith(toReplace))
- set(QLatin1String("LD_LIBRARY_PATH"), ldLibraryPath.remove(0, toReplace.length()));
-#endif
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ QString ldLibraryPath = value(QLatin1String("LD_LIBRARY_PATH"));
+ QDir lib(QCoreApplication::applicationDirPath());
+ lib.cd("../lib");
+ QString toReplace = lib.path();
+ lib.cd("qtcreator");
+ toReplace.append(QLatin1String(":"));
+ toReplace.append(lib.path());
+
+ if (ldLibraryPath.startsWith(toReplace))
+ set(QLatin1String("LD_LIBRARY_PATH"), ldLibraryPath.remove(0, toReplace.length()));
+ }
}
};
@@ -103,11 +105,10 @@ Environment::Environment(const QStringList &env)
foreach (const QString &s, env) {
int i = s.indexOf(QLatin1Char('='));
if (i >= 0) {
-#ifdef Q_OS_WIN
- m_values.insert(s.left(i).toUpper(), s.mid(i+1));
-#else
- m_values.insert(s.left(i), s.mid(i+1));
-#endif
+ if (HostOsInfo::isWindowsHost())
+ m_values.insert(s.left(i).toUpper(), s.mid(i+1));
+ else
+ m_values.insert(s.left(i), s.mid(i+1));
}
}
}
@@ -127,32 +128,18 @@ QStringList Environment::toStringList() const
void Environment::set(const QString &key, const QString &value)
{
-#ifdef Q_OS_WIN
- QString _key = key.toUpper();
-#else
- const QString &_key = key;
-#endif
- m_values.insert(_key, value);
+ m_values.insert(HostOsInfo::isWindowsHost() ? key.toUpper() : key, value);
}
void Environment::unset(const QString &key)
{
-#ifdef Q_OS_WIN
- QString _key = key.toUpper();
-#else
- const QString &_key = key;
-#endif
- m_values.remove(_key);
+ m_values.remove(HostOsInfo::isWindowsHost() ? key.toUpper() : key);
}
void Environment::appendOrSet(const QString &key, const QString &value, const QString &sep)
{
-#ifdef Q_OS_WIN
- QString _key = key.toUpper();
-#else
- const QString &_key = key;
-#endif
- QMap<QString, QString>::iterator it = m_values.find(key);
+ const QString &_key = HostOsInfo::isWindowsHost() ? key.toUpper() : key;
+ QMap<QString, QString>::iterator it = m_values.find(_key);
if (it == m_values.end()) {
m_values.insert(_key, value);
} else {
@@ -165,12 +152,8 @@ void Environment::appendOrSet(const QString &key, const QString &value, const QS
void Environment::prependOrSet(const QString&key, const QString &value, const QString &sep)
{
-#ifdef Q_OS_WIN
- QString _key = key.toUpper();
-#else
- const QString &_key = key;
-#endif
- QMap<QString, QString>::iterator it = m_values.find(key);
+ const QString &_key = HostOsInfo::isWindowsHost() ? key.toUpper() : key;
+ QMap<QString, QString>::iterator it = m_values.find(_key);
if (it == m_values.end()) {
m_values.insert(_key, value);
} else {
@@ -183,38 +166,35 @@ void Environment::prependOrSet(const QString&key, const QString &value, const QS
void Environment::appendOrSetPath(const QString &value)
{
-#ifdef Q_OS_WIN
- const QChar sep = QLatin1Char(';');
-#else
- const QChar sep = QLatin1Char(':');
-#endif
- appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep));
+ appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value),
+ QString(HostOsInfo::pathListSeparator()));
}
void Environment::prependOrSetPath(const QString &value)
{
-#ifdef Q_OS_WIN
- const QChar sep = QLatin1Char(';');
-#else
- const QChar sep = QLatin1Char(':');
-#endif
- prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep));
+ prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value),
+ QString(HostOsInfo::pathListSeparator()));
}
void Environment::prependOrSetLibrarySearchPath(const QString &value)
{
-#ifdef Q_OS_MAC
- Q_UNUSED(value);
- // we could set DYLD_LIBRARY_PATH on Mac but it is unnecessary in practice
-#elif defined(Q_OS_WIN)
- const QChar sep = QLatin1Char(';');
- const QLatin1String path("PATH");
- prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
-#elif defined(Q_OS_UNIX)
- const QChar sep = QLatin1Char(':');
- const QLatin1String path("LD_LIBRARY_PATH");
- prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
-#endif
+ switch (HostOsInfo::hostOs()) {
+ case HostOsInfo::HostOsWindows: {
+ const QChar sep = QLatin1Char(';');
+ const QLatin1String path("PATH");
+ prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
+ break;
+ }
+ case HostOsInfo::HostOsLinux:
+ case HostOsInfo::HostOsOtherUnix: {
+ const QChar sep = QLatin1Char(':');
+ const QLatin1String path("LD_LIBRARY_PATH");
+ prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
+ break;
+ }
+ default: // we could set DYLD_LIBRARY_PATH on Mac but it is unnecessary in practice
+ break;
+ }
}
Environment Environment::systemEnvironment()
@@ -257,16 +237,16 @@ QString Environment::searchInPath(const QString &executable,
return QString();
QStringList execs(exec);
-#ifdef Q_OS_WIN
- // Check all the executable extensions on windows:
- // PATHEXT is only used if the executable has no extension
- if (fi.suffix().isEmpty()) {
- QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';'));
-
- foreach (const QString &ext, extensions)
- execs << executable + ext.toLower();
+ if (HostOsInfo::isWindowsHost()) {
+ // Check all the executable extensions on windows:
+ // PATHEXT is only used if the executable has no extension
+ if (fi.suffix().isEmpty()) {
+ QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';'));
+
+ foreach (const QString &ext, extensions)
+ execs << executable + ext.toLower();
+ }
}
-#endif
foreach (QString dir, additionalDirs) {
QString tmp = searchInDirectory(execs, dir);
@@ -287,12 +267,8 @@ QString Environment::searchInPath(const QString &executable,
QStringList Environment::path() const
{
-#ifdef Q_OS_WIN
- const QChar sep = QLatin1Char(';');
-#else
- const QChar sep = QLatin1Char(':');
-#endif
- return m_values.value(QLatin1String("PATH")).split(sep, QString::SkipEmptyParts);
+ return m_values.value(QLatin1String("PATH")).split(HostOsInfo::pathListSeparator(),
+ QString::SkipEmptyParts);
}
QString Environment::value(const QString &key) const
@@ -404,6 +380,11 @@ bool Environment::hasKey(const QString &key)
return m_values.contains(key);
}
+QString Environment::userName() const
+{
+ return value(QLatin1String(HostOsInfo::isWindowsHost() ? "USERNAME" : "USER"));
+}
+
bool Environment::operator!=(const Environment &other) const
{
return !(*this == other);
@@ -425,68 +406,68 @@ QString Environment::expandVariables(const QString &input) const
{
QString result = input;
-#ifdef Q_OS_WIN
- for (int vStart = -1, i = 0; i < result.length(); ) {
- if (result.at(i++) == QLatin1Char('%')) {
- if (vStart > 0) {
- const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1).toUpper());
- if (it != m_values.constEnd()) {
- result.replace(vStart - 1, i - vStart + 1, *it);
- i = vStart - 1 + it->length();
- vStart = -1;
+ if (HostOsInfo::isWindowsHost()) {
+ for (int vStart = -1, i = 0; i < result.length(); ) {
+ if (result.at(i++) == QLatin1Char('%')) {
+ if (vStart > 0) {
+ const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1).toUpper());
+ if (it != m_values.constEnd()) {
+ result.replace(vStart - 1, i - vStart + 1, *it);
+ i = vStart - 1 + it->length();
+ vStart = -1;
+ } else {
+ vStart = i;
+ }
} else {
vStart = i;
}
- } else {
- vStart = i;
}
}
- }
-#else
- enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
- int vStart = -1;
-
- for (int i = 0; i < result.length();) {
- QChar c = result.at(i++);
- if (state == BASE) {
- if (c == QLatin1Char('$'))
- state = OPTIONALVARIABLEBRACE;
- } else if (state == OPTIONALVARIABLEBRACE) {
- if (c == QLatin1Char('{')) {
- state = BRACEDVARIABLE;
- vStart = i;
- } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
- state = VARIABLE;
- vStart = i - 1;
- } else {
- state = BASE;
- }
- } else if (state == BRACEDVARIABLE) {
- if (c == QLatin1Char('}')) {
- const_iterator it = m_values.constFind(result.mid(vStart, i - 1 - vStart));
- if (it != constEnd()) {
- result.replace(vStart - 2, i - vStart + 2, *it);
- i = vStart - 2 + it->length();
+ } else {
+ enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
+ int vStart = -1;
+
+ for (int i = 0; i < result.length();) {
+ QChar c = result.at(i++);
+ if (state == BASE) {
+ if (c == QLatin1Char('$'))
+ state = OPTIONALVARIABLEBRACE;
+ } else if (state == OPTIONALVARIABLEBRACE) {
+ if (c == QLatin1Char('{')) {
+ state = BRACEDVARIABLE;
+ vStart = i;
+ } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
+ state = VARIABLE;
+ vStart = i - 1;
+ } else {
+ state = BASE;
}
- state = BASE;
- }
- } else if (state == VARIABLE) {
- if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
- const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1));
- if (it != constEnd()) {
- result.replace(vStart - 1, i - vStart, *it);
- i = vStart - 1 + it->length();
+ } else if (state == BRACEDVARIABLE) {
+ if (c == QLatin1Char('}')) {
+ const_iterator it = m_values.constFind(result.mid(vStart, i - 1 - vStart));
+ if (it != constEnd()) {
+ result.replace(vStart - 2, i - vStart + 2, *it);
+ i = vStart - 2 + it->length();
+ }
+ state = BASE;
+ }
+ } else if (state == VARIABLE) {
+ if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
+ const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1));
+ if (it != constEnd()) {
+ result.replace(vStart - 1, i - vStart, *it);
+ i = vStart - 1 + it->length();
+ }
+ state = BASE;
}
- state = BASE;
}
}
+ if (state == VARIABLE) {
+ const_iterator it = m_values.constFind(result.mid(vStart));
+ if (it != constEnd())
+ result.replace(vStart - 1, result.length() - vStart + 1, *it);
+ }
}
- if (state == VARIABLE) {
- const_iterator it = m_values.constFind(result.mid(vStart));
- if (it != constEnd())
- result.replace(vStart - 1, result.length() - vStart + 1, *it);
- }
-#endif
return result;
}
diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h
index 501a29d9f61..1e8d2984dcb 100644
--- a/src/libs/utils/environment.h
+++ b/src/libs/utils/environment.h
@@ -78,6 +78,8 @@ public:
QList<EnvironmentItem> diff(const Environment &other) const;
bool hasKey(const QString &key);
+ QString userName() const;
+
void appendOrSet(const QString &key, const QString &value, const QString &sep = QString());
void prependOrSet(const QString &key, const QString &value, const QString &sep = QString());
diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp
index 02c1cecd39a..963994078ce 100644
--- a/src/libs/utils/environmentmodel.cpp
+++ b/src/libs/utils/environmentmodel.cpp
@@ -30,6 +30,7 @@
#include "environmentmodel.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QFont>
@@ -201,11 +202,8 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
if (index.column() == 0) {
//fail if a variable with the same name already exists
-#if defined(Q_OS_WIN)
- const QString &newName = value.toString().toUpper();
-#else
- const QString &newName = value.toString();
-#endif
+ const QString &newName = HostOsInfo::isWindowsHost()
+ ? value.toString().toUpper() : value.toString();
// Does the new name exist already?
if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty())
return false;
diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp
index ac8fb439068..29ed7f40687 100644
--- a/src/libs/utils/fancymainwindow.cpp
+++ b/src/libs/utils/fancymainwindow.cpp
@@ -256,7 +256,7 @@ void FancyMainWindow::restoreSettings(const QHash<QString, QVariant> &settings)
QList<QDockWidget *> FancyMainWindow::dockWidgets() const
{
- return qFindChildren<QDockWidget *>(this);
+ return findChildren<QDockWidget *>();
}
bool FancyMainWindow::isLocked() const
@@ -274,7 +274,7 @@ static bool actionLessThan(const QAction *action1, const QAction *action2)
QMenu *FancyMainWindow::createPopupMenu()
{
QList<QAction *> actions;
- QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
+ QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i);
if (dockWidget->property("managed_dockwidget").isNull()
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index 23d072c4f5e..7ecd0b63b8c 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -30,6 +30,7 @@
#include "fileutils.h"
#include "savefile.h"
+#include "hostosinfo.h"
#include "qtcassert.h"
#include <QDir>
@@ -57,14 +58,14 @@ namespace Utils {
\return Whether the operation succeeded.
*/
-bool FileUtils::removeRecursively(const QString &filePath, QString *error)
+bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
{
- QFileInfo fileInfo(filePath);
+ QFileInfo fileInfo = filePath.toFileInfo();
if (!fileInfo.exists() && !fileInfo.isSymLink())
return true;
- QFile::setPermissions(filePath, fileInfo.permissions() | QFile::WriteUser);
+ QFile::setPermissions(filePath.toString(), fileInfo.permissions() | QFile::WriteUser);
if (fileInfo.isDir()) {
- QDir dir(filePath);
+ QDir dir(filePath.toString());
dir = dir.canonicalPath();
if (dir.isRoot()) {
if (error) {
@@ -84,21 +85,21 @@ bool FileUtils::removeRecursively(const QString &filePath, QString *error)
QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden
| QDir::System | QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QString &fileName, fileNames) {
- if (!removeRecursively(filePath + QLatin1Char('/') + fileName, error))
+ if (!removeRecursively(FileName(filePath).appendPath(fileName), error))
return false;
}
if (!QDir::root().rmdir(dir.path())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to remove directory '%1'.")
- .arg(QDir::toNativeSeparators(filePath));
+ .arg(filePath.toUserOutput());
}
return false;
}
} else {
- if (!QFile::remove(filePath)) {
+ if (!QFile::remove(filePath.toString())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to remove file '%1'.")
- .arg(QDir::toNativeSeparators(filePath));
+ .arg(filePath.toUserOutput());
}
return false;
}
@@ -123,36 +124,36 @@ bool FileUtils::removeRecursively(const QString &filePath, QString *error)
\return Whether the operation succeeded.
*/
-bool FileUtils::copyRecursively(const QString &srcFilePath,
- const QString &tgtFilePath, QString *error)
+bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgtFilePath,
+ QString *error)
{
- QFileInfo srcFileInfo(srcFilePath);
+ QFileInfo srcFileInfo = srcFilePath.toFileInfo();
if (srcFileInfo.isDir()) {
- QDir targetDir(tgtFilePath);
+ QDir targetDir(tgtFilePath.toString());
targetDir.cdUp();
- if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) {
+ if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory '%1'.")
- .arg(QDir::toNativeSeparators(tgtFilePath));
+ .arg(tgtFilePath.toUserOutput());
return false;
}
}
- QDir sourceDir(srcFilePath);
- QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
+ QDir sourceDir(srcFilePath.toString());
+ QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot
+ | QDir::Hidden | QDir::System);
foreach (const QString &fileName, fileNames) {
- const QString newSrcFilePath
- = srcFilePath + QLatin1Char('/') + fileName;
- const QString newTgtFilePath
- = tgtFilePath + QLatin1Char('/') + fileName;
+ FileName newSrcFilePath = srcFilePath;
+ newSrcFilePath.appendPath(fileName);
+ FileName newTgtFilePath = tgtFilePath;
+ newTgtFilePath.appendPath(fileName);
if (!copyRecursively(newSrcFilePath, newTgtFilePath, error))
return false;
}
} else {
- if (!QFile::copy(srcFilePath, tgtFilePath)) {
+ if (!QFile::copy(srcFilePath.toString(), tgtFilePath.toString())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Could not copy file '%1' to '%2'.")
- .arg(QDir::toNativeSeparators(srcFilePath),
- QDir::toNativeSeparators(tgtFilePath));
+ .arg(srcFilePath.toUserOutput(), tgtFilePath.toUserOutput());
}
return false;
}
@@ -167,19 +168,16 @@ bool FileUtils::copyRecursively(const QString &srcFilePath,
\return Whether at least one file in \a filePath has a newer date than \a timeStamp.
*/
-bool FileUtils::isFileNewerThan(const QString &filePath,
- const QDateTime &timeStamp)
+bool FileUtils::isFileNewerThan(const FileName &filePath, const QDateTime &timeStamp)
{
- QFileInfo fileInfo(filePath);
+ QFileInfo fileInfo = filePath.toFileInfo();
if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
return true;
if (fileInfo.isDir()) {
- const QStringList dirContents = QDir(filePath)
+ const QStringList dirContents = QDir(filePath.toString())
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QString &curFileName, dirContents) {
- const QString curFilePath
- = filePath + QLatin1Char('/') + curFileName;
- if (isFileNewerThan(curFilePath, timeStamp))
+ if (isFileNewerThan(FileName(filePath).appendPath(curFileName), timeStamp))
return true;
}
}
@@ -195,15 +193,33 @@ bool FileUtils::isFileNewerThan(const QString &filePath,
return Symlink target file path.
*/
-QString FileUtils::resolveSymlinks(const QString &path)
+FileName FileUtils::resolveSymlinks(const FileName &path)
{
- QFileInfo f(path);
+ QFileInfo f = path.toFileInfo();
int links = 16;
while (links-- && f.isSymLink())
f.setFile(f.symLinkTarget());
if (links <= 0)
- return QString();
- return f.filePath();
+ return FileName();
+ return FileName::fromString(f.filePath());
+}
+
+/*!
+ Like QDir::toNativeSeparators(), but use prefix '~' instead of $HOME on unix systems when an
+ absolute path is given.
+
+ return Possibly shortened path with native separators.
+*/
+QString FileUtils::shortNativePath(const FileName &path)
+{
+ if (HostOsInfo::isAnyUnixHost()) {
+ const FileName home = FileName::fromString(QDir::cleanPath(QDir::homePath()));
+ if (path.isChildOf(home)) {
+ return QLatin1Char('~') + QDir::separator()
+ + QDir::toNativeSeparators(path.relativeChildPath(home).toString());
+ }
+ }
+ return path.toUserOutput();
}
QByteArray FileReader::fetchQrc(const QString &fileName)
@@ -411,13 +427,6 @@ TempFileSaver::~TempFileSaver()
On windows filenames are compared case insensitively.
*/
-
-#ifdef Q_OS_WIN
-Qt::CaseSensitivity FileName::cs = Qt::CaseInsensitive;
-#else
-Qt::CaseSensitivity FileName::cs = Qt::CaseSensitive;
-#endif
-
FileName::FileName()
: QString()
{
@@ -494,7 +503,7 @@ FileName::FileName(const QString &string)
bool FileName::operator==(const FileName &other) const
{
- return QString::compare(*this, other, cs) == 0;
+ return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) == 0;
}
bool FileName::operator!=(const FileName &other) const
@@ -504,12 +513,12 @@ bool FileName::operator!=(const FileName &other) const
bool FileName::operator<(const FileName &other) const
{
- return QString::compare(*this, other, cs) < 0;
+ return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) < 0;
}
bool FileName::operator<=(const FileName &other) const
{
- return QString::compare(*this, other, cs) <= 0;
+ return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) <= 0;
}
bool FileName::operator>(const FileName &other) const
@@ -527,7 +536,7 @@ bool FileName::isChildOf(const FileName &s) const
{
if (s.isEmpty())
return false;
- if (!QString::startsWith(s, cs))
+ if (!QString::startsWith(s, HostOsInfo::fileNameCaseSensitivity()))
return false;
if (size() <= s.size())
return false;
@@ -547,7 +556,7 @@ bool FileName::isChildOf(const QDir &dir) const
/// \returns whether FileName endsWith \a s
bool FileName::endsWith(const QString &s) const
{
- return QString::endsWith(s, cs);
+ return QString::endsWith(s, HostOsInfo::fileNameCaseSensitivity());
}
/// \returns the relativeChildPath of FileName to parent if FileName is a child of parent
@@ -586,10 +595,8 @@ FileName &FileName::append(QChar str)
QT_BEGIN_NAMESPACE
uint qHash(const Utils::FileName &a)
{
-#ifdef Q_OS_WIN
- return qHash(a.toString().toUpper());
-#else
+ if (Utils::HostOsInfo::isWindowsHost())
+ return qHash(a.toString().toUpper());
return qHash(a.toString());
-#endif
}
QT_END_NAMESPACE
diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h
index 1c209e8dfb6..9ccbc056561 100644
--- a/src/libs/utils/fileutils.h
+++ b/src/libs/utils/fileutils.h
@@ -49,14 +49,53 @@ QT_END_NAMESPACE
namespace Utils {
+class QTCREATOR_UTILS_EXPORT FileName : private QString
+{
+public:
+ FileName();
+ explicit FileName(const QFileInfo &info);
+ QFileInfo toFileInfo() const;
+ static FileName fromString(const QString &filename);
+ static FileName fromUserInput(const QString &filename);
+ QString toString() const;
+ QString toUserOutput() const;
+
+ FileName parentDir() const;
+
+ bool operator==(const FileName &other) const;
+ bool operator!=(const FileName &other) const;
+ bool operator<(const FileName &other) const;
+ bool operator<=(const FileName &other) const;
+ bool operator>(const FileName &other) const;
+ bool operator>=(const FileName &other) const;
+
+ bool isChildOf(const FileName &s) const;
+ bool isChildOf(const QDir &dir) const;
+ bool endsWith(const QString &s) const;
+
+ Utils::FileName relativeChildPath(const FileName &parent) const;
+ Utils::FileName &appendPath(const QString &s);
+ Utils::FileName &append(const QString &str);
+ Utils::FileName &append(QChar str);
+
+ using QString::size;
+ using QString::count;
+ using QString::length;
+ using QString::isEmpty;
+ using QString::isNull;
+ using QString::clear;
+private:
+ FileName(const QString &string);
+};
+
class QTCREATOR_UTILS_EXPORT FileUtils {
public:
- static bool removeRecursively(const QString &filePath, QString *error = 0);
- static bool copyRecursively(const QString &srcFilePath,
- const QString &tgtFilePath, QString *error = 0);
- static bool isFileNewerThan(const QString &filePath,
- const QDateTime &timeStamp);
- static QString resolveSymlinks(const QString &path);
+ static bool removeRecursively(const FileName &filePath, QString *error = 0);
+ static bool copyRecursively(const FileName &srcFilePath, const FileName &tgtFilePath,
+ QString *error = 0);
+ static bool isFileNewerThan(const FileName &filePath, const QDateTime &timeStamp);
+ static FileName resolveSymlinks(const FileName &path);
+ static QString shortNativePath(const FileName &path);
};
class QTCREATOR_UTILS_EXPORT FileReader
@@ -138,46 +177,6 @@ private:
bool m_autoRemove;
};
-class QTCREATOR_UTILS_EXPORT FileName : private QString
-{
-public:
- FileName();
- explicit FileName(const QFileInfo &info);
- QFileInfo toFileInfo() const;
- static FileName fromString(const QString &filename);
- static FileName fromUserInput(const QString &filename);
- QString toString() const;
- QString toUserOutput() const;
-
- FileName parentDir() const;
-
- bool operator==(const FileName &other) const;
- bool operator!=(const FileName &other) const;
- bool operator<(const FileName &other) const;
- bool operator<=(const FileName &other) const;
- bool operator>(const FileName &other) const;
- bool operator>=(const FileName &other) const;
-
- bool isChildOf(const FileName &s) const;
- bool isChildOf(const QDir &dir) const;
- bool endsWith(const QString &s) const;
-
- Utils::FileName relativeChildPath(const FileName &parent) const;
- Utils::FileName &appendPath(const QString &s);
- Utils::FileName &append(const QString &str);
- Utils::FileName &append(QChar str);
-
- using QString::size;
- using QString::count;
- using QString::length;
- using QString::isEmpty;
- using QString::isNull;
- using QString::clear;
-private:
- static Qt::CaseSensitivity cs;
- FileName(const QString &string);
-};
-
} // namespace Utils
QT_BEGIN_NAMESPACE
diff --git a/src/libs/utils/filewizarddialog.cpp b/src/libs/utils/filewizarddialog.cpp
index 46e401238b2..63545ef7efc 100644
--- a/src/libs/utils/filewizarddialog.cpp
+++ b/src/libs/utils/filewizarddialog.cpp
@@ -30,6 +30,8 @@
#include "filewizarddialog.h"
#include "filewizardpage.h"
+#include "hostosinfo.h"
+
#include <QAbstractButton>
/*!
@@ -48,15 +50,15 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false);
-#ifdef Q_OS_MAC
- setButtonLayout(QList<QWizard::WizardButton>()
- << QWizard::CancelButton
- << QWizard::Stretch
- << QWizard::BackButton
- << QWizard::NextButton
- << QWizard::CommitButton
- << QWizard::FinishButton);
-#endif
+ if (HostOsInfo::isMacHost()) {
+ setButtonLayout(QList<QWizard::WizardButton>()
+ << QWizard::CancelButton
+ << QWizard::Stretch
+ << QWizard::BackButton
+ << QWizard::NextButton
+ << QWizard::CommitButton
+ << QWizard::FinishButton);
+ }
const int filePageId = addPage(m_filePage);
wizardProgress()->item(filePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
diff --git a/src/libs/utils/filewizardpage.ui b/src/libs/utils/filewizardpage.ui
index 17b78cae6d1..e8b3ca1b4b9 100644
--- a/src/libs/utils/filewizardpage.ui
+++ b/src/libs/utils/filewizardpage.ui
@@ -45,7 +45,7 @@
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
- <header>pathchooser.h</header>
+ <header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp
index 49bfaeaae64..19f0787e713 100644
--- a/src/libs/utils/historycompleter.cpp
+++ b/src/libs/utils/historycompleter.cpp
@@ -138,8 +138,9 @@ bool HistoryCompleterPrivate::removeRows(int row, int count, const QModelIndex &
void HistoryCompleterPrivate::clearHistory()
{
+ beginResetModel();
list.clear();
- reset();
+ endResetModel();
}
void HistoryCompleterPrivate::saveEntry(const QString &str)
diff --git a/src/libs/utils/hostosinfo.h b/src/libs/utils/hostosinfo.h
new file mode 100644
index 00000000000..0f945bb0b61
--- /dev/null
+++ b/src/libs/utils/hostosinfo.h
@@ -0,0 +1,108 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** 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
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+#ifndef HOSTOSINFO_H
+#define HOSTOSINFO_H
+
+#include "utils_global.h"
+
+#include <QString>
+
+#ifdef Q_OS_WIN
+#define QTC_HOST_EXE_SUFFIX ".exe"
+#else
+#define QTC_HOST_EXE_SUFFIX ""
+#endif // Q_OS_WIN
+
+namespace Utils {
+
+class QTCREATOR_UTILS_EXPORT HostOsInfo
+{
+public:
+ // Add more as needed.
+ enum HostOs { HostOsWindows, HostOsLinux, HostOsMac, HostOsOtherUnix, HostOsOther };
+
+ static inline HostOs hostOs();
+
+ static bool isWindowsHost() { return hostOs() == HostOsWindows; }
+ static bool isLinuxHost() { return hostOs() == HostOsLinux; }
+ static bool isMacHost() { return hostOs() == HostOsMac; }
+ static inline bool isAnyUnixHost();
+
+ static QString appendExecutableSuffix(const QString &executable)
+ {
+ QString finalName = executable;
+ if (isWindowsHost())
+ finalName += QLatin1String(QTC_HOST_EXE_SUFFIX);
+ return finalName;
+ }
+
+ static Qt::CaseSensitivity fileNameCaseSensitivity()
+ {
+ return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
+ }
+
+ static QChar pathListSeparator()
+ {
+ return isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
+ }
+
+ static Qt::KeyboardModifier controlModifier()
+ {
+ return isMacHost() ? Qt::MetaModifier : Qt::ControlModifier;
+ }
+};
+
+HostOsInfo::HostOs HostOsInfo::hostOs()
+{
+#if defined(Q_OS_WIN)
+ return HostOsWindows;
+#elif defined(Q_OS_LINUX)
+ return HostOsLinux;
+#elif defined(Q_OS_MAC)
+ return HostOsMac;
+#elif defined(Q_OS_UNIX)
+ return HostOsOtherUnix;
+#else
+ return HostOsOther;
+#endif
+}
+
+bool HostOsInfo::isAnyUnixHost()
+{
+#ifdef Q_OS_UNIX
+ return true;
+#else
+ return false;
+#endif
+}
+
+} // namespace Utils
+
+#endif // HOSTOSINFO_H
diff --git a/src/libs/utils/networkaccessmanager.cpp b/src/libs/utils/networkaccessmanager.cpp
index 54f8c44ed4a..653d41051e5 100644
--- a/src/libs/utils/networkaccessmanager.cpp
+++ b/src/libs/utils/networkaccessmanager.cpp
@@ -29,6 +29,7 @@
#include "networkaccessmanager.h"
+#include <QCoreApplication>
#include <QLocale>
#include <QUrl>
#include <QNetworkReply>
@@ -37,8 +38,6 @@
#include <sys/utsname.h>
#endif
-#include <app/app_version.h>
-
/*!
\class Utils::NetworkManager
@@ -130,8 +129,9 @@ void NetworkAccessManager::getUrl(const QUrl &url)
QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
{
- QString agentStr = QString::fromLatin1("Qt-Creator/%1 (QNetworkAccessManager %2; %3; %4; %5 bit)")
- .arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
+ QString agentStr = QString::fromLatin1("%1/%2 (QNetworkAccessManager %3; %4; %5; %6 bit)")
+ .arg(QCoreApplication::applicationName(),
+ QCoreApplication::applicationVersion(),
QLatin1String(qVersion()),
getOsString(), QLocale::system().name())
.arg(QSysInfo::WordSize);
diff --git a/src/libs/utils/pathlisteditor.cpp b/src/libs/utils/pathlisteditor.cpp
index a51e21fba4e..2eb67581590 100644
--- a/src/libs/utils/pathlisteditor.cpp
+++ b/src/libs/utils/pathlisteditor.cpp
@@ -29,6 +29,8 @@
#include "pathlisteditor.h"
+#include "hostosinfo.h"
+
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPlainTextEdit>
@@ -91,7 +93,7 @@ void PathListPlainTextEdit::insertFromMimeData(const QMimeData *source)
if (source->hasText()) {
// replace separator
QString text = source->text().trimmed();
- text.replace(PathListEditor::separator(), QLatin1Char('\n'));
+ text.replace(HostOsInfo::pathListSeparator(), QLatin1Char('\n'));
QSharedPointer<QMimeData> fixed(new QMimeData);
fixed->setText(text);
QPlainTextEdit::insertFromMimeData(fixed.data());
@@ -187,7 +189,7 @@ int PathListEditor::lastAddActionIndex()
QString PathListEditor::pathListString() const
{
- return pathList().join(separator());
+ return pathList().join(HostOsInfo::pathListSeparator());
}
QStringList PathListEditor::pathList() const
@@ -213,7 +215,8 @@ void PathListEditor::setPathList(const QString &pathString)
if (pathString.isEmpty()) {
clear();
} else {
- setPathList(pathString.split(separator(), QString::SkipEmptyParts));
+ setPathList(pathString.split(HostOsInfo::pathListSeparator(),
+ QString::SkipEmptyParts));
}
}
@@ -251,16 +254,6 @@ void PathListEditor::slotInsert()
insertPathAtCursor(QDir::toNativeSeparators(dir));
}
-QChar PathListEditor::separator()
-{
-#ifdef Q_OS_WIN
- static const QChar rc(QLatin1Char(';'));
-#else
- static const QChar rc(QLatin1Char(':'));
-#endif
- return rc;
-}
-
// Add a button "Import from 'Path'"
void PathListEditor::addEnvVariableImportAction(const QString &var)
{
diff --git a/src/libs/utils/pathlisteditor.h b/src/libs/utils/pathlisteditor.h
index b0ac66d8a49..c885f3514a0 100644
--- a/src/libs/utils/pathlisteditor.h
+++ b/src/libs/utils/pathlisteditor.h
@@ -53,8 +53,6 @@ public:
QStringList pathList() const;
QString fileDialogTitle() const;
- static QChar separator();
-
// Add a convenience action "Import from 'Path'" (environment variable)
void addEnvVariableImportAction(const QString &var);
diff --git a/src/libs/utils/persistentsettings.cpp b/src/libs/utils/persistentsettings.cpp
index f772e13560b..b9e9e377978 100644
--- a/src/libs/utils/persistentsettings.cpp
+++ b/src/libs/utils/persistentsettings.cpp
@@ -29,8 +29,6 @@
#include "persistentsettings.h"
-#include <app/app_version.h>
-
#include <utils/fileutils.h>
#include <QDebug>
@@ -403,8 +401,9 @@ bool PersistentSettingsWriter::write(const QVariantMap &data, QWidget *parent) c
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE ") + m_docType + QLatin1Char('>'));
- w.writeComment(QString::fromAscii(" Written by Qt Creator %1, %2. ").
- arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
+ w.writeComment(QString::fromLatin1(" Written by %1 %2, %3. ").
+ arg(QCoreApplication::applicationName(),
+ QCoreApplication::applicationVersion(),
QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.qtCreatorElement);
const QVariantMap::const_iterator cend = data.constEnd();
diff --git a/src/libs/utils/portlist.cpp b/src/libs/utils/portlist.cpp
index 2b27dd8e4ce..3f643db35ff 100644
--- a/src/libs/utils/portlist.cpp
+++ b/src/libs/utils/portlist.cpp
@@ -116,7 +116,7 @@ private:
}
bool atEnd() const { return m_pos == m_portsSpec.length(); }
- char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); }
+ char nextChar() const { return m_portsSpec.at(m_pos).toLatin1(); }
PortList m_portList;
int m_pos;
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 4ae9afeb3ba..31bb841df6e 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -278,7 +278,7 @@ QStringList QtcProcess::splitArgs(const QString &_args, bool abortOnMeta, SplitE
inline static bool isQuoteMeta(QChar cUnicode)
{
- char c = cUnicode.toAscii();
+ char c = cUnicode.toLatin1();
return c == '\\' || c == '\'' || c == '"' || c == '$';
}
diff --git a/src/libs/utils/savefile.cpp b/src/libs/utils/savefile.cpp
index 9ffde5b505a..bd6278a587e 100644
--- a/src/libs/utils/savefile.cpp
+++ b/src/libs/utils/savefile.cpp
@@ -99,7 +99,8 @@ bool SaveFile::commit()
return false;
}
- QString finalFileName = Utils::FileUtils::resolveSymlinks(m_finalFileName);
+ QString finalFileName
+ = FileUtils::resolveSymlinks(FileName::fromString(m_finalFileName)).toString();
QString bakname = finalFileName + QLatin1Char('~');
QFile::remove(bakname); // Kill old backup
QFile::rename(finalFileName, bakname); // Backup current file
diff --git a/src/libs/utils/stringutils.cpp b/src/libs/utils/stringutils.cpp
index 7fb0bf545bf..9948def8fea 100644
--- a/src/libs/utils/stringutils.cpp
+++ b/src/libs/utils/stringutils.cpp
@@ -29,6 +29,8 @@
#include "stringutils.h"
+#include "hostosinfo.h"
+
#include <QString>
#include <QStringList>
#include <QFileInfo>
@@ -94,19 +96,17 @@ QTCREATOR_UTILS_EXPORT QString commonPath(const QStringList &files)
lastSeparatorPos = common.lastIndexOf(QLatin1Char('\\'));
if (lastSeparatorPos == -1)
return QString();
-#ifdef Q_OS_UNIX
- if (lastSeparatorPos == 0) // Unix: "/a", "/b" -> '/'
+ if (HostOsInfo::isAnyUnixHost() && lastSeparatorPos == 0) // Unix: "/a", "/b" -> '/'
lastSeparatorPos = 1;
-#endif
common.truncate(lastSeparatorPos);
return common;
}
QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
{
-#ifdef Q_OS_WIN
- QString outPath = path;
-#else
+ if (HostOsInfo::isWindowsHost())
+ return path;
+
static const QString homePath = QDir::homePath();
QFileInfo fi(QDir::cleanPath(path));
@@ -115,7 +115,6 @@ QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
outPath = QLatin1Char('~') + outPath.mid(homePath.size());
else
outPath = path;
-#endif
return outPath;
}
diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp
index 43f0b630d48..1a7aaa34725 100644
--- a/src/libs/utils/stylehelper.cpp
+++ b/src/libs/utils/stylehelper.cpp
@@ -29,6 +29,8 @@
#include "stylehelper.h"
+#include "hostosinfo.h"
+
#include <QPixmapCache>
#include <QWidget>
#include <QRect>
@@ -68,11 +70,7 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
qreal StyleHelper::sidebarFontSize()
{
-#if defined(Q_OS_MAC)
- return 10;
-#else
- return 7.5;
-#endif
+ return HostOsInfo::isMacHost() ? 10 : 7.5;
}
QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp
index c7cc525f480..fe18db3706c 100644
--- a/src/libs/utils/synchronousprocess.cpp
+++ b/src/libs/utils/synchronousprocess.cpp
@@ -28,7 +28,8 @@
****************************************************************************/
#include "synchronousprocess.h"
-#include <qtcassert.h>
+#include "qtcassert.h"
+#include "hostosinfo.h"
#include <QDebug>
#include <QTimer>
@@ -598,18 +599,6 @@ bool SynchronousProcess::stopProcess(QProcess &p)
// Path utilities
-enum OS_Type { OS_Mac, OS_Windows, OS_Unix };
-
-#ifdef Q_OS_WIN
-static const OS_Type pathOS = OS_Windows;
-#else
-# ifdef Q_OS_MAC
-static const OS_Type pathOS = OS_Mac;
-# else
-static const OS_Type pathOS = OS_Unix;
-# endif
-#endif
-
// Locate a binary in a directory, applying all kinds of
// extensions the operating system supports.
static QString checkBinary(const QDir &dir, const QString &binary)
@@ -621,16 +610,18 @@ static QString checkBinary(const QDir &dir, const QString &binary)
// Does the OS have some weird extension concept or does the
// binary have a 3 letter extension?
- if (pathOS == OS_Unix)
+ if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
return QString();
const int dotIndex = binary.lastIndexOf(QLatin1Char('.'));
if (dotIndex != -1 && dotIndex == binary.size() - 4)
return QString();
- switch (pathOS) {
- case OS_Unix:
+ switch (HostOsInfo::hostOs()) {
+ case HostOsInfo::HostOsLinux:
+ case HostOsInfo::HostOsOtherUnix:
+ case HostOsInfo::HostOsOther:
break;
- case OS_Windows: {
+ case HostOsInfo::HostOsWindows: {
static const char *windowsExtensions[] = {".cmd", ".bat", ".exe", ".com" };
// Check the Windows extensions using the order
const int windowsExtensionCount = sizeof(windowsExtensions)/sizeof(const char*);
@@ -641,7 +632,7 @@ static QString checkBinary(const QDir &dir, const QString &binary)
}
}
break;
- case OS_Mac: {
+ case HostOsInfo::HostOsMac: {
// Check for Mac app folders
const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app")));
if (appFolder.isDir()) {
@@ -666,13 +657,13 @@ QString SynchronousProcess::locateBinary(const QString &path, const QString &bin
return checkBinary(absInfo.dir(), absInfo.fileName());
// Windows finds binaries in the current directory
- if (pathOS == OS_Windows) {
+ if (HostOsInfo::isWindowsHost()) {
const QString currentDirBinary = checkBinary(QDir::current(), binary);
if (!currentDirBinary.isEmpty())
return currentDirBinary;
}
- const QStringList paths = path.split(pathSeparator());
+ const QStringList paths = path.split(HostOsInfo::pathListSeparator());
if (paths.empty())
return QString();
const QStringList::const_iterator cend = paths.constEnd();
@@ -691,11 +682,4 @@ QString SynchronousProcess::locateBinary(const QString &binary)
return locateBinary(QString::fromLocal8Bit(path), binary);
}
-QChar SynchronousProcess::pathSeparator()
-{
- if (pathOS == OS_Windows)
- return QLatin1Char(';');
- return QLatin1Char(':');
-}
-
} // namespace Utils
diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h
index b89605ef68c..2a6f8c34f43 100644
--- a/src/libs/utils/synchronousprocess.h
+++ b/src/libs/utils/synchronousprocess.h
@@ -139,7 +139,6 @@ public:
// and file types.
static QString locateBinary(const QString &binary);
static QString locateBinary(const QString &path, const QString &binary);
- static QChar pathSeparator();
signals:
void stdOut(const QByteArray &data, bool firstTime);
diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri
index a8a6dfe1b7b..5335d112229 100644
--- a/src/libs/utils/utils-lib.pri
+++ b/src/libs/utils/utils-lib.pri
@@ -79,7 +79,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/basetreeview.cpp \
$$PWD/qtcassert.cpp \
$$PWD/elfreader.cpp \
- $$PWD/bracematcher.cpp
+ $$PWD/bracematcher.cpp \
+ $$PWD/proxyaction.cpp
win32 {
SOURCES += \
@@ -165,7 +166,9 @@ HEADERS += \
$$PWD/appmainwindow.h \
$$PWD/basetreeview.h \
$$PWD/elfreader.h \
- $$PWD/bracematcher.h
+ $$PWD/bracematcher.h \
+ $$PWD/proxyaction.h \
+ $$PWD/hostosinfo.h
FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \
diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro
index 873eb0c437c..9f5d56d644a 100644
--- a/src/libs/utils/utils.pro
+++ b/src/libs/utils/utils.pro
@@ -12,12 +12,6 @@ lessThan(QT_MAJOR_VERSION, 5) {
win32:include(../../private_headers.pri)
}
-HEADERS += \
- proxyaction.h
-
-SOURCES += \
- proxyaction.cpp
-
win32: LIBS += -luser32
# PortsGatherer
win32: LIBS += -liphlpapi -lws2_32
diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs
index 292ae6bb68a..6d93ff3ba29 100644
--- a/src/libs/utils/utils.qbs
+++ b/src/libs/utils/utils.qbs
@@ -5,12 +5,6 @@ QtcLibrary {
name: "Utils"
cpp.defines: base.concat(["QTCREATOR_UTILS_LIB"])
- cpp.includePaths: [
- ".",
- "..",
- "../..",
- buildDirectory
- ]
Properties {
condition: qbs.targetOS == "windows"
@@ -30,21 +24,22 @@ QtcLibrary {
Depends { name: "app_version_header" }
files: [
- "filewizardpage.ui",
- "newclasswidget.ui",
- "projectintropage.ui",
- "utils.qrc",
"annotateditemdelegate.cpp",
"annotateditemdelegate.h",
+ "appmainwindow.cpp",
+ "appmainwindow.h",
"basetreeview.cpp",
"basetreeview.h",
"basevalidatinglineedit.cpp",
"basevalidatinglineedit.h",
"bracematcher.cpp",
"bracematcher.h",
+ "buildablehelperlibrary.cpp",
"buildablehelperlibrary.h",
"changeset.cpp",
"changeset.h",
+ "checkablemessagebox.cpp",
+ "checkablemessagebox.h",
"classnamevalidatinglineedit.cpp",
"classnamevalidatinglineedit.h",
"codegeneration.cpp",
@@ -54,6 +49,7 @@ QtcLibrary {
"consoleprocess.cpp",
"consoleprocess.h",
"consoleprocess_p.h",
+ "crumblepath.cpp",
"crumblepath.h",
"detailsbutton.cpp",
"detailsbutton.h",
@@ -61,6 +57,7 @@ QtcLibrary {
"detailswidget.h",
"elfreader.cpp",
"elfreader.h",
+ "environment.cpp",
"environment.h",
"environmentmodel.cpp",
"environmentmodel.h",
@@ -70,27 +67,31 @@ QtcLibrary {
"fancylineedit.h",
"fancymainwindow.cpp",
"fancymainwindow.h",
- "appmainwindow.h",
- "appmainwindow.cpp",
"fileinprojectfinder.cpp",
"fileinprojectfinder.h",
+ "filenamevalidatinglineedit.cpp",
"filenamevalidatinglineedit.h",
"filesearch.cpp",
"filesearch.h",
"filesystemwatcher.cpp",
"filesystemwatcher.h",
+ "fileutils.cpp",
"fileutils.h",
"filewizarddialog.cpp",
"filewizarddialog.h",
"filewizardpage.cpp",
"filewizardpage.h",
+ "filewizardpage.ui",
"filterlineedit.cpp",
"filterlineedit.h",
"flowlayout.cpp",
"flowlayout.h",
+ "historycompleter.cpp",
"historycompleter.h",
+ "hostosinfo.h",
"htmldocextractor.cpp",
"htmldocextractor.h",
+ "ipaddresslineedit.cpp",
"ipaddresslineedit.h",
"iwelcomepage.cpp",
"iwelcomepage.h",
@@ -99,11 +100,14 @@ QtcLibrary {
"linecolumnlabel.cpp",
"linecolumnlabel.h",
"listutils.h",
+ "multitask.h",
"navigationtreeview.cpp",
"navigationtreeview.h",
+ "networkaccessmanager.cpp",
"networkaccessmanager.h",
"newclasswidget.cpp",
"newclasswidget.h",
+ "newclasswidget.ui",
"outputformat.h",
"outputformatter.cpp",
"outputformatter.h",
@@ -111,23 +115,34 @@ QtcLibrary {
"parameteraction.h",
"pathchooser.cpp",
"pathchooser.h",
+ "pathlisteditor.cpp",
"pathlisteditor.h",
+ "persistentsettings.cpp",
+ "persistentsettings.h",
+ "portlist.cpp",
+ "portlist.h",
"projectintropage.cpp",
"projectintropage.h",
+ "projectintropage.ui",
"projectnamevalidatinglineedit.cpp",
"projectnamevalidatinglineedit.h",
+ "proxyaction.cpp",
"proxyaction.h",
- "qtcassert.h",
"qtcassert.cpp",
+ "qtcassert.h",
"qtcolorbutton.cpp",
"qtcolorbutton.h",
+ "qtcprocess.cpp",
"qtcprocess.h",
"reloadpromptutils.cpp",
"reloadpromptutils.h",
+ "runextensions.h",
+ "savedaction.cpp",
"savedaction.h",
"savefile.cpp",
"savefile.h",
"settingsselector.cpp",
+ "settingsselector.h",
"settingsutils.h",
"statuslabel.cpp",
"statuslabel.h",
@@ -135,6 +150,7 @@ QtcLibrary {
"stringutils.h",
"styledbar.cpp",
"styledbar.h",
+ "stylehelper.cpp",
"stylehelper.h",
"submiteditorwidget.cpp",
"submiteditorwidget.h",
@@ -151,31 +167,10 @@ QtcLibrary {
"treewidgetcolumnstretcher.h",
"uncommentselection.cpp",
"uncommentselection.h",
+ "utils.qrc",
"utils_global.h",
"wizard.cpp",
"wizard.h",
- "persistentsettings.h",
- "settingsselector.h",
- "buildablehelperlibrary.cpp",
- "checkablemessagebox.cpp",
- "checkablemessagebox.h",
- "crumblepath.cpp",
- "environment.cpp",
- "filenamevalidatinglineedit.cpp",
- "fileutils.cpp",
- "historycompleter.cpp",
- "ipaddresslineedit.cpp",
- "networkaccessmanager.cpp",
- "pathlisteditor.cpp",
- "persistentsettings.cpp",
- "portlist.cpp",
- "portlist.h",
- "proxyaction.cpp",
- "qtcprocess.cpp",
- "savedaction.cpp",
- "stylehelper.cpp",
- "multitask.h",
- "runextensions.h",
"images/arrow.png",
"images/crumblepath-segment-end.png",
"images/crumblepath-segment-hover-end.png",
@@ -206,15 +201,13 @@ QtcLibrary {
Group {
condition: qbs.targetOS == "linux"
files: [
+ "unixutils.cpp",
"unixutils.h",
- "unixutils.cpp"
]
}
ProductModule {
- Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["concurrent", "widgets" ] }
- cpp.includePaths: [".."]
}
}
diff --git a/src/libs/zeroconf/embeddedLib.cpp b/src/libs/zeroconf/embeddedLib.cpp
index c8bdb6a6242..912ac24cae8 100644
--- a/src/libs/zeroconf/embeddedLib.cpp
+++ b/src/libs/zeroconf/embeddedLib.cpp
@@ -128,7 +128,7 @@ public:
logger->appendError(ErrorMessage::NoteLevel,
ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n")
.arg(name())
- .arg(QString::fromAscii(logBA.constData(), logBA.size())));
+ .arg(QString::fromLatin1(logBA.constData(), logBA.size())));
qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString();
}
oldLog.close();
diff --git a/src/libs/zeroconf/zeroconf.qbs b/src/libs/zeroconf/zeroconf.qbs
index fcc98878a15..04274fd6f69 100644
--- a/src/libs/zeroconf/zeroconf.qbs
+++ b/src/libs/zeroconf/zeroconf.qbs
@@ -6,8 +6,8 @@ QtcLibrary {
Depends { name: "cpp" }
Depends { name: "Qt.network" }
+ cpp.includePaths: base.concat(".")
- cpp.includePaths: "."
cpp.defines: base.concat("ZEROCONF_LIBRARY")
Properties {
@@ -26,21 +26,16 @@ QtcLibrary {
}
files: [
- "servicebrowser.cpp",
- "servicebrowser.h",
- "servicebrowser_p.h",
- "embeddedLib.cpp",
- "mdnsderived.cpp",
- "mdnsderived.h",
"avahiLib.cpp",
"dnsSdLib.cpp",
"dns_sd_types.h",
+ "embeddedLib.cpp",
+ "mdnsderived.cpp",
+ "mdnsderived.h",
+ "servicebrowser.cpp",
+ "servicebrowser.h",
+ "servicebrowser_p.h",
+ "syssocket.h",
"zeroconf_global.h",
- "syssocket.h"
]
-
- ProductModule {
- Depends { name: "cpp" }
- cpp.includePaths: ["."]
- }
}