Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
139087ee
Commit
139087ee
authored
May 10, 2010
by
Roberto Raggi
Browse files
Introduced Symbol::copy(otherSymbol) and removed some deprecated code.
parent
9a51f684
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
139087ee
...
...
@@ -69,9 +69,10 @@ bool ClassOrNamespace::CompareName::operator()(const Name *name, const Name *oth
{
Q_ASSERT
(
name
!=
0
);
Q_ASSERT
(
other
!=
0
);
const
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
otherId
=
other
->
identifier
();
return
st
d
::
lexicographical_compare
(
id
->
begin
(),
id
->
end
(),
otherId
->
begin
(),
otherId
->
end
())
;
return
st
rcmp
(
id
->
chars
(),
otherId
->
chars
())
<
0
;
}
/////////////////////////////////////////////////////////////////////
...
...
@@ -266,6 +267,11 @@ ClassOrNamespace::ClassOrNamespace(CreateBindings *factory, ClassOrNamespace *pa
{
}
ClassOrNamespace
*
ClassOrNamespace
::
parent
()
const
{
return
_parent
;
}
QList
<
ClassOrNamespace
*>
ClassOrNamespace
::
usings
()
const
{
const_cast
<
ClassOrNamespace
*>
(
this
)
->
flush
();
...
...
@@ -401,7 +407,7 @@ void CreateBindings::lookup_helper(const Name *name, Scope *scope,
#if 0
if (templateId && (s->isDeclaration() || s->isFunction())) {
FullySpecifiedType ty = GenTemplateInstance::instantiate(templateId, s, control);
FullySpecifiedType ty = GenTemplateInstance::instantiate(templateId, s,
_
control);
Overview oo;
oo.setShowFunctionSignatures(true);
...
...
@@ -412,19 +418,15 @@ void CreateBindings::lookup_helper(const Name *name, Scope *scope,
if (Declaration *decl = s->asDeclaration()) {
qDebug() << "instantiate declaration";
qDebug() << "is typedef:" << ty.isTypedef() << s->isTypedef() << s->type().isTypedef();
Declaration *d = control->newDeclaration(0, 0);
d->setStorage(decl->storage());
d->setName(decl->name());
Declaration *d = _control->newDeclaration(0, 0);
d->copy(decl);
d->setType(ty);
d->setScope(decl->scope());
result->append(d);
continue;
} else if (Function *fun = s->asFunction()) {
qDebug() << "instantiate function";
Function *d = ty->asFunctionType();
d->setStorage(fun->storage());
d->setScope(fun->scope());
d->copy(fun);
result->append(d);
continue;
}
...
...
src/libs/cplusplus/LookupContext.h
View file @
139087ee
...
...
@@ -48,6 +48,7 @@ class CPLUSPLUS_EXPORT ClassOrNamespace
public:
ClassOrNamespace
(
CreateBindings
*
factory
,
ClassOrNamespace
*
parent
);
ClassOrNamespace
*
parent
()
const
;
QList
<
ClassOrNamespace
*>
usings
()
const
;
QList
<
Enum
*>
enums
()
const
;
QList
<
Symbol
*>
symbols
()
const
;
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
139087ee
...
...
@@ -1115,7 +1115,7 @@ bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
classObjectCandidates
.
append
(
klass
);
else
if
(
NamedType
*
namedTy
=
ty
->
asNamedType
())
{
if
(
ClassOrNamespace
*
b
=
context
.
classOrNamespace
(
namedTy
->
name
(),
r
.
lastVisibleSymbol
()
->
scope
()
))
{
if
(
ClassOrNamespace
*
b
=
context
.
classOrNamespace
(
namedTy
->
name
(),
r
.
lastVisibleSymbol
()))
{
classOrNamespace
=
b
;
break
;
...
...
@@ -1342,22 +1342,6 @@ void CppCodeCompletion::completeNamespace(ClassOrNamespace *b, const LookupConte
}
}
void
CppCodeCompletion
::
completeNamespace
(
const
QList
<
Symbol
*>
&
candidates
,
const
DeprecatedLookupContext
&
deprecatedContext
)
{
if
(
candidates
.
isEmpty
())
return
;
else
if
(
Namespace
*
ns
=
candidates
.
first
()
->
asNamespace
())
{
LookupContext
context
(
deprecatedContext
.
expressionDocument
(),
deprecatedContext
.
thisDocument
(),
deprecatedContext
.
snapshot
());
if
(
ClassOrNamespace
*
binding
=
context
.
classOrNamespace
(
ns
))
completeNamespace
(
binding
,
context
);
}
}
void
CppCodeCompletion
::
completeClass
(
ClassOrNamespace
*
b
,
const
LookupContext
&
,
bool
staticLookup
)
{
QSet
<
ClassOrNamespace
*>
bindingsVisited
;
...
...
@@ -1405,23 +1389,6 @@ void CppCodeCompletion::completeClass(ClassOrNamespace *b, const LookupContext &
}
}
void
CppCodeCompletion
::
completeClass
(
const
QList
<
Symbol
*>
&
candidates
,
const
DeprecatedLookupContext
&
deprecatedContext
,
bool
staticLookup
)
{
if
(
candidates
.
isEmpty
())
return
;
else
if
(
Symbol
*
klass
=
candidates
.
first
())
{
LookupContext
context
(
deprecatedContext
.
expressionDocument
(),
deprecatedContext
.
thisDocument
(),
deprecatedContext
.
snapshot
());
if
(
ClassOrNamespace
*
binding
=
context
.
classOrNamespace
(
klass
))
completeClass
(
binding
,
context
,
staticLookup
);
}
}
bool
CppCodeCompletion
::
completeQtMethod
(
const
QList
<
LookupItem
>
&
results
,
const
LookupContext
&
newContext
,
bool
wantSignals
)
...
...
src/plugins/cpptools/cppcodecompletion.h
View file @
139087ee
...
...
@@ -126,17 +126,10 @@ private:
void
completeNamespace
(
CPlusPlus
::
ClassOrNamespace
*
binding
,
const
CPlusPlus
::
LookupContext
&
context
);
void
completeNamespace
(
const
QList
<
CPlusPlus
::
Symbol
*>
&
candidates
,
const
CPlusPlus
::
DeprecatedLookupContext
&
context
);
void
completeClass
(
CPlusPlus
::
ClassOrNamespace
*
b
,
const
CPlusPlus
::
LookupContext
&
context
,
bool
staticLookup
=
true
);
void
completeClass
(
const
QList
<
CPlusPlus
::
Symbol
*>
&
candidates
,
const
CPlusPlus
::
DeprecatedLookupContext
&
context
,
bool
staticLookup
=
true
);
bool
completeConstructors
(
CPlusPlus
::
Class
*
klass
);
bool
completeQtMethod
(
const
QList
<
CPlusPlus
::
LookupItem
>
&
results
,
...
...
src/shared/cplusplus/Symbol.cpp
View file @
139087ee
...
...
@@ -161,7 +161,7 @@ private:
};
Symbol
::
Symbol
(
TranslationUnit
*
translationUnit
,
unsigned
sourceLocation
,
const
Name
*
name
)
:
_control
(
translationUnit
->
control
()
),
:
_control
(
0
),
_sourceLocation
(
sourceLocation
),
_sourceOffset
(
0
),
_startOffset
(
0
),
...
...
@@ -175,7 +175,11 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const
_next
(
0
),
_isGenerated
(
false
)
{
setSourceLocation
(
sourceLocation
);
if
(
translationUnit
)
{
_control
=
translationUnit
->
control
();
setSourceLocation
(
sourceLocation
);
}
setName
(
name
);
}
...
...
@@ -504,3 +508,22 @@ bool Symbol::isObjCMethod() const
bool
Symbol
::
isObjCPropertyDeclaration
()
const
{
return
asObjCPropertyDeclaration
()
!=
0
;
}
void
Symbol
::
copy
(
Symbol
*
other
)
{
_control
=
other
->
_control
;
_sourceLocation
=
other
->
_sourceLocation
;
_sourceOffset
=
other
->
_sourceOffset
;
_startOffset
=
other
->
_startOffset
;
_endOffset
=
other
->
_endOffset
;
_name
=
other
->
_name
;
_hashCode
=
other
->
_hashCode
;
_storage
=
other
->
_storage
;
_visibility
=
other
->
_visibility
;
_scope
=
other
->
_scope
;
_index
=
other
->
_index
;
_next
=
other
->
_next
;
_isGenerated
=
other
->
_isGenerated
;
_isDeprecated
=
other
->
_isDeprecated
;
}
src/shared/cplusplus/Symbol.h
View file @
139087ee
...
...
@@ -317,6 +317,8 @@ public:
void
visitSymbol
(
SymbolVisitor
*
visitor
);
static
void
visitSymbol
(
Symbol
*
symbol
,
SymbolVisitor
*
visitor
);
virtual
void
copy
(
Symbol
*
other
);
protected:
virtual
void
visitSymbol0
(
SymbolVisitor
*
visitor
)
=
0
;
...
...
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