Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
0497c535
Commit
0497c535
authored
Jun 05, 2009
by
Roberto Raggi
Browse files
cleanup
parent
b409202b
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
0497c535
...
...
@@ -333,8 +333,8 @@ BaseSpecifierAST *BaseSpecifierAST::clone(MemoryPool *pool) const
{
BaseSpecifierAST
*
ast
=
new
(
pool
)
BaseSpecifierAST
;
ast
->
comma_token
=
comma_token
;
ast
->
token_
virtual
=
token
_
virtual
;
ast
->
token_
access_specifier
=
token
_
access_specifier
;
ast
->
virtual
_
token
=
virtual
_token
;
ast
->
access_specifier
_
token
=
access_specifier
_token
;
if
(
name
)
ast
->
name
=
name
->
clone
(
pool
);
if
(
next
)
...
...
@@ -352,8 +352,8 @@ void BaseSpecifierAST::accept0(ASTVisitor *visitor)
unsigned
BaseSpecifierAST
::
firstToken
()
const
{
if
(
token_
virtual
&&
token
_
access_specifier
)
return
std
::
min
(
token_
virtual
,
token
_
access_specifier
);
if
(
virtual
_
token
&&
access_specifier
_token
)
return
std
::
min
(
virtual
_
token
,
access_specifier
_token
);
return
name
->
firstToken
();
}
...
...
@@ -361,12 +361,12 @@ unsigned BaseSpecifierAST::lastToken() const
{
if
(
name
)
return
name
->
lastToken
();
else
if
(
token_
virtual
&&
token
_
access_specifier
)
return
std
::
min
(
token_
virtual
,
token
_
access_specifier
)
+
1
;
else
if
(
token_
virtual
)
return
token_
virtual
+
1
;
else
if
(
token_
access_specifier
)
return
token_
access_specifier
+
1
;
else
if
(
virtual
_
token
&&
access_specifier
_token
)
return
std
::
min
(
virtual
_
token
,
access_specifier
_token
)
+
1
;
else
if
(
virtual
_token
)
return
virtual
_token
+
1
;
else
if
(
access_specifier
_token
)
return
access_specifier
_token
+
1
;
// assert?
return
0
;
}
...
...
@@ -441,7 +441,7 @@ unsigned BinaryExpressionAST::lastToken() const
BoolLiteralAST
*
BoolLiteralAST
::
clone
(
MemoryPool
*
pool
)
const
{
BoolLiteralAST
*
ast
=
new
(
pool
)
BoolLiteralAST
;
ast
->
token
=
token
;
ast
->
literal_token
=
literal_
token
;
return
ast
;
}
...
...
@@ -454,12 +454,12 @@ void BoolLiteralAST::accept0(ASTVisitor *visitor)
unsigned
BoolLiteralAST
::
firstToken
()
const
{
return
token
;
return
literal_
token
;
}
unsigned
BoolLiteralAST
::
lastToken
()
const
{
return
token
+
1
;
return
literal_
token
+
1
;
}
CompoundLiteralAST
*
CompoundLiteralAST
::
clone
(
MemoryPool
*
pool
)
const
...
...
@@ -1928,7 +1928,7 @@ LinkageSpecificationAST *LinkageSpecificationAST::clone(MemoryPool *pool) const
{
LinkageSpecificationAST
*
ast
=
new
(
pool
)
LinkageSpecificationAST
;
ast
->
extern_token
=
extern_token
;
ast
->
extern_type
=
extern_type
;
ast
->
extern_type
_token
=
extern_type
_token
;
if
(
declaration
)
ast
->
declaration
=
declaration
->
clone
(
pool
);
return
ast
;
...
...
@@ -1951,8 +1951,8 @@ unsigned LinkageSpecificationAST::lastToken() const
{
if
(
declaration
)
return
declaration
->
lastToken
();
else
if
(
extern_type
)
return
extern_type
+
1
;
else
if
(
extern_type
_token
)
return
extern_type
_token
+
1
;
return
extern_token
+
1
;
}
...
...
@@ -2101,7 +2101,7 @@ NamespaceAliasDefinitionAST *NamespaceAliasDefinitionAST::clone(MemoryPool *pool
{
NamespaceAliasDefinitionAST
*
ast
=
new
(
pool
)
NamespaceAliasDefinitionAST
;
ast
->
namespace_token
=
namespace_token
;
ast
->
namespace_name
=
namespace_name
;
ast
->
namespace_name
_token
=
namespace_name
_token
;
ast
->
equal_token
=
equal_token
;
if
(
name
)
ast
->
name
=
name
->
clone
(
pool
);
...
...
@@ -2130,8 +2130,8 @@ unsigned NamespaceAliasDefinitionAST::lastToken() const
return
name
->
lastToken
();
else
if
(
equal_token
)
return
equal_token
+
1
;
else
if
(
namespace_name
)
return
namespace_name
+
1
;
else
if
(
namespace_name
_token
)
return
namespace_name
_token
+
1
;
return
namespace_token
+
1
;
}
...
...
@@ -2438,7 +2438,7 @@ unsigned NewTypeIdAST::lastToken() const
NumericLiteralAST
*
NumericLiteralAST
::
clone
(
MemoryPool
*
pool
)
const
{
NumericLiteralAST
*
ast
=
new
(
pool
)
NumericLiteralAST
;
ast
->
token
=
token
;
ast
->
literal_token
=
literal_
token
;
return
ast
;
}
...
...
@@ -2451,12 +2451,12 @@ void NumericLiteralAST::accept0(ASTVisitor *visitor)
unsigned
NumericLiteralAST
::
firstToken
()
const
{
return
token
;
return
literal_
token
;
}
unsigned
NumericLiteralAST
::
lastToken
()
const
{
return
token
+
1
;
return
literal_
token
+
1
;
}
OperatorAST
*
OperatorAST
::
clone
(
MemoryPool
*
pool
)
const
...
...
@@ -3005,7 +3005,7 @@ unsigned SizeofExpressionAST::lastToken() const
StringLiteralAST
*
StringLiteralAST
::
clone
(
MemoryPool
*
pool
)
const
{
StringLiteralAST
*
ast
=
new
(
pool
)
StringLiteralAST
;
ast
->
token
=
token
;
ast
->
literal_token
=
literal_
token
;
if
(
next
)
ast
->
next
=
next
->
clone
(
pool
);
return
ast
;
...
...
@@ -3021,14 +3021,14 @@ void StringLiteralAST::accept0(ASTVisitor *visitor)
unsigned
StringLiteralAST
::
firstToken
()
const
{
return
token
;
return
literal_
token
;
}
unsigned
StringLiteralAST
::
lastToken
()
const
{
if
(
next
)
return
next
->
lastToken
();
return
token
+
1
;
return
literal_
token
+
1
;
}
SwitchStatementAST
*
SwitchStatementAST
::
clone
(
MemoryPool
*
pool
)
const
...
...
src/shared/cplusplus/AST.h
View file @
0497c535
...
...
@@ -488,8 +488,8 @@ class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
{
public:
unsigned
comma_token
;
unsigned
token_
virtual
;
unsigned
token_
access_specifier
;
unsigned
virtual
_token
;
unsigned
access_specifier
_token
;
NameAST
*
name
;
BaseSpecifierAST
*
next
;
...
...
@@ -1218,7 +1218,7 @@ class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
{
public:
unsigned
extern_token
;
unsigned
extern_type
;
unsigned
extern_type
_token
;
DeclarationAST
*
declaration
;
public:
...
...
@@ -1431,7 +1431,7 @@ class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
{
public:
unsigned
namespace_token
;
unsigned
namespace_name
;
unsigned
namespace_name
_token
;
unsigned
equal_token
;
NameAST
*
name
;
unsigned
semicolon_token
;
...
...
@@ -1964,7 +1964,7 @@ protected:
class
CPLUSPLUS_EXPORT
NumericLiteralAST
:
public
ExpressionAST
{
public:
unsigned
token
;
unsigned
literal_
token
;
public:
virtual
NumericLiteralAST
*
asNumericLiteral
()
...
...
@@ -1982,7 +1982,7 @@ protected:
class
CPLUSPLUS_EXPORT
BoolLiteralAST
:
public
ExpressionAST
{
public:
unsigned
token
;
unsigned
literal_
token
;
public:
virtual
BoolLiteralAST
*
asBoolLiteral
()
...
...
@@ -2038,7 +2038,7 @@ protected:
class
CPLUSPLUS_EXPORT
StringLiteralAST
:
public
ExpressionAST
{
public:
unsigned
token
;
unsigned
literal_
token
;
StringLiteralAST
*
next
;
public:
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
0497c535
...
...
@@ -321,10 +321,10 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
Name
*
baseClassName
=
semantic
()
->
check
(
base
->
name
,
_scope
);
BaseClass
*
baseClass
=
control
()
->
newBaseClass
(
ast
->
firstToken
(),
baseClassName
);
base
->
symbol
=
baseClass
;
if
(
base
->
token_
virtual
)
if
(
base
->
virtual
_token
)
baseClass
->
setVirtual
(
true
);
if
(
base
->
token_
access_specifier
)
{
int
accessSpecifier
=
tokenKind
(
base
->
token_
access_specifier
);
if
(
base
->
access_specifier
_token
)
{
int
accessSpecifier
=
tokenKind
(
base
->
access_specifier
_token
);
int
visibility
=
semantic
()
->
visibilityForAccessSpecifier
(
accessSpecifier
);
baseClass
->
setVisibility
(
visibility
);
}
...
...
src/shared/cplusplus/Parser.cpp
View file @
0497c535
...
...
@@ -450,7 +450,7 @@ bool Parser::parseLinkageSpecification(DeclarationAST *&node)
if
(
LA
()
==
T_EXTERN
&&
LA
(
2
)
==
T_STRING_LITERAL
)
{
LinkageSpecificationAST
*
ast
=
new
(
_pool
)
LinkageSpecificationAST
;
ast
->
extern_token
=
consumeToken
();
ast
->
extern_type
=
consumeToken
();
ast
->
extern_type
_token
=
consumeToken
();
if
(
LA
()
==
T_LBRACE
)
parseLinkageBody
(
ast
->
declaration
);
...
...
@@ -503,7 +503,7 @@ bool Parser::parseNamespace(DeclarationAST *&node)
NamespaceAliasDefinitionAST
*
ast
=
new
(
_pool
)
NamespaceAliasDefinitionAST
;
ast
->
namespace_token
=
namespace_token
;
ast
->
namespace_name
=
consumeToken
();
ast
->
namespace_name
_token
=
consumeToken
();
ast
->
equal_token
=
consumeToken
();
parseName
(
ast
->
name
);
match
(
T_SEMICOLON
,
&
ast
->
semicolon_token
);
...
...
@@ -1694,18 +1694,18 @@ bool Parser::parseBaseSpecifier(BaseSpecifierAST *&node)
BaseSpecifierAST
*
ast
=
new
(
_pool
)
BaseSpecifierAST
;
if
(
LA
()
==
T_VIRTUAL
)
{
ast
->
token_
virtual
=
consumeToken
();
ast
->
virtual
_token
=
consumeToken
();
int
tk
=
LA
();
if
(
tk
==
T_PUBLIC
||
tk
==
T_PROTECTED
||
tk
==
T_PRIVATE
)
ast
->
token_
access_specifier
=
consumeToken
();
ast
->
access_specifier
_token
=
consumeToken
();
}
else
{
int
tk
=
LA
();
if
(
tk
==
T_PUBLIC
||
tk
==
T_PROTECTED
||
tk
==
T_PRIVATE
)
ast
->
token_
access_specifier
=
consumeToken
();
ast
->
access_specifier
_token
=
consumeToken
();
if
(
LA
()
==
T_VIRTUAL
)
ast
->
token_
virtual
=
consumeToken
();
ast
->
virtual
_token
=
consumeToken
();
}
parseName
(
ast
->
name
);
...
...
@@ -1794,7 +1794,7 @@ bool Parser::parseStringLiteral(ExpressionAST *&node)
while
(
LA
()
==
T_STRING_LITERAL
||
LA
()
==
T_WIDE_STRING_LITERAL
)
{
*
ast
=
new
(
_pool
)
StringLiteralAST
;
(
*
ast
)
->
token
=
consumeToken
();
(
*
ast
)
->
literal_
token
=
consumeToken
();
ast
=
&
(
*
ast
)
->
next
;
}
return
true
;
...
...
@@ -2215,7 +2215,7 @@ bool Parser::parseNamespaceAliasDefinition(DeclarationAST *&node)
if
(
LA
()
==
T_NAMESPACE
&&
LA
(
2
)
==
T_IDENTIFIER
&&
LA
(
3
)
==
T_EQUAL
)
{
NamespaceAliasDefinitionAST
*
ast
=
new
(
_pool
)
NamespaceAliasDefinitionAST
;
ast
->
namespace_token
=
consumeToken
();
ast
->
namespace_name
=
consumeToken
();
ast
->
namespace_name
_token
=
consumeToken
();
ast
->
equal_token
=
consumeToken
();
parseName
(
ast
->
name
);
match
(
T_SEMICOLON
,
&
ast
->
semicolon_token
);
...
...
@@ -2622,7 +2622,7 @@ bool Parser::parseBoolLiteral(ExpressionAST *&node)
{
if
(
LA
()
==
T_TRUE
||
LA
()
==
T_FALSE
)
{
BoolLiteralAST
*
ast
=
new
(
_pool
)
BoolLiteralAST
;
ast
->
token
=
consumeToken
();
ast
->
literal_
token
=
consumeToken
();
node
=
ast
;
return
true
;
}
...
...
@@ -2634,7 +2634,7 @@ bool Parser::parseNumericLiteral(ExpressionAST *&node)
if
(
LA
()
==
T_INT_LITERAL
||
LA
()
==
T_FLOAT_LITERAL
||
LA
()
==
T_CHAR_LITERAL
||
LA
()
==
T_WIDE_CHAR_LITERAL
)
{
NumericLiteralAST
*
ast
=
new
(
_pool
)
NumericLiteralAST
;
ast
->
token
=
consumeToken
();
ast
->
literal_
token
=
consumeToken
();
node
=
ast
;
return
true
;
}
...
...
@@ -2733,7 +2733,7 @@ bool Parser::parseObjCStringLiteral(ExpressionAST *&node)
while
(
LA
()
==
T_AT_STRING_LITERAL
)
{
*
ast
=
new
(
_pool
)
StringLiteralAST
;
(
*
ast
)
->
token
=
consumeToken
();
(
*
ast
)
->
literal_
token
=
consumeToken
();
ast
=
&
(
*
ast
)
->
next
;
}
return
true
;
...
...
src/shared/cplusplus/PrettyPrinter.cpp
View file @
0497c535
...
...
@@ -192,8 +192,8 @@ bool PrettyPrinter::visit(AttributeAST *ast)
bool
PrettyPrinter
::
visit
(
BaseSpecifierAST
*
ast
)
{
outToken
(
ast
->
token_
virtual
);
outToken
(
ast
->
token_
access_specifier
);
outToken
(
ast
->
virtual
_token
);
outToken
(
ast
->
access_specifier
_token
);
accept
(
ast
->
name
);
return
false
;
}
...
...
@@ -208,7 +208,7 @@ bool PrettyPrinter::visit(BinaryExpressionAST *ast)
bool
PrettyPrinter
::
visit
(
BoolLiteralAST
*
ast
)
{
outToken
(
ast
->
token
);
outToken
(
ast
->
literal_
token
);
return
false
;
}
...
...
@@ -636,8 +636,8 @@ bool PrettyPrinter::visit(LinkageBodyAST *ast)
bool
PrettyPrinter
::
visit
(
LinkageSpecificationAST
*
ast
)
{
outToken
(
ast
->
extern_token
);
if
(
ast
->
extern_type
)
{
outToken
(
ast
->
extern_type
);
if
(
ast
->
extern_type
_token
)
{
outToken
(
ast
->
extern_type
_token
);
}
accept
(
ast
->
declaration
);
...
...
@@ -681,7 +681,7 @@ bool PrettyPrinter::visit(NamespaceAST *ast)
bool
PrettyPrinter
::
visit
(
NamespaceAliasDefinitionAST
*
ast
)
{
outToken
(
ast
->
namespace_token
);
outToken
(
ast
->
namespace_name
);
outToken
(
ast
->
namespace_name
_token
);
outToken
(
ast
->
equal_token
);
accept
(
ast
->
name
);
outToken
(
ast
->
semicolon_token
);
...
...
@@ -770,7 +770,7 @@ bool PrettyPrinter::visit(NewTypeIdAST *ast)
bool
PrettyPrinter
::
visit
(
NumericLiteralAST
*
ast
)
{
outToken
(
ast
->
token
);
outToken
(
ast
->
literal_
token
);
return
false
;
}
...
...
@@ -913,7 +913,7 @@ bool PrettyPrinter::visit(SizeofExpressionAST *ast)
bool
PrettyPrinter
::
visit
(
StringLiteralAST
*
ast
)
{
for
(
StringLiteralAST
*
it
=
ast
;
it
;
it
=
it
->
next
)
{
outToken
(
it
->
token
);
outToken
(
it
->
literal_
token
);
}
return
false
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment