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
d4e1a24d
Commit
d4e1a24d
authored
May 28, 2010
by
Erik Verbruggen
Browse files
Fixed off-by-1-token for symbol end offsets.
parent
1b3e9db0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/CheckDeclaration.cpp
View file @
d4e1a24d
...
...
@@ -231,7 +231,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
Declaration
*
symbol
=
control
()
->
newDeclaration
(
location
,
name
);
symbol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
symbol
->
setType
(
declTy
);
if
(
declTy
.
isDeprecated
())
...
...
@@ -322,7 +322,7 @@ bool CheckDeclaration::visit(ExceptionDeclarationAST *ast)
Declaration
*
symbol
=
control
()
->
newDeclaration
(
location
,
name
);
symbol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
symbol
->
setType
(
declTy
);
_scope
->
enterSymbol
(
symbol
);
...
...
@@ -349,7 +349,7 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
if
(
ty
.
isUnavailable
())
fun
->
setUnavailable
(
true
);
fun
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
fun
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
fun
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
if
(
ast
->
declarator
)
fun
->
setSourceLocation
(
ast
->
declarator
->
firstToken
(),
translationUnit
());
fun
->
setName
(
name
);
...
...
@@ -415,7 +415,7 @@ bool CheckDeclaration::visit(NamespaceAST *ast)
Namespace
*
ns
=
control
()
->
newNamespace
(
sourceLocation
,
namespaceName
);
ns
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
ns
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
ns
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
ns
;
_scope
->
enterSymbol
(
ns
);
semantic
()
->
check
(
ast
->
linkage_body
,
ns
->
members
());
// ### we'll do the merge later.
...
...
@@ -440,7 +440,7 @@ bool CheckDeclaration::visit(NamespaceAliasDefinitionAST *ast)
NamespaceAlias
*
namespaceAlias
=
control
()
->
newNamespaceAlias
(
sourceLocation
,
name
);
namespaceAlias
->
setNamespaceName
(
namespaceName
);
namespaceAlias
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
namespaceAlias
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
namespaceAlias
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
//ast->symbol = namespaceAlias;
_scope
->
enterSymbol
(
namespaceAlias
);
...
...
@@ -574,7 +574,7 @@ bool CheckDeclaration::visit(ObjCProtocolForwardDeclarationAST *ast)
const
Name
*
protocolName
=
semantic
()
->
check
(
it
->
value
,
_scope
);
ObjCForwardProtocolDeclaration
*
fwdProtocol
=
control
()
->
newObjCForwardProtocolDeclaration
(
sourceLocation
,
protocolName
);
fwdProtocol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
fwdProtocol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
fwdProtocol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
_scope
->
enterSymbol
(
fwdProtocol
);
...
...
@@ -597,7 +597,7 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
const
Name
*
protocolName
=
semantic
()
->
check
(
ast
->
name
,
_scope
);
ObjCProtocol
*
protocol
=
control
()
->
newObjCProtocol
(
sourceLocation
,
protocolName
);
protocol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
protocol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
protocol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
if
(
ast
->
protocol_refs
&&
ast
->
protocol_refs
->
identifier_list
)
{
for
(
NameListAST
*
iter
=
ast
->
protocol_refs
->
identifier_list
;
iter
;
iter
=
iter
->
next
)
{
...
...
@@ -635,7 +635,7 @@ bool CheckDeclaration::visit(ObjCClassForwardDeclarationAST *ast)
const
Name
*
className
=
semantic
()
->
check
(
it
->
value
,
_scope
);
ObjCForwardClassDeclaration
*
fwdClass
=
control
()
->
newObjCForwardClassDeclaration
(
sourceLocation
,
className
);
fwdClass
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
fwdClass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
fwdClass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
_scope
->
enterSymbol
(
fwdClass
);
...
...
@@ -658,7 +658,7 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
const
Name
*
className
=
semantic
()
->
check
(
ast
->
class_name
,
_scope
);
ObjCClass
*
klass
=
control
()
->
newObjCClass
(
sourceLocation
,
className
);
klass
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
klass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
klass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
klass
;
klass
->
setInterface
(
ast
->
interface_token
!=
0
);
...
...
@@ -733,7 +733,7 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
}
symbol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
symbol
->
setVisibility
(
semantic
()
->
currentObjCVisibility
());
if
(
ty
.
isDeprecated
())
symbol
->
setDeprecated
(
true
);
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
d4e1a24d
...
...
@@ -326,7 +326,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
const
Name
*
className
=
semantic
()
->
check
(
ast
->
name
,
_scope
);
Class
*
klass
=
control
()
->
newClass
(
sourceLocation
,
className
);
klass
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
klass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
klass
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
klass
;
unsigned
classKey
=
tokenKind
(
ast
->
classkey_token
);
if
(
classKey
==
T_CLASS
)
...
...
@@ -413,7 +413,7 @@ bool CheckSpecifier::visit(EnumSpecifierAST *ast)
const
Name
*
name
=
semantic
()
->
check
(
ast
->
name
,
_scope
);
Enum
*
e
=
control
()
->
newEnum
(
sourceLocation
,
name
);
e
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
e
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
e
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
e
->
setVisibility
(
semantic
()
->
currentVisibility
());
_scope
->
enterSymbol
(
e
);
_fullySpecifiedType
.
setType
(
e
);
...
...
src/shared/cplusplus/CheckStatement.cpp
View file @
d4e1a24d
...
...
@@ -112,7 +112,7 @@ bool CheckStatement::visit(CompoundStatementAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
lbrace_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -177,7 +177,7 @@ bool CheckStatement::forEachFastEnum(unsigned firstToken,
{
Block
*
block
=
control
()
->
newBlock
(
firstToken
);
block
->
setStartOffset
(
tokenAt
(
firstToken
).
offset
);
block
->
setEndOffset
(
tokenAt
(
lastToken
).
offset
);
block
->
setEndOffset
(
tokenAt
(
lastToken
-
1
).
end
()
);
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -230,7 +230,7 @@ bool CheckStatement::visit(ForStatementAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
for_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -247,7 +247,7 @@ bool CheckStatement::visit(IfStatementAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
if_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -294,7 +294,7 @@ bool CheckStatement::visit(SwitchStatementAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
switch_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -319,7 +319,7 @@ bool CheckStatement::visit(CatchClauseAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
catch_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
@@ -334,7 +334,7 @@ bool CheckStatement::visit(WhileStatementAST *ast)
{
Block
*
block
=
control
()
->
newBlock
(
ast
->
while_token
);
block
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
).
offset
);
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
()
);
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
...
...
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