Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
c12866a4
Commit
c12866a4
authored
Sep 02, 2010
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge CPlusPlus::NameId and CPlusPlus::Identifier.
parent
8b2eeb9c
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
69 additions
and
131 deletions
+69
-131
src/libs/cplusplus/CppRewriter.cpp
src/libs/cplusplus/CppRewriter.cpp
+2
-2
src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
+4
-5
src/libs/cplusplus/FindUsages.cpp
src/libs/cplusplus/FindUsages.cpp
+1
-1
src/libs/cplusplus/LookupContext.cpp
src/libs/cplusplus/LookupContext.cpp
+2
-2
src/libs/cplusplus/LookupContext.h
src/libs/cplusplus/LookupContext.h
+3
-3
src/libs/cplusplus/NamePrettyPrinter.cpp
src/libs/cplusplus/NamePrettyPrinter.cpp
+1
-1
src/libs/cplusplus/NamePrettyPrinter.h
src/libs/cplusplus/NamePrettyPrinter.h
+1
-1
src/libs/cplusplus/ResolveExpression.cpp
src/libs/cplusplus/ResolveExpression.cpp
+2
-2
src/plugins/cppeditor/cppquickfixes.cpp
src/plugins/cppeditor/cppquickfixes.cpp
+1
-1
src/plugins/cpptools/cppcodecompletion.cpp
src/plugins/cpptools/cppcodecompletion.cpp
+1
-1
src/shared/cplusplus/Bind.cpp
src/shared/cplusplus/Bind.cpp
+12
-10
src/shared/cplusplus/CPlusPlusForwardDeclarations.h
src/shared/cplusplus/CPlusPlusForwardDeclarations.h
+1
-1
src/shared/cplusplus/Control.cpp
src/shared/cplusplus/Control.cpp
+0
-20
src/shared/cplusplus/Control.h
src/shared/cplusplus/Control.h
+0
-3
src/shared/cplusplus/Literals.cpp
src/shared/cplusplus/Literals.cpp
+17
-1
src/shared/cplusplus/Literals.h
src/shared/cplusplus/Literals.h
+13
-3
src/shared/cplusplus/Name.h
src/shared/cplusplus/Name.h
+1
-1
src/shared/cplusplus/NameVisitor.h
src/shared/cplusplus/NameVisitor.h
+1
-1
src/shared/cplusplus/Names.cpp
src/shared/cplusplus/Names.cpp
+0
-26
src/shared/cplusplus/Names.h
src/shared/cplusplus/Names.h
+0
-20
src/shared/cplusplus/Scope.cpp
src/shared/cplusplus/Scope.cpp
+1
-20
src/shared/cplusplus/Scope.h
src/shared/cplusplus/Scope.h
+0
-1
src/shared/cplusplus/Symbol.cpp
src/shared/cplusplus/Symbol.cpp
+1
-1
tests/auto/cplusplus/semantic/tst_semantic.cpp
tests/auto/cplusplus/semantic/tst_semantic.cpp
+2
-2
tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp
...uto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp
+2
-2
No files found.
src/libs/cplusplus/CppRewriter.cpp
View file @
c12866a4
...
...
@@ -242,9 +242,9 @@ public:
temps
.
append
(
control
()
->
qualifiedNameId
(
base
,
n
));
}
virtual
void
visit
(
const
NameId
*
name
)
virtual
void
visit
(
const
Identifier
*
name
)
{
temps
.
append
(
control
()
->
nameId
(
identifier
(
name
->
identifier
()
)));
temps
.
append
(
control
()
->
identifier
(
name
->
chars
(),
name
->
size
(
)));
}
virtual
void
visit
(
const
TemplateNameId
*
name
)
...
...
src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
View file @
c12866a4
...
...
@@ -231,7 +231,7 @@ private:
return
previousType
;
}
virtual
void
visit
(
const
NameId
*
name
)
virtual
void
visit
(
const
Identifier
*
name
)
{
int
index
=
findSubstitution
(
name
->
identifier
());
...
...
@@ -261,10 +261,9 @@ private:
if
(
!
name
)
return
name
;
else
if
(
const
Name
*
nameId
=
name
->
asNameId
())
{
const
Identifier
*
id
=
control
()
->
identifier
(
nameId
->
identifier
()
->
chars
(),
nameId
->
identifier
()
->
size
());
return
control
()
->
nameId
(
id
);
else
if
(
const
Identifier
*
nameId
=
name
->
asNameId
())
{
const
Identifier
*
id
=
control
()
->
identifier
(
nameId
->
chars
(),
nameId
->
size
());
return
id
;
}
else
if
(
const
TemplateNameId
*
templId
=
name
->
asTemplateNameId
())
{
QVarLengthArray
<
FullySpecifiedType
,
8
>
arguments
(
templId
->
templateArgumentCount
());
...
...
src/libs/cplusplus/FindUsages.cpp
View file @
c12866a4
...
...
@@ -135,7 +135,7 @@ void FindUsages::reportResult(unsigned tokenIndex, const Name *name, Scope *scop
void
FindUsages
::
reportResult
(
unsigned
tokenIndex
,
const
Identifier
*
id
,
Scope
*
scope
)
{
reportResult
(
tokenIndex
,
control
()
->
nameId
(
id
)
,
scope
);
reportResult
(
tokenIndex
,
id
,
scope
);
}
void
FindUsages
::
reportResult
(
unsigned
tokenIndex
,
const
QList
<
LookupItem
>
&
candidates
)
...
...
src/libs/cplusplus/LookupContext.cpp
View file @
c12866a4
...
...
@@ -854,7 +854,7 @@ bool CreateBindings::visit(Declaration *decl)
qDebug
()
<<
"found entity not found for"
<<
oo
(
namedTy
->
name
());
}
}
else
if
(
Class
*
klass
=
ty
->
asClassType
())
{
if
(
const
NameId
*
nameId
=
decl
->
name
()
->
asNameId
())
{
if
(
const
Identifier
*
nameId
=
decl
->
name
()
->
asNameId
())
{
ClassOrNamespace
*
binding
=
_currentClassOrNamespace
->
findOrCreateType
(
nameId
);
binding
->
addSymbol
(
klass
);
}
...
...
@@ -885,7 +885,7 @@ bool CreateBindings::visit(UsingDeclaration *u)
{
if
(
u
->
name
())
{
if
(
const
QualifiedNameId
*
q
=
u
->
name
()
->
asQualifiedNameId
())
{
if
(
const
NameId
*
unqualifiedId
=
q
->
name
()
->
asNameId
())
{
if
(
const
Identifier
*
unqualifiedId
=
q
->
name
()
->
asNameId
())
{
if
(
ClassOrNamespace
*
delegate
=
_currentClassOrNamespace
->
lookupType
(
q
))
{
ClassOrNamespace
*
b
=
_currentClassOrNamespace
->
findOrCreateType
(
unqualifiedId
);
b
->
addUsing
(
delegate
);
...
...
src/libs/cplusplus/LookupContext.h
View file @
c12866a4
...
...
@@ -80,9 +80,9 @@ private:
QList
<
LookupItem
>
lookup_helper
(
const
Name
*
name
,
bool
searchInEnclosingScope
);
void
lookup_helper
(
const
Name
*
name
,
ClassOrNamespace
*
binding
,
QList
<
LookupItem
>
*
result
,
QSet
<
ClassOrNamespace
*>
*
processed
,
const
TemplateNameId
*
templateId
);
QList
<
LookupItem
>
*
result
,
QSet
<
ClassOrNamespace
*>
*
processed
,
const
TemplateNameId
*
templateId
);
ClassOrNamespace
*
lookupType_helper
(
const
Name
*
name
,
QSet
<
ClassOrNamespace
*>
*
processed
,
bool
searchInEnclosingScope
);
...
...
src/libs/cplusplus/NamePrettyPrinter.cpp
View file @
c12866a4
...
...
@@ -62,7 +62,7 @@ QString NamePrettyPrinter::switchName(const QString &name)
return
previousName
;
}
void
NamePrettyPrinter
::
visit
(
const
NameId
*
name
)
void
NamePrettyPrinter
::
visit
(
const
Identifier
*
name
)
{
const
Identifier
*
id
=
name
->
identifier
();
if
(
id
)
...
...
src/libs/cplusplus/NamePrettyPrinter.h
View file @
c12866a4
...
...
@@ -49,7 +49,7 @@ public:
protected:
QString
switchName
(
const
QString
&
name
=
QString
());
virtual
void
visit
(
const
NameId
*
name
);
virtual
void
visit
(
const
Identifier
*
name
);
virtual
void
visit
(
const
TemplateNameId
*
name
);
virtual
void
visit
(
const
DestructorNameId
*
name
);
virtual
void
visit
(
const
OperatorNameId
*
name
);
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
c12866a4
...
...
@@ -231,8 +231,8 @@ bool ResolveExpression::visit(NewExpressionAST *ast)
bool
ResolveExpression
::
visit
(
TypeidExpressionAST
*
)
{
const
Name
*
stdName
=
control
()
->
nameId
(
control
()
->
identifier
(
"std"
)
);
const
Name
*
tiName
=
control
()
->
nameId
(
control
()
->
identifier
(
"type_info"
)
);
const
Name
*
stdName
=
control
()
->
identifier
(
"std"
);
const
Name
*
tiName
=
control
()
->
identifier
(
"type_info"
);
const
Name
*
q
=
control
()
->
qualifiedNameId
(
control
()
->
qualifiedNameId
(
/* :: */
0
,
stdName
),
tiName
);
FullySpecifiedType
ty
(
control
()
->
namedType
(
q
));
...
...
src/plugins/cppeditor/cppquickfixes.cpp
View file @
c12866a4
...
...
@@ -981,7 +981,7 @@ public:
}
QSharedPointer
<
Control
>
control
=
state
.
context
().
control
();
const
Name
*
trName
=
control
->
nameId
(
control
->
identifier
(
"tr"
)
);
const
Name
*
trName
=
control
->
identifier
(
"tr"
);
// Check whether we are in a method:
for
(
int
i
=
path
.
size
()
-
1
;
i
>=
0
;
--
i
)
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
c12866a4
...
...
@@ -181,7 +181,7 @@ protected:
return
item
;
}
virtual
void
visit
(
const
NameId
*
name
)
virtual
void
visit
(
const
Identifier
*
name
)
{
_item
=
newCompletionItem
(
name
);
}
virtual
void
visit
(
const
TemplateNameId
*
name
)
...
...
src/shared/cplusplus/Bind.cpp
View file @
c12866a4
...
...
@@ -303,7 +303,7 @@ const Name *Bind::objCSelectorArgument(ObjCSelectorArgumentAST *ast, bool *hasAr
if
(
ast
->
colon_token
)
*
hasArg
=
true
;
return
control
()
->
nameId
(
identifier
(
ast
->
name_token
)
);
return
identifier
(
ast
->
name_token
);
}
bool
Bind
::
visit
(
AttributeAST
*
ast
)
...
...
@@ -468,7 +468,7 @@ void Bind::enumerator(EnumeratorAST *ast, Enum *symbol)
ExpressionTy
expression
=
this
->
expression
(
ast
->
expression
);
if
(
ast
->
identifier_token
)
{
const
Name
*
name
=
control
()
->
nameId
(
identifier
(
ast
->
identifier_token
)
);
const
Name
*
name
=
identifier
(
ast
->
identifier_token
);
Declaration
*
e
=
control
()
->
newDeclaration
(
ast
->
identifier_token
,
name
);
e
->
setType
(
control
()
->
integerType
(
IntegerType
::
Int
));
// ### introduce IntegerType::Enumerator
symbol
->
addMember
(
e
);
...
...
@@ -1143,20 +1143,20 @@ bool Bind::visit(QtMemberDeclarationAST *ast)
const
Name
*
name
=
0
;
if
(
tokenKind
(
ast
->
q_token
)
==
T_Q_D
)
name
=
control
()
->
nameId
(
control
()
->
identifier
(
"d"
)
);
name
=
control
()
->
identifier
(
"d"
);
else
name
=
control
()
->
nameId
(
control
()
->
identifier
(
"q"
)
);
name
=
control
()
->
identifier
(
"q"
);
FullySpecifiedType
declTy
=
this
->
expression
(
ast
->
type_id
);
if
(
tokenKind
(
ast
->
q_token
)
==
T_Q_D
)
{
if
(
NamedType
*
namedTy
=
declTy
->
asNamedType
())
{
if
(
const
NameId
*
nameId
=
namedTy
->
name
()
->
asNameId
())
{
if
(
const
Identifier
*
nameId
=
namedTy
->
name
()
->
asNameId
())
{
std
::
string
privateClass
;
privateClass
+=
nameId
->
identifier
()
->
chars
();
privateClass
+=
"Private"
;
const
Name
*
privName
=
control
()
->
nameId
(
control
()
->
identifier
(
privateClass
.
c_str
(),
privateClass
.
size
()
));
const
Name
*
privName
=
control
()
->
identifier
(
privateClass
.
c_str
(),
privateClass
.
size
(
));
declTy
.
setType
(
control
()
->
namedType
(
privName
));
}
}
...
...
@@ -1987,7 +1987,7 @@ bool Bind::visit(NamespaceAST *ast)
const
Name
*
namespaceName
=
0
;
if
(
ast
->
identifier_token
)
{
sourceLocation
=
ast
->
identifier_token
;
namespaceName
=
control
()
->
nameId
(
identifier
(
ast
->
identifier_token
)
);
namespaceName
=
identifier
(
ast
->
identifier_token
);
}
Namespace
*
ns
=
control
()
->
newNamespace
(
sourceLocation
,
namespaceName
);
...
...
@@ -2008,7 +2008,7 @@ bool Bind::visit(NamespaceAliasDefinitionAST *ast)
const
Name
*
name
=
0
;
if
(
ast
->
namespace_name_token
)
{
sourceLocation
=
ast
->
namespace_name_token
;
name
=
control
()
->
nameId
(
identifier
(
ast
->
namespace_name_token
)
);
name
=
identifier
(
ast
->
namespace_name_token
);
}
NamespaceAlias
*
namespaceAlias
=
control
()
->
newNamespaceAlias
(
sourceLocation
,
name
);
...
...
@@ -2444,14 +2444,16 @@ bool Bind::visit(ConversionFunctionIdAST *ast)
bool
Bind
::
visit
(
SimpleNameAST
*
ast
)
{
const
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
ast
->
name
=
_name
=
control
()
->
nameId
(
id
);
_name
=
id
;
ast
->
name
=
_name
;
return
false
;
}
bool
Bind
::
visit
(
DestructorNameAST
*
ast
)
{
const
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
ast
->
name
=
_name
=
control
()
->
destructorNameId
(
id
);
_name
=
control
()
->
destructorNameId
(
id
);
ast
->
name
=
_name
;
return
false
;
}
...
...
src/shared/cplusplus/CPlusPlusForwardDeclarations.h
View file @
c12866a4
...
...
@@ -83,7 +83,7 @@ class SymbolTable;
// names
class
NameVisitor
;
class
Name
;
class
NameId
;
class
Identifier
;
class
TemplateNameId
;
class
DestructorNameId
;
class
OperatorNameId
;
...
...
src/shared/cplusplus/Control.cpp
View file @
c12866a4
...
...
@@ -129,14 +129,6 @@ template <> struct Compare<ArrayType>
}
};
template
<
>
struct
Compare
<
NameId
>
{
bool
operator
()(
const
NameId
&
name
,
const
NameId
&
otherName
)
const
{
return
name
.
identifier
()
<
otherName
.
identifier
();
}
};
template
<
>
struct
Compare
<
DestructorNameId
>
{
bool
operator
()(
const
DestructorNameId
&
name
,
const
DestructorNameId
&
otherName
)
const
...
...
@@ -256,14 +248,6 @@ public:
delete_array_entries
(
symbols
);
}
const
NameId
*
findOrInsertNameId
(
const
Identifier
*
id
)
{
if
(
!
id
)
return
0
;
return
nameIds
.
intern
(
NameId
(
id
));
}
template
<
typename
_Iterator
>
const
TemplateNameId
*
findOrInsertTemplateNameId
(
const
Identifier
*
id
,
_Iterator
first
,
_Iterator
last
)
{
...
...
@@ -498,7 +482,6 @@ public:
// ### replace std::map with lookup tables. ASAP!
// names
Table
<
NameId
>
nameIds
;
Table
<
DestructorNameId
>
destructorNameIds
;
Table
<
OperatorNameId
>
operatorNameIds
;
Table
<
ConversionNameId
>
conversionNameIds
;
...
...
@@ -616,9 +599,6 @@ const NumericLiteral *Control::numericLiteral(const char *chars)
return
numericLiteral
(
chars
,
length
);
}
const
NameId
*
Control
::
nameId
(
const
Identifier
*
id
)
{
return
d
->
findOrInsertNameId
(
id
);
}
const
TemplateNameId
*
Control
::
templateNameId
(
const
Identifier
*
id
,
const
FullySpecifiedType
*
const
args
,
unsigned
argv
)
...
...
src/shared/cplusplus/Control.h
View file @
c12866a4
...
...
@@ -65,9 +65,6 @@ public:
DiagnosticClient
*
diagnosticClient
()
const
;
void
setDiagnosticClient
(
DiagnosticClient
*
diagnosticClient
);
/// Returns the canonical name id.
const
NameId
*
nameId
(
const
Identifier
*
id
);
/// Returns the canonical template name id.
const
TemplateNameId
*
templateNameId
(
const
Identifier
*
id
,
const
FullySpecifiedType
*
const
args
=
0
,
...
...
src/shared/cplusplus/Literals.cpp
View file @
c12866a4
...
...
@@ -47,6 +47,7 @@
// THE SOFTWARE.
#include "Literals.h"
#include "NameVisitor.h"
#include <cstring>
#include <algorithm>
#include <iostream>
...
...
@@ -69,7 +70,7 @@ Literal::Literal(const char *chars, unsigned size)
Literal
::~
Literal
()
{
delete
[]
_chars
;
}
bool
Literal
::
isE
qualTo
(
const
Literal
*
other
)
const
bool
Literal
::
e
qualTo
(
const
Literal
*
other
)
const
{
if
(
!
other
)
return
false
;
...
...
@@ -212,3 +213,18 @@ Identifier::Identifier(const char *chars, unsigned size)
Identifier
::~
Identifier
()
{
}
void
Identifier
::
accept0
(
NameVisitor
*
visitor
)
const
{
visitor
->
visit
(
this
);
}
bool
Identifier
::
isEqualTo
(
const
Name
*
other
)
const
{
if
(
this
==
other
)
return
true
;
else
if
(
other
)
{
if
(
const
Identifier
*
nameId
=
other
->
asNameId
())
{
return
equalTo
(
nameId
);
}
}
return
false
;
}
src/shared/cplusplus/Literals.h
View file @
c12866a4
...
...
@@ -51,7 +51,7 @@
#include "CPlusPlusForwardDeclarations.h"
#include "Token.h"
#include "Name.h"
namespace
CPlusPlus
{
...
...
@@ -78,7 +78,7 @@ public:
unsigned
hashCode
()
const
;
static
unsigned
hashCode
(
const
char
*
chars
,
unsigned
size
);
bool
isE
qualTo
(
const
Literal
*
other
)
const
;
bool
e
qualTo
(
const
Literal
*
other
)
const
;
private:
char
*
_chars
;
...
...
@@ -126,11 +126,21 @@ private:
};
};
class
CPLUSPLUS_EXPORT
Identifier
:
public
Literal
class
CPLUSPLUS_EXPORT
Identifier
:
public
Literal
,
public
Name
{
public:
Identifier
(
const
char
*
chars
,
unsigned
size
);
virtual
~
Identifier
();
virtual
const
Identifier
*
identifier
()
const
{
return
this
;
}
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
virtual
const
Identifier
*
asNameId
()
const
{
return
this
;
}
protected:
virtual
void
accept0
(
NameVisitor
*
visitor
)
const
;
};
}
// end of namespace CPlusPlus
...
...
src/shared/cplusplus/Name.h
View file @
c12866a4
...
...
@@ -70,7 +70,7 @@ public:
bool
isQualifiedNameId
()
const
;
bool
isSelectorNameId
()
const
;
virtual
const
NameId
*
asNameId
()
const
{
return
0
;
}
virtual
const
Identifier
*
asNameId
()
const
{
return
0
;
}
virtual
const
TemplateNameId
*
asTemplateNameId
()
const
{
return
0
;
}
virtual
const
DestructorNameId
*
asDestructorNameId
()
const
{
return
0
;
}
virtual
const
OperatorNameId
*
asOperatorNameId
()
const
{
return
0
;
}
...
...
src/shared/cplusplus/NameVisitor.h
View file @
c12866a4
...
...
@@ -68,7 +68,7 @@ public:
virtual
bool
preVisit
(
const
Name
*
)
{
return
true
;
}
virtual
void
postVisit
(
const
Name
*
)
{}
virtual
void
visit
(
const
NameId
*
)
{}
virtual
void
visit
(
const
Identifier
*
)
{}
virtual
void
visit
(
const
TemplateNameId
*
)
{}
virtual
void
visit
(
const
DestructorNameId
*
)
{}
virtual
void
visit
(
const
OperatorNameId
*
)
{}
...
...
src/shared/cplusplus/Names.cpp
View file @
c12866a4
...
...
@@ -90,32 +90,6 @@ bool QualifiedNameId::isEqualTo(const Name *other) const
return
false
;
}
NameId
::
NameId
(
const
Identifier
*
identifier
)
:
_identifier
(
identifier
)
{
}
NameId
::~
NameId
()
{
}
void
NameId
::
accept0
(
NameVisitor
*
visitor
)
const
{
visitor
->
visit
(
this
);
}
const
Identifier
*
NameId
::
identifier
()
const
{
return
_identifier
;
}
bool
NameId
::
isEqualTo
(
const
Name
*
other
)
const
{
if
(
other
)
{
const
NameId
*
nameId
=
other
->
asNameId
();
if
(
!
nameId
)
return
false
;
const
Identifier
*
l
=
identifier
();
const
Identifier
*
r
=
nameId
->
identifier
();
return
l
->
isEqualTo
(
r
);
}
return
false
;
}
DestructorNameId
::
DestructorNameId
(
const
Identifier
*
identifier
)
:
_identifier
(
identifier
)
{
}
...
...
src/shared/cplusplus/Names.h
View file @
c12866a4
...
...
@@ -82,26 +82,6 @@ private:
const
Name
*
_name
;
};
class
CPLUSPLUS_EXPORT
NameId
:
public
Name
{
public:
NameId
(
const
Identifier
*
identifier
);
virtual
~
NameId
();
virtual
const
Identifier
*
identifier
()
const
;
virtual
bool
isEqualTo
(
const
Name
*
other
)
const
;
virtual
const
NameId
*
asNameId
()
const
{
return
this
;
}
protected:
virtual
void
accept0
(
NameVisitor
*
visitor
)
const
;
private:
const
Identifier
*
_identifier
;
};
class
CPLUSPLUS_EXPORT
DestructorNameId
:
public
Name
{
public:
...
...
src/shared/cplusplus/Scope.cpp
View file @
c12866a4
...
...
@@ -94,7 +94,6 @@ public:
/// Returns the last Symbol in the scope.
iterator
lastSymbol
()
const
;
Symbol
*
lookat
(
const
Name
*
name
)
const
;
Symbol
*
lookat
(
const
Identifier
*
id
)
const
;
Symbol
*
lookat
(
int
operatorId
)
const
;
...
...
@@ -157,21 +156,6 @@ void SymbolTable::enterSymbol(Symbol *symbol)
}
}
Symbol
*
SymbolTable
::
lookat
(
const
Name
*
name
)
const
{
if
(
!
name
)
return
0
;
else
if
(
const
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
return
lookat
(
opId
->
kind
());
else
if
(
const
Identifier
*
id
=
name
->
identifier
())
return
lookat
(
id
);
else
return
0
;
}
Symbol
*
SymbolTable
::
lookat
(
const
Identifier
*
id
)
const
{
if
(
!
_hash
||
!
id
)
...
...
@@ -183,7 +167,7 @@ Symbol *SymbolTable::lookat(const Identifier *id) const
const
Name
*
identity
=
symbol
->
unqualifiedName
();
if
(
!
identity
)
{
continue
;
}
else
if
(
const
NameId
*
nameId
=
identity
->
asNameId
())
{
}
else
if
(
const
Identifier
*
nameId
=
identity
->
asNameId
())
{
if
(
nameId
->
identifier
()
->
isEqualTo
(
id
))
break
;
}
else
if
(
const
TemplateNameId
*
t
=
identity
->
asTemplateNameId
())
{
...
...
@@ -303,9 +287,6 @@ Scope::iterator Scope::firstMember() const
Scope
::
iterator
Scope
::
lastMember
()
const
{
return
_members
?
_members
->
lastSymbol
()
:
0
;
}
Symbol
*
Scope
::
find
(
const
Name
*
name
)
const
{
return
_members
?
_members
->
lookat
(
name
)
:
0
;
}
Symbol
*
Scope
::
find
(
const
Identifier
*
id
)
const
{
return
_members
?
_members
->
lookat
(
id
)
:
0
;
}
...
...
src/shared/cplusplus/Scope.h
View file @
c12866a4
...
...
@@ -80,7 +80,6 @@ public:
/// Returns the last Symbol in the scope.
iterator
lastMember
()
const
;
Symbol
*
find
(
const
Name
*
name
)
const
;
Symbol
*
find
(
const
Identifier
*
id
)
const
;
Symbol
*
find
(
int
operatorId
)
const
;
...
...
src/shared/cplusplus/Symbol.cpp
View file @
c12866a4
...
...
@@ -85,7 +85,7 @@ protected:
return
previousValue
;
}
virtual
void
visit
(
const
NameId
*
name
)
virtual
void
visit
(
const
Identifier
*
name
)
{
_value
=
name
->
identifier
()
->
hashCode
();
}
virtual
void
visit
(
const
TemplateNameId
*
name
)
...
...
tests/auto/cplusplus/semantic/tst_semantic.cpp
View file @
c12866a4
...
...
@@ -179,7 +179,7 @@ void tst_Semantic::function_declaration_2()
QVERIFY
(
!
arg
->
hasInitializer
());
// check the argument's name.
const
NameId
*
argNameId
=
arg
->
name
()
->
asNameId
();
const
Identifier
*
argNameId
=
arg
->
name
()
->
asNameId
();
QVERIFY
(
argNameId
);
const
Identifier
*
argId
=
argNameId
->
identifier
();
...
...
@@ -243,7 +243,7 @@ void tst_Semantic::nested_class_1()
Class
*
classObject
=
doc
->
globals
->
memberAt
(
0
)
->
asClass
();
QVERIFY
(
classObject
);
QVERIFY
(
classObject
->
name
());
const
NameId
*
classObjectNameId
=
classObject
->
name
()
->
asNameId
();
const
Identifier
*
classObjectNameId
=
classObject
->
name
()
->
asNameId
();
QVERIFY
(
classObjectNameId
);
const
Identifier
*
objectId
=
classObjectNameId
->
identifier
();
QCOMPARE
(
QByteArray
(
objectId
->
chars
(),
objectId
->
size
()),
QByteArray
(
"Object"
));
...
...
tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp
View file @
c12866a4
...
...
@@ -31,8 +31,8 @@ Q_DECLARE_METATYPE(CPlusPlus::FullySpecifiedType);
TranslationUnit
*
unit
;
NameId
*
nameId
(
const
QString
&
name
)
{
return
new
NameId
(
new
Identifier
(
name
.
toLatin1
().
constData
(),
name
.
toLatin1
().
size
()
));
}
const
Identifier
*
nameId
(
const
QString
&
name
)
{
return
new
Identifier
(
name
.
toLatin1
().
constData
(),
name
.
toLatin1
().
size
(
));
}
Argument
*
arg
(
const
QString
&
name
,
const
FullySpecifiedType
&
ty
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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