forked from qt-creator/qt-creator
CPlusPlus: Inline some simple central functions
Depending on context, callgrind sees contributions of >8% to the total cost of project parsing for these functions. The functional are actualy executed executed out-of-line, often for a function body of one "payload" instruction only. Inlining removes the call/endbr64/ret overhead. Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
14
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
14
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -2024,7 +2024,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
|
||||
decl->setInitializer(asStringLiteral(initializer));
|
||||
}
|
||||
|
||||
if (_scope->isClass()) {
|
||||
if (_scope->asClass()) {
|
||||
decl->setVisibility(_visibility);
|
||||
|
||||
if (Function *funTy = decl->type()->asFunctionType()) {
|
||||
@@ -2050,7 +2050,7 @@ bool Bind::visit(EmptyDeclarationAST *ast)
|
||||
{
|
||||
(void) ast;
|
||||
int semicolon_token = ast->semicolon_token;
|
||||
if (_scope && (_scope->isClass() || _scope->isNamespace())) {
|
||||
if (_scope && (_scope->asClass() || _scope->asNamespace())) {
|
||||
const Token &tk = tokenAt(semicolon_token);
|
||||
|
||||
if (! tk.generated())
|
||||
@@ -2227,7 +2227,7 @@ bool Bind::visit(AliasDeclarationAST *ast)
|
||||
decl->setType(ty);
|
||||
decl->setStorage(Symbol::Typedef);
|
||||
ast->symbol = decl;
|
||||
if (_scope->isClass())
|
||||
if (_scope->asClass())
|
||||
decl->setVisibility(_visibility);
|
||||
_scope->addMember(decl);
|
||||
|
||||
@@ -2299,7 +2299,7 @@ bool Bind::visit(FunctionDefinitionAST *ast)
|
||||
setDeclSpecifiers(fun, declSpecifiers);
|
||||
fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
|
||||
|
||||
if (_scope->isClass()) {
|
||||
if (_scope->asClass()) {
|
||||
fun->setVisibility(_visibility);
|
||||
fun->setMethodKey(methodKey);
|
||||
}
|
||||
@@ -3147,7 +3147,7 @@ bool Bind::visit(ClassSpecifierAST *ast)
|
||||
klass->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
|
||||
_scope->addMember(klass);
|
||||
|
||||
if (_scope->isClass())
|
||||
if (_scope->asClass())
|
||||
klass->setVisibility(_visibility);
|
||||
|
||||
// set the class key
|
||||
@@ -3210,7 +3210,7 @@ bool Bind::visit(EnumSpecifierAST *ast)
|
||||
ast->symbol = e;
|
||||
_scope->addMember(e);
|
||||
|
||||
if (_scope->isClass())
|
||||
if (_scope->asClass())
|
||||
e->setVisibility(_visibility);
|
||||
|
||||
Scope *previousScope = switchScope(e);
|
||||
@@ -3398,7 +3398,7 @@ void Bind::ensureValidClassName(const Name **name, int sourceLocation)
|
||||
const QualifiedNameId *qName = (*name)->asQualifiedNameId();
|
||||
const Name *uqName = qName ? qName->name() : *name;
|
||||
|
||||
if (!uqName->isNameId() && !uqName->isTemplateNameId()) {
|
||||
if (!uqName->asNameId() && !uqName->asTemplateNameId()) {
|
||||
translationUnit()->error(sourceLocation, "expected a class-name");
|
||||
|
||||
*name = uqName->identifier();
|
||||
|
@@ -33,17 +33,9 @@ FullySpecifiedType::FullySpecifiedType(Type *type) :
|
||||
_type = UndefinedType::instance();
|
||||
}
|
||||
|
||||
FullySpecifiedType::~FullySpecifiedType()
|
||||
{ }
|
||||
|
||||
bool FullySpecifiedType::isValid() const
|
||||
{ return _type != UndefinedType::instance(); }
|
||||
|
||||
Type *FullySpecifiedType::type() const
|
||||
{ return _type; }
|
||||
|
||||
void FullySpecifiedType::setType(Type *type)
|
||||
{ _type = type; }
|
||||
|
||||
FullySpecifiedType FullySpecifiedType::qualifiedType() const
|
||||
{
|
||||
@@ -215,12 +207,6 @@ FullySpecifiedType FullySpecifiedType::simplified() const
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned FullySpecifiedType::flags() const
|
||||
{ return _flags; }
|
||||
|
||||
void FullySpecifiedType::setFlags(unsigned flags)
|
||||
{ _flags = flags; }
|
||||
|
||||
bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *matcher) const
|
||||
{
|
||||
static const unsigned flagsMask = [](){
|
||||
|
12
src/libs/3rdparty/cplusplus/FullySpecifiedType.h
vendored
12
src/libs/3rdparty/cplusplus/FullySpecifiedType.h
vendored
@@ -25,17 +25,17 @@
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
class CPLUSPLUS_EXPORT FullySpecifiedType
|
||||
class CPLUSPLUS_EXPORT FullySpecifiedType final
|
||||
{
|
||||
public:
|
||||
FullySpecifiedType(Type *type = nullptr);
|
||||
~FullySpecifiedType();
|
||||
~FullySpecifiedType() = default;
|
||||
|
||||
bool isValid() const;
|
||||
explicit operator bool() const;
|
||||
|
||||
Type *type() const;
|
||||
void setType(Type *type);
|
||||
Type *type() const { return _type; }
|
||||
void setType(Type *type) { _type = type; }
|
||||
|
||||
FullySpecifiedType qualifiedType() const;
|
||||
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
|
||||
FullySpecifiedType simplified() const;
|
||||
|
||||
unsigned flags() const;
|
||||
void setFlags(unsigned flags);
|
||||
unsigned flags() const { return _flags; }
|
||||
void setFlags(unsigned flags) { _flags = flags; }
|
||||
|
||||
private:
|
||||
Type *_type;
|
||||
|
5
src/libs/3rdparty/cplusplus/Literals.h
vendored
5
src/libs/3rdparty/cplusplus/Literals.h
vendored
@@ -105,7 +105,7 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Identifier: public Literal, public Name
|
||||
class CPLUSPLUS_EXPORT Identifier final : public Literal, public Name
|
||||
{
|
||||
public:
|
||||
Identifier(const char *chars, int size)
|
||||
@@ -114,8 +114,7 @@ public:
|
||||
|
||||
const Identifier *identifier() const override { return this; }
|
||||
|
||||
const Identifier *asNameId() const override
|
||||
{ return this; }
|
||||
const Identifier *asNameId() const override { return this; }
|
||||
|
||||
protected:
|
||||
void accept0(NameVisitor *visitor) const override;
|
||||
|
24
src/libs/3rdparty/cplusplus/Name.cpp
vendored
24
src/libs/3rdparty/cplusplus/Name.cpp
vendored
@@ -35,30 +35,6 @@ Name::Name()
|
||||
Name::~Name()
|
||||
{ }
|
||||
|
||||
bool Name::isNameId() const
|
||||
{ return asNameId() != nullptr; }
|
||||
|
||||
bool Name::isAnonymousNameId() const
|
||||
{ return asAnonymousNameId() != nullptr; }
|
||||
|
||||
bool Name::isTemplateNameId() const
|
||||
{ return asTemplateNameId() != nullptr; }
|
||||
|
||||
bool Name::isDestructorNameId() const
|
||||
{ return asDestructorNameId() != nullptr; }
|
||||
|
||||
bool Name::isOperatorNameId() const
|
||||
{ return asOperatorNameId() != nullptr; }
|
||||
|
||||
bool Name::isConversionNameId() const
|
||||
{ return asConversionNameId() != nullptr; }
|
||||
|
||||
bool Name::isQualifiedNameId() const
|
||||
{ return asQualifiedNameId() != nullptr; }
|
||||
|
||||
bool Name::isSelectorNameId() const
|
||||
{ return asSelectorNameId() != nullptr; }
|
||||
|
||||
void Name::accept(NameVisitor *visitor) const
|
||||
{
|
||||
if (visitor->preVisit(this))
|
||||
|
9
src/libs/3rdparty/cplusplus/Name.h
vendored
9
src/libs/3rdparty/cplusplus/Name.h
vendored
@@ -35,15 +35,6 @@ public:
|
||||
|
||||
virtual const Identifier *identifier() const = 0;
|
||||
|
||||
bool isNameId() const;
|
||||
bool isAnonymousNameId() const;
|
||||
bool isTemplateNameId() const;
|
||||
bool isDestructorNameId() const;
|
||||
bool isOperatorNameId() const;
|
||||
bool isConversionNameId() const;
|
||||
bool isQualifiedNameId() const;
|
||||
bool isSelectorNameId() const;
|
||||
|
||||
virtual const Identifier *asNameId() const { return nullptr; }
|
||||
virtual const AnonymousNameId *asAnonymousNameId() const { return nullptr; }
|
||||
virtual const TemplateNameId *asTemplateNameId() const { return nullptr; }
|
||||
|
10
src/libs/3rdparty/cplusplus/Names.cpp
vendored
10
src/libs/3rdparty/cplusplus/Names.cpp
vendored
@@ -171,9 +171,6 @@ bool OperatorNameId::match0(const Name *otherName, Matcher *matcher) const
|
||||
OperatorNameId::Kind OperatorNameId::kind() const
|
||||
{ return _kind; }
|
||||
|
||||
const Identifier *OperatorNameId::identifier() const
|
||||
{ return nullptr; }
|
||||
|
||||
ConversionNameId::ConversionNameId(const FullySpecifiedType &type)
|
||||
: _type(type)
|
||||
{ }
|
||||
@@ -191,11 +188,7 @@ bool ConversionNameId::match0(const Name *otherName, Matcher *matcher) const
|
||||
return false;
|
||||
}
|
||||
|
||||
FullySpecifiedType ConversionNameId::type() const
|
||||
{ return _type; }
|
||||
|
||||
const Identifier *ConversionNameId::identifier() const
|
||||
{ return nullptr; }
|
||||
|
||||
SelectorNameId::~SelectorNameId()
|
||||
{ }
|
||||
@@ -249,5 +242,4 @@ bool AnonymousNameId::match0(const Name *otherName, Matcher *matcher) const
|
||||
return false;
|
||||
}
|
||||
|
||||
const Identifier *AnonymousNameId::identifier() const
|
||||
{ return nullptr; }
|
||||
|
||||
|
22
src/libs/3rdparty/cplusplus/Names.h
vendored
22
src/libs/3rdparty/cplusplus/Names.h
vendored
@@ -234,10 +234,8 @@ public:
|
||||
|
||||
Kind kind() const;
|
||||
|
||||
const Identifier *identifier() const override;
|
||||
|
||||
const OperatorNameId *asOperatorNameId() const override
|
||||
{ return this; }
|
||||
const Identifier *identifier() const override { return nullptr; }
|
||||
const OperatorNameId *asOperatorNameId() const override { return this; }
|
||||
|
||||
protected:
|
||||
void accept0(NameVisitor *visitor) const override;
|
||||
@@ -253,12 +251,9 @@ public:
|
||||
ConversionNameId(const FullySpecifiedType &type);
|
||||
virtual ~ConversionNameId();
|
||||
|
||||
FullySpecifiedType type() const;
|
||||
|
||||
const Identifier *identifier() const override;
|
||||
|
||||
const ConversionNameId *asConversionNameId() const override
|
||||
{ return this; }
|
||||
FullySpecifiedType type() const { return _type; }
|
||||
const Identifier *identifier() const override { return nullptr; }
|
||||
const ConversionNameId *asConversionNameId() const override { return this; }
|
||||
|
||||
protected:
|
||||
void accept0(NameVisitor *visitor) const override;
|
||||
@@ -300,7 +295,7 @@ private:
|
||||
bool _hasArguments;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AnonymousNameId: public Name
|
||||
class CPLUSPLUS_EXPORT AnonymousNameId final : public Name
|
||||
{
|
||||
public:
|
||||
AnonymousNameId(int classTokenIndex);
|
||||
@@ -308,10 +303,9 @@ public:
|
||||
|
||||
int classTokenIndex() const;
|
||||
|
||||
const Identifier *identifier() const override;
|
||||
const Identifier *identifier() const override { return nullptr; }
|
||||
|
||||
const AnonymousNameId *asAnonymousNameId() const override
|
||||
{ return this; }
|
||||
const AnonymousNameId *asAnonymousNameId() const override { return this; }
|
||||
|
||||
protected:
|
||||
void accept0(NameVisitor *visitor) const override;
|
||||
|
2
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
2
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
@@ -154,7 +154,7 @@ Symbol *SymbolTable::lookat(const Identifier *id) const
|
||||
} else if (const DestructorNameId *d = identity->asDestructorNameId()) {
|
||||
if (d->identifier()->match(id))
|
||||
break;
|
||||
} else if (identity->isQualifiedNameId()) {
|
||||
} else if (identity->asQualifiedNameId()) {
|
||||
return nullptr;
|
||||
} else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) {
|
||||
if (selectorNameId->identifier()->match(id))
|
||||
|
157
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
157
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
@@ -142,23 +142,7 @@ void Symbol::visitSymbol(Symbol *symbol, SymbolVisitor *visitor)
|
||||
symbol->visitSymbol(visitor);
|
||||
}
|
||||
|
||||
int Symbol::sourceLocation() const
|
||||
{ return _sourceLocation; }
|
||||
|
||||
bool Symbol::isGenerated() const
|
||||
{ return _isGenerated; }
|
||||
|
||||
bool Symbol::isDeprecated() const
|
||||
{ return _isDeprecated; }
|
||||
|
||||
void Symbol::setDeprecated(bool isDeprecated)
|
||||
{ _isDeprecated = isDeprecated; }
|
||||
|
||||
bool Symbol::isUnavailable() const
|
||||
{ return _isUnavailable; }
|
||||
|
||||
void Symbol::setUnavailable(bool isUnavailable)
|
||||
{ _isUnavailable = isUnavailable; }
|
||||
|
||||
void Symbol::setSourceLocation(int sourceLocation, TranslationUnit *translationUnit)
|
||||
{
|
||||
@@ -176,21 +160,6 @@ void Symbol::setSourceLocation(int sourceLocation, TranslationUnit *translationU
|
||||
}
|
||||
}
|
||||
|
||||
int Symbol::line() const
|
||||
{
|
||||
return _line;
|
||||
}
|
||||
|
||||
int Symbol::column() const
|
||||
{
|
||||
return _column;
|
||||
}
|
||||
|
||||
const StringLiteral *Symbol::fileId() const
|
||||
{
|
||||
return _fileId;
|
||||
}
|
||||
|
||||
const char *Symbol::fileName() const
|
||||
{ return _fileId ? _fileId->chars() : ""; }
|
||||
|
||||
@@ -208,9 +177,6 @@ const Name *Symbol::unqualifiedName() const
|
||||
return _name;
|
||||
}
|
||||
|
||||
const Name *Symbol::name() const
|
||||
{ return _name; }
|
||||
|
||||
void Symbol::setName(const Name *name)
|
||||
{
|
||||
_name = name;
|
||||
@@ -231,9 +197,6 @@ const Identifier *Symbol::identifier() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Scope *Symbol::enclosingScope() const
|
||||
{ return _enclosingScope; }
|
||||
|
||||
void Symbol::setEnclosingScope(Scope *scope)
|
||||
{
|
||||
CPP_CHECK(! _enclosingScope);
|
||||
@@ -299,126 +262,6 @@ Block *Symbol::enclosingBlock() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned Symbol::index() const
|
||||
{ return _index; }
|
||||
|
||||
Symbol *Symbol::next() const
|
||||
{ return _next; }
|
||||
|
||||
unsigned Symbol::hashCode() const
|
||||
{ return _hashCode; }
|
||||
|
||||
int Symbol::storage() const
|
||||
{ return _storage; }
|
||||
|
||||
void Symbol::setStorage(int storage)
|
||||
{ _storage = storage; }
|
||||
|
||||
int Symbol::visibility() const
|
||||
{ return _visibility; }
|
||||
|
||||
void Symbol::setVisibility(int visibility)
|
||||
{ _visibility = visibility; }
|
||||
|
||||
bool Symbol::isFriend() const
|
||||
{ return _storage == Friend; }
|
||||
|
||||
bool Symbol::isRegister() const
|
||||
{ return _storage == Register; }
|
||||
|
||||
bool Symbol::isStatic() const
|
||||
{ return _storage == Static; }
|
||||
|
||||
bool Symbol::isExtern() const
|
||||
{ return _storage == Extern; }
|
||||
|
||||
bool Symbol::isMutable() const
|
||||
{ return _storage == Mutable; }
|
||||
|
||||
bool Symbol::isTypedef() const
|
||||
{ return _storage == Typedef; }
|
||||
|
||||
bool Symbol::isPublic() const
|
||||
{ return _visibility == Public; }
|
||||
|
||||
bool Symbol::isProtected() const
|
||||
{ return _visibility == Protected; }
|
||||
|
||||
bool Symbol::isPrivate() const
|
||||
{ return _visibility == Private; }
|
||||
|
||||
bool Symbol::isScope() const
|
||||
{ return asScope() != nullptr; }
|
||||
|
||||
bool Symbol::isEnum() const
|
||||
{ return asEnum() != nullptr; }
|
||||
|
||||
bool Symbol::isFunction() const
|
||||
{ return asFunction() != nullptr; }
|
||||
|
||||
bool Symbol::isNamespace() const
|
||||
{ return asNamespace() != nullptr; }
|
||||
|
||||
bool Symbol::isTemplate() const
|
||||
{ return asTemplate() != nullptr; }
|
||||
|
||||
bool Symbol::isClass() const
|
||||
{ return asClass() != nullptr; }
|
||||
|
||||
bool Symbol::isForwardClassDeclaration() const
|
||||
{ return asForwardClassDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isQtPropertyDeclaration() const
|
||||
{ return asQtPropertyDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isQtEnum() const
|
||||
{ return asQtEnum() != nullptr; }
|
||||
|
||||
bool Symbol::isBlock() const
|
||||
{ return asBlock() != nullptr; }
|
||||
|
||||
bool Symbol::isUsingNamespaceDirective() const
|
||||
{ return asUsingNamespaceDirective() != nullptr; }
|
||||
|
||||
bool Symbol::isUsingDeclaration() const
|
||||
{ return asUsingDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isDeclaration() const
|
||||
{ return asDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isArgument() const
|
||||
{ return asArgument() != nullptr; }
|
||||
|
||||
bool Symbol::isTypenameArgument() const
|
||||
{ return asTypenameArgument() != nullptr; }
|
||||
|
||||
bool Symbol::isBaseClass() const
|
||||
{ return asBaseClass() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCBaseClass() const
|
||||
{ return asObjCBaseClass() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCBaseProtocol() const
|
||||
{ return asObjCBaseProtocol() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCClass() const
|
||||
{ return asObjCClass() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCForwardClassDeclaration() const
|
||||
{ return asObjCForwardClassDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCProtocol() const
|
||||
{ return asObjCProtocol() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCForwardProtocolDeclaration() const
|
||||
{ return asObjCForwardProtocolDeclaration() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCMethod() const
|
||||
{ return asObjCMethod() != nullptr; }
|
||||
|
||||
bool Symbol::isObjCPropertyDeclaration() const
|
||||
{ return asObjCPropertyDeclaration() != nullptr; }
|
||||
|
||||
void Symbol::copy(Symbol *other)
|
||||
{
|
||||
_sourceLocation = other->_sourceLocation;
|
||||
|
168
src/libs/3rdparty/cplusplus/Symbol.h
vendored
168
src/libs/3rdparty/cplusplus/Symbol.h
vendored
@@ -61,16 +61,16 @@ public:
|
||||
virtual ~Symbol();
|
||||
|
||||
/// Returns this Symbol's source location.
|
||||
int sourceLocation() const;
|
||||
int sourceLocation() const { return _sourceLocation; }
|
||||
|
||||
/// \returns this Symbol's line number. The line number is 1-based.
|
||||
int line() const;
|
||||
int line() const { return _line; }
|
||||
|
||||
/// \returns this Symbol's column number. The column number is 1-based.
|
||||
int column() const;
|
||||
int column() const { return _column; }
|
||||
|
||||
/// Returns this Symbol's file name.
|
||||
const StringLiteral *fileId() const;
|
||||
const StringLiteral *fileId() const { return _fileId; }
|
||||
|
||||
/// Returns this Symbol's file name.
|
||||
const char *fileName() const;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
int fileNameLength() const;
|
||||
|
||||
/// Returns this Symbol's name.
|
||||
const Name *name() const;
|
||||
const Name *name() const { return _name; }
|
||||
|
||||
/// Sets this Symbol's name.
|
||||
void setName(const Name *name); // ### dangerous
|
||||
@@ -88,115 +88,46 @@ public:
|
||||
const Identifier *identifier() const;
|
||||
|
||||
/// Returns this Symbol's storage class specifier.
|
||||
int storage() const;
|
||||
int storage() const { return _storage; }
|
||||
|
||||
/// Sets this Symbol's storage class specifier.
|
||||
void setStorage(int storage);
|
||||
void setStorage(int storage) { _storage = storage; }
|
||||
|
||||
/// Returns this Symbol's visibility.
|
||||
int visibility() const;
|
||||
int visibility() const { return _visibility; }
|
||||
|
||||
/// Sets this Symbol's visibility.
|
||||
void setVisibility(int visibility);
|
||||
void setVisibility(int visibility) { _visibility = visibility; }
|
||||
|
||||
/// Returns the next chained Symbol.
|
||||
Symbol *next() const;
|
||||
Symbol *next() const { return _next; }
|
||||
|
||||
/// Returns true if this Symbol has friend storage specifier.
|
||||
bool isFriend() const;
|
||||
bool isFriend() const { return _storage == Friend; }
|
||||
|
||||
/// Returns true if this Symbol has register storage specifier.
|
||||
bool isRegister() const;
|
||||
bool isRegister() const { return _storage == Register; }
|
||||
|
||||
/// Returns true if this Symbol has static storage specifier.
|
||||
bool isStatic() const;
|
||||
bool isStatic() const { return _storage == Static; }
|
||||
|
||||
/// Returns true if this Symbol has extern storage specifier.
|
||||
bool isExtern() const;
|
||||
bool isExtern() const { return _storage == Extern; }
|
||||
|
||||
/// Returns true if this Symbol has mutable storage specifier.
|
||||
bool isMutable() const;
|
||||
bool isMutable() const { return _storage == Mutable; }
|
||||
|
||||
/// Returns true if this Symbol has typedef storage specifier.
|
||||
bool isTypedef() const;
|
||||
bool isTypedef() const { return _storage == Typedef; }
|
||||
|
||||
/// Returns true if this Symbol's visibility is public.
|
||||
bool isPublic() const;
|
||||
bool isPublic() const { return _visibility == Public; }
|
||||
|
||||
/// Returns true if this Symbol's visibility is protected.
|
||||
bool isProtected() const;
|
||||
bool isProtected() const { return _visibility == Protected; }
|
||||
|
||||
/// Returns true if this Symbol's visibility is private.
|
||||
bool isPrivate() const;
|
||||
|
||||
/// Returns true if this Symbol is a Scope.
|
||||
bool isScope() const;
|
||||
|
||||
/// Returns true if this Symbol is an Enum.
|
||||
bool isEnum() const;
|
||||
|
||||
/// Returns true if this Symbol is an Function.
|
||||
bool isFunction() const;
|
||||
|
||||
/// Returns true if this Symbol is a Namespace.
|
||||
bool isNamespace() const;
|
||||
|
||||
/// Returns true if this Symbol is a Template.
|
||||
bool isTemplate() const;
|
||||
|
||||
/// Returns true if this Symbol is a Class.
|
||||
bool isClass() const;
|
||||
|
||||
/// Returns true if this Symbol is a Block.
|
||||
bool isBlock() const;
|
||||
|
||||
/// Returns true if this Symbol is a UsingNamespaceDirective.
|
||||
bool isUsingNamespaceDirective() const;
|
||||
|
||||
/// Returns true if this Symbol is a UsingDeclaration.
|
||||
bool isUsingDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is a Declaration.
|
||||
bool isDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is an Argument.
|
||||
bool isArgument() const;
|
||||
|
||||
/// Returns true if this Symbol is a Typename argument.
|
||||
bool isTypenameArgument() const;
|
||||
|
||||
/// Returns true if this Symbol is a BaseClass.
|
||||
bool isBaseClass() const;
|
||||
|
||||
/// Returns true if this Symbol is a ForwardClassDeclaration.
|
||||
bool isForwardClassDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is a QtPropertyDeclaration.
|
||||
bool isQtPropertyDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is a QtEnum.
|
||||
bool isQtEnum() const;
|
||||
|
||||
bool isObjCBaseClass() const;
|
||||
bool isObjCBaseProtocol() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C Class declaration.
|
||||
bool isObjCClass() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C Class forward declaration.
|
||||
bool isObjCForwardClassDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C Protocol declaration.
|
||||
bool isObjCProtocol() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C Protocol forward declaration.
|
||||
bool isObjCForwardProtocolDeclaration() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C method declaration.
|
||||
bool isObjCMethod() const;
|
||||
|
||||
/// Returns true if this Symbol is an Objective-C @property declaration.
|
||||
bool isObjCPropertyDeclaration() const;
|
||||
bool isPrivate() const { return _visibility == Private; }
|
||||
|
||||
Utils::Link toLink() const;
|
||||
|
||||
@@ -226,53 +157,98 @@ public:
|
||||
virtual const ObjCMethod *asObjCMethod() const { return nullptr; }
|
||||
virtual const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Scope.
|
||||
virtual Scope *asScope() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Enum.
|
||||
virtual Enum *asEnum() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Function.
|
||||
virtual Function *asFunction() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Namespace.
|
||||
virtual Namespace *asNamespace() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Template.
|
||||
virtual Template *asTemplate() { return nullptr; }
|
||||
|
||||
virtual NamespaceAlias *asNamespaceAlias() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Class.
|
||||
virtual Class *asClass() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Block.
|
||||
virtual Block *asBlock() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a UsingNamespaceDirective.
|
||||
virtual UsingNamespaceDirective *asUsingNamespaceDirective() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a UsingDeclaration.
|
||||
virtual UsingDeclaration *asUsingDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Declaration.
|
||||
virtual Declaration *asDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Argument.
|
||||
virtual Argument *asArgument() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a Typename argument.
|
||||
virtual TypenameArgument *asTypenameArgument() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a BaseClass.
|
||||
virtual BaseClass *asBaseClass() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a ForwardClassDeclaration.
|
||||
virtual ForwardClassDeclaration *asForwardClassDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a QtPropertyDeclaration.
|
||||
virtual QtPropertyDeclaration *asQtPropertyDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as a QtEnum.
|
||||
virtual QtEnum *asQtEnum() { return nullptr; }
|
||||
|
||||
virtual ObjCBaseClass *asObjCBaseClass() { return nullptr; }
|
||||
virtual ObjCBaseProtocol *asObjCBaseProtocol() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C Class declaration.
|
||||
virtual ObjCClass *asObjCClass() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C Class forward declaration.
|
||||
virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C Protocol declaration.
|
||||
virtual ObjCProtocol *asObjCProtocol() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C Protocol forward declaration.
|
||||
virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C method declaration.
|
||||
virtual ObjCMethod *asObjCMethod() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol as an Objective-C @property declaration.
|
||||
virtual ObjCPropertyDeclaration *asObjCPropertyDeclaration() { return nullptr; }
|
||||
|
||||
/// Returns this Symbol's type.
|
||||
virtual FullySpecifiedType type() const = 0;
|
||||
|
||||
/// Returns this Symbol's hash value.
|
||||
unsigned hashCode() const;
|
||||
unsigned hashCode() const { return _hashCode; }
|
||||
|
||||
/// Returns this Symbol's index.
|
||||
unsigned index() const;
|
||||
unsigned index() const { return _index; }
|
||||
|
||||
const Name *unqualifiedName() const;
|
||||
|
||||
bool isGenerated() const;
|
||||
bool isGenerated() const { return _isGenerated; }
|
||||
|
||||
bool isDeprecated() const;
|
||||
void setDeprecated(bool isDeprecated);
|
||||
bool isDeprecated() const { return _isDeprecated; }
|
||||
void setDeprecated(bool isDeprecated) { _isDeprecated = isDeprecated; }
|
||||
|
||||
bool isUnavailable() const;
|
||||
void setUnavailable(bool isUnavailable);
|
||||
bool isUnavailable() const { return _isUnavailable; }
|
||||
void setUnavailable(bool isUnavailable) { _isUnavailable = isUnavailable; }
|
||||
|
||||
/// Returns this Symbol's eclosing scope.
|
||||
Scope *enclosingScope() const;
|
||||
Scope *enclosingScope() const { return _enclosingScope; }
|
||||
|
||||
/// Returns the eclosing namespace scope.
|
||||
Namespace *enclosingNamespace() const;
|
||||
|
349
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
349
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
@@ -42,15 +42,13 @@ UsingNamespaceDirective::UsingNamespaceDirective(Clone *clone, Subst *subst, Usi
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
UsingNamespaceDirective::~UsingNamespaceDirective()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType UsingNamespaceDirective::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
void UsingNamespaceDirective::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
NamespaceAlias::NamespaceAlias(TranslationUnit *translationUnit,
|
||||
int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name), _namespaceName(nullptr)
|
||||
@@ -61,15 +59,6 @@ NamespaceAlias::NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *origi
|
||||
, _namespaceName(clone->name(original->_namespaceName, subst))
|
||||
{ }
|
||||
|
||||
NamespaceAlias::~NamespaceAlias()
|
||||
{ }
|
||||
|
||||
const Name *NamespaceAlias::namespaceName() const
|
||||
{ return _namespaceName; }
|
||||
|
||||
void NamespaceAlias::setNamespaceName(const Name *namespaceName)
|
||||
{ _namespaceName = namespaceName; }
|
||||
|
||||
FullySpecifiedType NamespaceAlias::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
@@ -86,15 +75,13 @@ UsingDeclaration::UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
UsingDeclaration::~UsingDeclaration()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType UsingDeclaration::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
void UsingDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||
void CPlusPlus::UsingDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
Declaration::Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name)
|
||||
, _initializer(nullptr)
|
||||
@@ -204,41 +191,16 @@ Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
|
||||
_type = newType;
|
||||
}
|
||||
|
||||
Declaration::~Declaration()
|
||||
{ }
|
||||
|
||||
void Declaration::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
void Declaration::setInitializer(const StringLiteral *initializer)
|
||||
{
|
||||
_initializer = initializer;
|
||||
}
|
||||
|
||||
FullySpecifiedType Declaration::type() const
|
||||
{ return _type; }
|
||||
|
||||
const StringLiteral *Declaration::getInitializer() const
|
||||
{
|
||||
return _initializer;
|
||||
}
|
||||
|
||||
void Declaration::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Declaration(translationUnit, sourceLocation, name)
|
||||
, _constantValue(nullptr)
|
||||
{}
|
||||
|
||||
EnumeratorDeclaration::~EnumeratorDeclaration()
|
||||
{}
|
||||
|
||||
const StringLiteral *EnumeratorDeclaration::constantValue() const
|
||||
{ return _constantValue; }
|
||||
|
||||
void EnumeratorDeclaration::setConstantValue(const StringLiteral *constantValue)
|
||||
{ _constantValue = constantValue; }
|
||||
|
||||
Argument::Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name),
|
||||
@@ -251,27 +213,10 @@ Argument::Argument(Clone *clone, Subst *subst, Argument *original)
|
||||
, _type(clone->type(original->_type, subst))
|
||||
{ }
|
||||
|
||||
Argument::~Argument()
|
||||
{ }
|
||||
|
||||
bool Argument::hasInitializer() const
|
||||
{ return _initializer != nullptr; }
|
||||
|
||||
const StringLiteral *Argument::initializer() const
|
||||
{ return _initializer; }
|
||||
|
||||
void Argument::setInitializer(const StringLiteral *initializer)
|
||||
{ _initializer = initializer; }
|
||||
|
||||
void Argument::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
FullySpecifiedType Argument::type() const
|
||||
{ return _type; }
|
||||
|
||||
void Argument::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name)
|
||||
, _isClassDeclarator(false)
|
||||
@@ -283,18 +228,10 @@ TypenameArgument::TypenameArgument(Clone *clone, Subst *subst, TypenameArgument
|
||||
, _isClassDeclarator(original->_isClassDeclarator)
|
||||
{ }
|
||||
|
||||
TypenameArgument::~TypenameArgument()
|
||||
{ }
|
||||
|
||||
void TypenameArgument::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
FullySpecifiedType TypenameArgument::type() const
|
||||
{ return _type; }
|
||||
|
||||
void TypenameArgument::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
Function::Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Scope(translationUnit, sourceLocation, name),
|
||||
_flags(0)
|
||||
@@ -307,27 +244,6 @@ Function::Function(Clone *clone, Subst *subst, Function *original)
|
||||
, _flags(original->_flags)
|
||||
{ }
|
||||
|
||||
Function::~Function()
|
||||
{ }
|
||||
|
||||
bool Function::isNormal() const
|
||||
{ return f._methodKey == NormalMethod; }
|
||||
|
||||
bool Function::isSignal() const
|
||||
{ return f._methodKey == SignalMethod; }
|
||||
|
||||
bool Function::isSlot() const
|
||||
{ return f._methodKey == SlotMethod; }
|
||||
|
||||
bool Function::isInvokable() const
|
||||
{ return f._methodKey == InvokableMethod; }
|
||||
|
||||
int Function::methodKey() const
|
||||
{ return f._methodKey; }
|
||||
|
||||
void Function::setMethodKey(int key)
|
||||
{ f._methodKey = key; }
|
||||
|
||||
bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
|
||||
{
|
||||
if (! other)
|
||||
@@ -409,12 +325,6 @@ FullySpecifiedType Function::type() const
|
||||
return ty;
|
||||
}
|
||||
|
||||
FullySpecifiedType Function::returnType() const
|
||||
{ return _returnType; }
|
||||
|
||||
void Function::setReturnType(const FullySpecifiedType &returnType)
|
||||
{ _returnType = returnType; }
|
||||
|
||||
bool Function::hasReturnType() const
|
||||
{
|
||||
const FullySpecifiedType ty = returnType();
|
||||
@@ -431,7 +341,7 @@ int Function::argumentCount() const
|
||||
// arguments with a lambda as default argument will also have more blocks.
|
||||
int argc = 0;
|
||||
for (int it = 0; it < memCnt; ++it)
|
||||
if (memberAt(it)->isArgument())
|
||||
if (memberAt(it)->asArgument())
|
||||
++argc;
|
||||
return argc;
|
||||
}
|
||||
@@ -470,66 +380,6 @@ int Function::minimumArgumentCount() const
|
||||
return index;
|
||||
}
|
||||
|
||||
bool Function::isVirtual() const
|
||||
{ return f._isVirtual; }
|
||||
|
||||
void Function::setVirtual(bool isVirtual)
|
||||
{ f._isVirtual = isVirtual; }
|
||||
|
||||
bool Function::isOverride() const
|
||||
{ return f._isOverride; }
|
||||
|
||||
void Function::setOverride(bool isOverride)
|
||||
{ f._isOverride = isOverride; }
|
||||
|
||||
bool Function::isFinal() const
|
||||
{ return f._isFinal; }
|
||||
|
||||
void Function::setFinal(bool isFinal)
|
||||
{ f._isFinal = isFinal; }
|
||||
|
||||
bool Function::isVariadic() const
|
||||
{ return f._isVariadic; }
|
||||
|
||||
void Function::setVariadic(bool isVariadic)
|
||||
{ f._isVariadic = isVariadic; }
|
||||
|
||||
bool Function::isVariadicTemplate() const
|
||||
{ return f._isVariadicTemplate; }
|
||||
|
||||
void Function::setVariadicTemplate(bool isVariadicTemplate)
|
||||
{ f._isVariadicTemplate = isVariadicTemplate; }
|
||||
|
||||
bool Function::isConst() const
|
||||
{ return f._isConst; }
|
||||
|
||||
void Function::setConst(bool isConst)
|
||||
{ f._isConst = isConst; }
|
||||
|
||||
bool Function::isVolatile() const
|
||||
{ return f._isVolatile; }
|
||||
|
||||
void Function::setVolatile(bool isVolatile)
|
||||
{ f._isVolatile = isVolatile; }
|
||||
|
||||
bool Function::isPureVirtual() const
|
||||
{ return f._isPureVirtual; }
|
||||
|
||||
void Function::setPureVirtual(bool isPureVirtual)
|
||||
{ f._isPureVirtual = isPureVirtual; }
|
||||
|
||||
Function::RefQualifier Function::refQualifier() const
|
||||
{ return static_cast<RefQualifier>(f._refQualifier); }
|
||||
|
||||
void Function::setRefQualifier(Function::RefQualifier refQualifier)
|
||||
{ f._refQualifier = refQualifier; }
|
||||
|
||||
bool Function::isAmbiguous() const
|
||||
{ return f._isAmbiguous; }
|
||||
|
||||
void Function::setAmbiguous(bool isAmbiguous)
|
||||
{ f._isAmbiguous = isAmbiguous; }
|
||||
|
||||
void Function::visitSymbol0(SymbolVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
@@ -569,11 +419,6 @@ bool Function::maybeValidPrototype(int actualArgumentCount) const
|
||||
return true;
|
||||
}
|
||||
|
||||
const StringLiteral *Function::exceptionSpecification()
|
||||
{ return _exceptionSpecification; }
|
||||
|
||||
void Function::setExceptionSpecification(const StringLiteral *spec)
|
||||
{ _exceptionSpecification = spec; }
|
||||
|
||||
Block::Block(TranslationUnit *translationUnit, int sourceLocation)
|
||||
: Scope(translationUnit, sourceLocation, /*name = */ nullptr)
|
||||
@@ -583,9 +428,6 @@ Block::Block(Clone *clone, Subst *subst, Block *original)
|
||||
: Scope(clone, subst, original)
|
||||
{ }
|
||||
|
||||
Block::~Block()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType Block::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
@@ -608,21 +450,9 @@ Enum::Enum(Clone *clone, Subst *subst, Enum *original)
|
||||
, _isScoped(original->isScoped())
|
||||
{ }
|
||||
|
||||
Enum::~Enum()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType Enum::type() const
|
||||
{ return FullySpecifiedType(const_cast<Enum *>(this)); }
|
||||
|
||||
bool Enum::isScoped() const
|
||||
{
|
||||
return _isScoped;
|
||||
}
|
||||
|
||||
void Enum::setScoped(bool scoped)
|
||||
{
|
||||
_isScoped = scoped;
|
||||
}
|
||||
|
||||
void Enum::accept0(TypeVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
@@ -652,9 +482,6 @@ Template::Template(Clone *clone, Subst *subst, Template *original)
|
||||
: Scope(clone, subst, original)
|
||||
{ }
|
||||
|
||||
Template::~Template()
|
||||
{ }
|
||||
|
||||
int Template::templateParameterCount() const
|
||||
{
|
||||
if (declaration() != nullptr)
|
||||
@@ -663,17 +490,14 @@ int Template::templateParameterCount() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Symbol *Template::templateParameterAt(int index) const
|
||||
{ return memberAt(index); }
|
||||
|
||||
Symbol *Template::declaration() const
|
||||
{
|
||||
if (isEmpty())
|
||||
return nullptr;
|
||||
|
||||
if (Symbol *s = memberAt(memberCount() - 1)) {
|
||||
if (s->isClass() || s->isForwardClassDeclaration() ||
|
||||
s->isTemplate() || s->isFunction() || s->isDeclaration())
|
||||
if (s->asClass() || s->asForwardClassDeclaration() ||
|
||||
s->asTemplate() || s->asFunction() || s->asDeclaration())
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -712,9 +536,6 @@ Namespace::Namespace(Clone *clone, Subst *subst, Namespace *original)
|
||||
, _isInline(original->_isInline)
|
||||
{ }
|
||||
|
||||
Namespace::~Namespace()
|
||||
{ }
|
||||
|
||||
void Namespace::accept0(TypeVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
@@ -749,30 +570,10 @@ BaseClass::BaseClass(Clone *clone, Subst *subst, BaseClass *original)
|
||||
, _type(clone->type(original->_type, subst))
|
||||
{ }
|
||||
|
||||
BaseClass::~BaseClass()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType BaseClass::type() const
|
||||
{ return _type; }
|
||||
|
||||
void BaseClass::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
bool BaseClass::isVirtual() const
|
||||
{ return _isVirtual; }
|
||||
|
||||
void BaseClass::setVirtual(bool isVirtual)
|
||||
{ _isVirtual = isVirtual; }
|
||||
|
||||
bool BaseClass::isVariadic() const
|
||||
{ return _isVariadic; }
|
||||
|
||||
void BaseClass::setVariadic(bool isVariadic)
|
||||
{ _isVariadic = isVariadic; }
|
||||
|
||||
void BaseClass::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
|
||||
ForwardClassDeclaration::ForwardClassDeclaration(TranslationUnit *translationUnit,
|
||||
int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name)
|
||||
@@ -782,9 +583,6 @@ ForwardClassDeclaration::ForwardClassDeclaration(Clone *clone, Subst *subst, For
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
ForwardClassDeclaration::~ForwardClassDeclaration()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType ForwardClassDeclaration::type() const
|
||||
{ return FullySpecifiedType(const_cast<ForwardClassDeclaration *>(this)); }
|
||||
|
||||
@@ -815,24 +613,6 @@ Class::Class(Clone *clone, Subst *subst, Class *original)
|
||||
addBaseClass(clone->symbol(original->_baseClasses.at(i), subst)->asBaseClass());
|
||||
}
|
||||
|
||||
Class::~Class()
|
||||
{ }
|
||||
|
||||
bool Class::isClass() const
|
||||
{ return _key == ClassKey; }
|
||||
|
||||
bool Class::isStruct() const
|
||||
{ return _key == StructKey; }
|
||||
|
||||
bool Class::isUnion() const
|
||||
{ return _key == UnionKey; }
|
||||
|
||||
Class::Key Class::classKey() const
|
||||
{ return _key; }
|
||||
|
||||
void Class::setClassKey(Key key)
|
||||
{ _key = key; }
|
||||
|
||||
void Class::accept0(TypeVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
@@ -880,21 +660,6 @@ QtPropertyDeclaration::QtPropertyDeclaration(Clone *clone, Subst *subst, QtPrope
|
||||
, _flags(original->_flags)
|
||||
{ }
|
||||
|
||||
QtPropertyDeclaration::~QtPropertyDeclaration()
|
||||
{ }
|
||||
|
||||
void QtPropertyDeclaration::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
void QtPropertyDeclaration::setFlags(int flags)
|
||||
{ _flags = flags; }
|
||||
|
||||
int QtPropertyDeclaration::flags() const
|
||||
{ return _flags; }
|
||||
|
||||
FullySpecifiedType QtPropertyDeclaration::type() const
|
||||
{ return _type; }
|
||||
|
||||
void QtPropertyDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
@@ -907,12 +672,6 @@ QtEnum::QtEnum(Clone *clone, Subst *subst, QtEnum *original)
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
QtEnum::~QtEnum()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType QtEnum::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
void QtEnum::visitSymbol0(SymbolVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
@@ -925,8 +684,6 @@ ObjCBaseClass::ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
ObjCBaseClass::~ObjCBaseClass()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType ObjCBaseClass::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
@@ -942,9 +699,6 @@ ObjCBaseProtocol::ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
ObjCBaseProtocol::~ObjCBaseProtocol()
|
||||
{ }
|
||||
|
||||
FullySpecifiedType ObjCBaseProtocol::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
@@ -970,30 +724,6 @@ ObjCClass::ObjCClass(Clone *clone, Subst *subst, ObjCClass *original)
|
||||
addProtocol(clone->symbol(original->_protocols.at(i), subst)->asObjCBaseProtocol());
|
||||
}
|
||||
|
||||
ObjCClass::~ObjCClass()
|
||||
{}
|
||||
|
||||
bool ObjCClass::isInterface() const
|
||||
{ return _isInterface; }
|
||||
|
||||
void ObjCClass::setInterface(bool isInterface)
|
||||
{ _isInterface = isInterface; }
|
||||
|
||||
bool ObjCClass::isCategory() const
|
||||
{ return _categoryName != nullptr; }
|
||||
|
||||
const Name *ObjCClass::categoryName() const
|
||||
{ return _categoryName; }
|
||||
|
||||
void ObjCClass::setCategoryName(const Name *categoryName)
|
||||
{ _categoryName = categoryName; }
|
||||
|
||||
ObjCBaseClass *ObjCClass::baseClass() const
|
||||
{ return _baseClass; }
|
||||
|
||||
void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
|
||||
{ _baseClass = baseClass; }
|
||||
|
||||
int ObjCClass::protocolCount() const
|
||||
{ return int(_protocols.size()); }
|
||||
|
||||
@@ -1043,9 +773,6 @@ ObjCProtocol::ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original)
|
||||
addProtocol(clone->symbol(original->_protocols.at(i), subst)->asObjCBaseProtocol());
|
||||
}
|
||||
|
||||
ObjCProtocol::~ObjCProtocol()
|
||||
{}
|
||||
|
||||
int ObjCProtocol::protocolCount() const
|
||||
{ return int(_protocols.size()); }
|
||||
|
||||
@@ -1087,9 +814,6 @@ ObjCForwardClassDeclaration::ObjCForwardClassDeclaration(Clone *clone, Subst *su
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
ObjCForwardClassDeclaration::~ObjCForwardClassDeclaration()
|
||||
{}
|
||||
|
||||
FullySpecifiedType ObjCForwardClassDeclaration::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
@@ -1117,9 +841,6 @@ ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(Clone *clone, Sub
|
||||
: Symbol(clone, subst, original)
|
||||
{ }
|
||||
|
||||
ObjCForwardProtocolDeclaration::~ObjCForwardProtocolDeclaration()
|
||||
{}
|
||||
|
||||
FullySpecifiedType ObjCForwardProtocolDeclaration::type() const
|
||||
{ return FullySpecifiedType(); }
|
||||
|
||||
@@ -1148,9 +869,6 @@ ObjCMethod::ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original)
|
||||
, _flags(original->_flags)
|
||||
{ }
|
||||
|
||||
ObjCMethod::~ObjCMethod()
|
||||
{ }
|
||||
|
||||
void ObjCMethod::accept0(TypeVisitor *visitor)
|
||||
{ visitor->visit(this); }
|
||||
|
||||
@@ -1165,12 +883,6 @@ bool ObjCMethod::match0(const Type *otherType, Matcher *matcher) const
|
||||
FullySpecifiedType ObjCMethod::type() const
|
||||
{ return FullySpecifiedType(const_cast<ObjCMethod *>(this)); }
|
||||
|
||||
FullySpecifiedType ObjCMethod::returnType() const
|
||||
{ return _returnType; }
|
||||
|
||||
void ObjCMethod::setReturnType(const FullySpecifiedType &returnType)
|
||||
{ _returnType = returnType; }
|
||||
|
||||
bool ObjCMethod::hasReturnType() const
|
||||
{
|
||||
const FullySpecifiedType ty = returnType();
|
||||
@@ -1180,7 +892,7 @@ bool ObjCMethod::hasReturnType() const
|
||||
int ObjCMethod::argumentCount() const
|
||||
{
|
||||
const int c = memberCount();
|
||||
if (c > 0 && memberAt(c - 1)->isBlock())
|
||||
if (c > 0 && memberAt(c - 1)->asBlock())
|
||||
return c - 1;
|
||||
return c;
|
||||
}
|
||||
@@ -1196,12 +908,6 @@ bool ObjCMethod::hasArguments() const
|
||||
(argumentCount() == 1 && argumentAt(0)->type()->isVoidType()));
|
||||
}
|
||||
|
||||
bool ObjCMethod::isVariadic() const
|
||||
{ return f._isVariadic; }
|
||||
|
||||
void ObjCMethod::setVariadic(bool isVariadic)
|
||||
{ f._isVariadic = isVariadic; }
|
||||
|
||||
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
@@ -1228,39 +934,6 @@ ObjCPropertyDeclaration::ObjCPropertyDeclaration(Clone *clone, Subst *subst, Obj
|
||||
, _propertyAttributes(original->_propertyAttributes)
|
||||
{ }
|
||||
|
||||
ObjCPropertyDeclaration::~ObjCPropertyDeclaration()
|
||||
{}
|
||||
|
||||
bool ObjCPropertyDeclaration::hasAttribute(int attribute) const
|
||||
{ return _propertyAttributes & attribute; }
|
||||
|
||||
void ObjCPropertyDeclaration::setAttributes(int attributes)
|
||||
{ _propertyAttributes = attributes; }
|
||||
|
||||
bool ObjCPropertyDeclaration::hasGetter() const
|
||||
{ return hasAttribute(Getter); }
|
||||
|
||||
bool ObjCPropertyDeclaration::hasSetter() const
|
||||
{ return hasAttribute(Setter); }
|
||||
|
||||
const Name *ObjCPropertyDeclaration::getterName() const
|
||||
{ return _getterName; }
|
||||
|
||||
void ObjCPropertyDeclaration::setGetterName(const Name *getterName)
|
||||
{ _getterName = getterName; }
|
||||
|
||||
const Name *ObjCPropertyDeclaration::setterName() const
|
||||
{ return _setterName; }
|
||||
|
||||
void ObjCPropertyDeclaration::setSetterName(const Name *setterName)
|
||||
{ _setterName = setterName; }
|
||||
|
||||
void ObjCPropertyDeclaration::setType(const FullySpecifiedType &type)
|
||||
{ _type = type; }
|
||||
|
||||
FullySpecifiedType ObjCPropertyDeclaration::type() const
|
||||
{ return _type; }
|
||||
|
||||
void ObjCPropertyDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
|
531
src/libs/3rdparty/cplusplus/Symbols.h
vendored
531
src/libs/3rdparty/cplusplus/Symbols.h
vendored
@@ -31,64 +31,55 @@ namespace CPlusPlus {
|
||||
|
||||
class StringLiteral;
|
||||
|
||||
class CPLUSPLUS_EXPORT UsingNamespaceDirective: public Symbol
|
||||
class CPLUSPLUS_EXPORT UsingNamespaceDirective final : public Symbol
|
||||
{
|
||||
public:
|
||||
UsingNamespaceDirective(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
UsingNamespaceDirective(Clone *clone, Subst *subst, UsingNamespaceDirective *original);
|
||||
virtual ~UsingNamespaceDirective();
|
||||
~UsingNamespaceDirective() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const UsingNamespaceDirective *asUsingNamespaceDirective() const override
|
||||
{ return this; }
|
||||
|
||||
UsingNamespaceDirective *asUsingNamespaceDirective() override
|
||||
{ return this; }
|
||||
const UsingNamespaceDirective *asUsingNamespaceDirective() const override { return this; }
|
||||
UsingNamespaceDirective *asUsingNamespaceDirective() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT UsingDeclaration: public Symbol
|
||||
class CPLUSPLUS_EXPORT UsingDeclaration final : public Symbol
|
||||
{
|
||||
public:
|
||||
UsingDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration *original);
|
||||
virtual ~UsingDeclaration();
|
||||
~UsingDeclaration() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const UsingDeclaration *asUsingDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
UsingDeclaration *asUsingDeclaration() override
|
||||
{ return this; }
|
||||
const UsingDeclaration *asUsingDeclaration() const override { return this; }
|
||||
UsingDeclaration *asUsingDeclaration() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NamespaceAlias: public Symbol
|
||||
class CPLUSPLUS_EXPORT NamespaceAlias final : public Symbol
|
||||
{
|
||||
public:
|
||||
NamespaceAlias(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original);
|
||||
virtual ~NamespaceAlias();
|
||||
~NamespaceAlias() override = default;
|
||||
|
||||
const Name *namespaceName() const;
|
||||
void setNamespaceName(const Name *namespaceName);
|
||||
const Name *namespaceName() const { return _namespaceName; }
|
||||
void setNamespaceName(const Name *namespaceName) { _namespaceName = namespaceName; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const NamespaceAlias *asNamespaceAlias() const override
|
||||
{ return this; }
|
||||
|
||||
NamespaceAlias *asNamespaceAlias() override
|
||||
{ return this; }
|
||||
const NamespaceAlias *asNamespaceAlias() const override { return this; }
|
||||
NamespaceAlias *asNamespaceAlias() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -102,26 +93,20 @@ class CPLUSPLUS_EXPORT Declaration: public Symbol
|
||||
public:
|
||||
Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Declaration(Clone *clone, Subst *subst, Declaration *original);
|
||||
virtual ~Declaration();
|
||||
~Declaration() override = default;
|
||||
|
||||
void setType(const FullySpecifiedType &type);
|
||||
void setInitializer(StringLiteral const* initializer);
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
void setInitializer(StringLiteral const* initializer) { _initializer = initializer; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
const StringLiteral *getInitializer() const;
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
const StringLiteral *getInitializer() const { return _initializer; }
|
||||
|
||||
const Declaration *asDeclaration() const override
|
||||
{ return this; }
|
||||
const Declaration *asDeclaration() const override { return this; }
|
||||
Declaration *asDeclaration() override { return this; }
|
||||
|
||||
Declaration *asDeclaration() override
|
||||
{ return this; }
|
||||
|
||||
virtual EnumeratorDeclaration *asEnumeratorDeclarator()
|
||||
{ return nullptr; }
|
||||
|
||||
virtual const EnumeratorDeclaration *asEnumeratorDeclarator() const
|
||||
{ return nullptr; }
|
||||
virtual EnumeratorDeclaration *asEnumeratorDeclarator() { return nullptr; }
|
||||
virtual const EnumeratorDeclaration *asEnumeratorDeclarator() const { return nullptr; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -131,47 +116,41 @@ private:
|
||||
const StringLiteral *_initializer;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT EnumeratorDeclaration: public Declaration
|
||||
class CPLUSPLUS_EXPORT EnumeratorDeclaration final : public Declaration
|
||||
{
|
||||
public:
|
||||
EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
virtual ~EnumeratorDeclaration();
|
||||
~EnumeratorDeclaration() override = default;
|
||||
|
||||
const StringLiteral *constantValue() const;
|
||||
void setConstantValue(const StringLiteral *constantValue);
|
||||
const StringLiteral *constantValue() const { return _constantValue; }
|
||||
void setConstantValue(const StringLiteral *constantValue) { _constantValue = constantValue; }
|
||||
|
||||
EnumeratorDeclaration *asEnumeratorDeclarator() override
|
||||
{ return this; }
|
||||
|
||||
const EnumeratorDeclaration *asEnumeratorDeclarator() const override
|
||||
{ return this; }
|
||||
EnumeratorDeclaration *asEnumeratorDeclarator() override { return this; }
|
||||
const EnumeratorDeclaration *asEnumeratorDeclarator() const override { return this; }
|
||||
|
||||
private:
|
||||
const StringLiteral *_constantValue;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Argument: public Symbol
|
||||
class CPLUSPLUS_EXPORT Argument final : public Symbol
|
||||
{
|
||||
public:
|
||||
Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Argument(Clone *clone, Subst *subst, Argument *original);
|
||||
virtual ~Argument();
|
||||
~Argument() override = default;
|
||||
|
||||
void setType(const FullySpecifiedType &type);
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
|
||||
bool hasInitializer() const;
|
||||
bool hasInitializer() const { return _initializer != nullptr; }
|
||||
|
||||
const StringLiteral *initializer() const;
|
||||
void setInitializer(const StringLiteral *initializer);
|
||||
const StringLiteral *initializer() const { return _initializer; }
|
||||
void setInitializer(const StringLiteral *initializer) { _initializer = initializer; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
|
||||
const Argument *asArgument() const override
|
||||
{ return this; }
|
||||
|
||||
Argument *asArgument() override
|
||||
{ return this; }
|
||||
const Argument *asArgument() const override { return this; }
|
||||
Argument *asArgument() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -181,25 +160,22 @@ private:
|
||||
FullySpecifiedType _type;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypenameArgument: public Symbol
|
||||
class CPLUSPLUS_EXPORT TypenameArgument final : public Symbol
|
||||
{
|
||||
public:
|
||||
TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original);
|
||||
virtual ~TypenameArgument();
|
||||
~TypenameArgument() = default;
|
||||
|
||||
void setType(const FullySpecifiedType &type);
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
void setClassDeclarator(bool isClassDecl) { _isClassDeclarator = isClassDecl; }
|
||||
bool isClassDeclarator() const { return _isClassDeclarator; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
|
||||
const TypenameArgument *asTypenameArgument() const override
|
||||
{ return this; }
|
||||
|
||||
TypenameArgument *asTypenameArgument() override
|
||||
{ return this; }
|
||||
const TypenameArgument *asTypenameArgument() const override { return this; }
|
||||
TypenameArgument *asTypenameArgument() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -209,12 +185,12 @@ private:
|
||||
bool _isClassDeclarator;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Block: public Scope
|
||||
class CPLUSPLUS_EXPORT Block final : public Scope
|
||||
{
|
||||
public:
|
||||
Block(TranslationUnit *translationUnit, int sourceLocation);
|
||||
Block(Clone *clone, Subst *subst, Block *original);
|
||||
virtual ~Block();
|
||||
~Block() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
@@ -229,28 +205,22 @@ protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ForwardClassDeclaration: public Symbol, public Type
|
||||
class CPLUSPLUS_EXPORT ForwardClassDeclaration final : public Symbol, public Type
|
||||
{
|
||||
public:
|
||||
ForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
||||
virtual ~ForwardClassDeclaration();
|
||||
~ForwardClassDeclaration() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ForwardClassDeclaration *asForwardClassDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
ForwardClassDeclaration *asForwardClassDeclaration() override
|
||||
{ return this; }
|
||||
const ForwardClassDeclaration *asForwardClassDeclaration() const override { return this; }
|
||||
ForwardClassDeclaration *asForwardClassDeclaration() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ForwardClassDeclaration *asForwardClassDeclarationType() const override
|
||||
{ return this; }
|
||||
|
||||
ForwardClassDeclaration *asForwardClassDeclarationType() override
|
||||
{ return this; }
|
||||
const ForwardClassDeclaration *asForwardClassDeclarationType() const override { return this; }
|
||||
ForwardClassDeclaration *asForwardClassDeclarationType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -258,31 +228,25 @@ protected:
|
||||
bool match0(const Type *otherType, Matcher *matcher) const override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Enum: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT Enum final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Enum(Clone *clone, Subst *subst, Enum *original);
|
||||
virtual ~Enum();
|
||||
~Enum() override = default;
|
||||
|
||||
bool isScoped() const;
|
||||
void setScoped(bool scoped);
|
||||
bool isScoped() const { return _isScoped; }
|
||||
void setScoped(bool scoped) { _isScoped = scoped; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Enum *asEnum() const override
|
||||
{ return this; }
|
||||
|
||||
Enum *asEnum() override
|
||||
{ return this; }
|
||||
const Enum *asEnum() const override { return this; }
|
||||
Enum *asEnum() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const Enum *asEnumType() const override
|
||||
{ return this; }
|
||||
|
||||
Enum *asEnumType() override
|
||||
{ return this; }
|
||||
const Enum *asEnumType() const override { return this; }
|
||||
Enum *asEnumType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -293,7 +257,7 @@ private:
|
||||
bool _isScoped;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Function: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT Function final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
enum MethodKey {
|
||||
@@ -312,17 +276,18 @@ public:
|
||||
public:
|
||||
Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Function(Clone *clone, Subst *subst, Function *original);
|
||||
virtual ~Function();
|
||||
~Function() override = default;
|
||||
|
||||
bool isNormal() const;
|
||||
bool isSignal() const;
|
||||
bool isSlot() const;
|
||||
bool isInvokable() const;
|
||||
int methodKey() const;
|
||||
void setMethodKey(int key);
|
||||
bool isNormal() const { return f._methodKey == NormalMethod; }
|
||||
bool isSignal() const { return f._methodKey == SignalMethod; }
|
||||
bool isSlot() const { return f._methodKey == SlotMethod; }
|
||||
bool isInvokable() const { return f._methodKey == InvokableMethod; }
|
||||
|
||||
FullySpecifiedType returnType() const;
|
||||
void setReturnType(const FullySpecifiedType &returnType);
|
||||
int methodKey() const { return f._methodKey; }
|
||||
void setMethodKey(int key) { f._methodKey = key; }
|
||||
|
||||
FullySpecifiedType returnType() const { return _returnType; }
|
||||
void setReturnType(const FullySpecifiedType &returnType) { _returnType = returnType; }
|
||||
|
||||
/** Convenience function that returns whether the function returns something (including void). */
|
||||
bool hasReturnType() const;
|
||||
@@ -334,61 +299,55 @@ public:
|
||||
bool hasArguments() const;
|
||||
int minimumArgumentCount() const;
|
||||
|
||||
bool isVirtual() const;
|
||||
void setVirtual(bool isVirtual);
|
||||
bool isVirtual() const { return f._isVirtual; }
|
||||
void setVirtual(bool isVirtual) { f._isVirtual = isVirtual; }
|
||||
|
||||
bool isOverride() const;
|
||||
void setOverride(bool isOverride);
|
||||
bool isOverride() const { return f._isOverride; }
|
||||
void setOverride(bool isOverride) { f._isOverride = isOverride; }
|
||||
|
||||
bool isFinal() const;
|
||||
void setFinal(bool isFinal);
|
||||
bool isFinal() const { return f._isFinal; }
|
||||
void setFinal(bool isFinal) { f._isFinal = isFinal; }
|
||||
|
||||
bool isVariadic() const;
|
||||
void setVariadic(bool isVariadic);
|
||||
bool isVariadic() const { return f._isVariadic; }
|
||||
void setVariadic(bool isVariadic) { f._isVariadic = isVariadic; }
|
||||
|
||||
bool isVariadicTemplate() const;
|
||||
void setVariadicTemplate(bool isVariadicTemplate);
|
||||
bool isVariadicTemplate() const { return f._isVariadicTemplate; }
|
||||
void setVariadicTemplate(bool isVariadicTemplate) { f._isVariadicTemplate = isVariadicTemplate; }
|
||||
|
||||
bool isConst() const;
|
||||
void setConst(bool isConst);
|
||||
bool isConst() const { return f._isConst; }
|
||||
void setConst(bool isConst) { f._isConst = isConst; }
|
||||
|
||||
bool isStatic() const { return f._isStatic; }
|
||||
void setStatic(bool isStatic) { f._isStatic = isStatic; }
|
||||
|
||||
bool isVolatile() const;
|
||||
void setVolatile(bool isVolatile);
|
||||
bool isVolatile() const { return f._isVolatile; }
|
||||
void setVolatile(bool isVolatile) { f._isVolatile = isVolatile; }
|
||||
|
||||
bool isPureVirtual() const;
|
||||
void setPureVirtual(bool isPureVirtual);
|
||||
bool isPureVirtual() const { return f._isPureVirtual; }
|
||||
void setPureVirtual(bool isPureVirtual) { f._isPureVirtual = isPureVirtual; }
|
||||
|
||||
RefQualifier refQualifier() const;
|
||||
void setRefQualifier(RefQualifier refQualifier);
|
||||
RefQualifier refQualifier() const { return static_cast<RefQualifier>(f._refQualifier); }
|
||||
void setRefQualifier(RefQualifier refQualifier) { f._refQualifier = refQualifier; }
|
||||
|
||||
bool isSignatureEqualTo(const Function *other, Matcher *matcher = nullptr) const;
|
||||
|
||||
bool isAmbiguous() const; // internal
|
||||
void setAmbiguous(bool isAmbiguous); // internal
|
||||
bool isAmbiguous() const { return f._isAmbiguous; } // internal
|
||||
void setAmbiguous(bool isAmbiguous) { f._isAmbiguous = isAmbiguous; } // internal
|
||||
|
||||
bool maybeValidPrototype(int actualArgumentCount) const;
|
||||
|
||||
const StringLiteral *exceptionSpecification();
|
||||
void setExceptionSpecification(const StringLiteral *spec);
|
||||
const StringLiteral *exceptionSpecification() { return _exceptionSpecification; }
|
||||
void setExceptionSpecification(const StringLiteral *spec) { _exceptionSpecification = spec; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Function *asFunction() const override
|
||||
{ return this; }
|
||||
|
||||
Function *asFunction() override
|
||||
{ return this; }
|
||||
const Function *asFunction() const override { return this; }
|
||||
Function *asFunction() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const Function *asFunctionType() const override
|
||||
{ return this; }
|
||||
|
||||
Function *asFunctionType() override
|
||||
{ return this; }
|
||||
const Function *asFunctionType() const override { return this; }
|
||||
Function *asFunctionType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -418,32 +377,26 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Template: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT Template final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Template(Clone *clone, Subst *subst, Template *original);
|
||||
virtual ~Template();
|
||||
~Template() override = default;
|
||||
|
||||
int templateParameterCount() const;
|
||||
Symbol *templateParameterAt(int index) const;
|
||||
Symbol *templateParameterAt(int index) const { return memberAt(index); }
|
||||
Symbol *declaration() const;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Template *asTemplate() const override
|
||||
{ return this; }
|
||||
|
||||
Template *asTemplate() override
|
||||
{ return this; }
|
||||
const Template *asTemplate() const override { return this; }
|
||||
Template *asTemplate() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const Template *asTemplateType() const override
|
||||
{ return this; }
|
||||
|
||||
Template *asTemplateType() override
|
||||
{ return this; }
|
||||
const Template *asTemplateType() const override { return this; }
|
||||
Template *asTemplateType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -452,34 +405,25 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class CPLUSPLUS_EXPORT Namespace: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT Namespace final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Namespace(Clone *clone, Subst *subst, Namespace *original);
|
||||
virtual ~Namespace();
|
||||
~Namespace() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Namespace *asNamespace() const override
|
||||
{ return this; }
|
||||
|
||||
Namespace *asNamespace() override
|
||||
{ return this; }
|
||||
const Namespace *asNamespace() const override { return this; }
|
||||
Namespace *asNamespace() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const Namespace *asNamespaceType() const override
|
||||
{ return this; }
|
||||
const Namespace *asNamespaceType() const override { return this; }
|
||||
Namespace *asNamespaceType() override { return this; }
|
||||
|
||||
Namespace *asNamespaceType() override
|
||||
{ return this; }
|
||||
|
||||
bool isInline() const
|
||||
{ return _isInline; }
|
||||
|
||||
void setInline(bool onoff)
|
||||
{ _isInline = onoff; }
|
||||
bool isInline() const { return _isInline; }
|
||||
void setInline(bool onoff) { _isInline = onoff; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -490,28 +434,25 @@ private:
|
||||
bool _isInline;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT BaseClass: public Symbol
|
||||
class CPLUSPLUS_EXPORT BaseClass final : public Symbol
|
||||
{
|
||||
public:
|
||||
BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
BaseClass(Clone *clone, Subst *subst, BaseClass *original);
|
||||
virtual ~BaseClass();
|
||||
~BaseClass() override = default;
|
||||
|
||||
bool isVirtual() const;
|
||||
void setVirtual(bool isVirtual);
|
||||
bool isVirtual() const { return _isVirtual; }
|
||||
void setVirtual(bool isVirtual) { _isVirtual = isVirtual; }
|
||||
|
||||
bool isVariadic() const;
|
||||
void setVariadic(bool isVariadic);
|
||||
bool isVariadic() const { return _isVariadic; }
|
||||
void setVariadic(bool isVariadic) { _isVariadic = isVariadic; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
void setType(const FullySpecifiedType &type);
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
|
||||
const BaseClass *asBaseClass() const override
|
||||
{ return this; }
|
||||
|
||||
BaseClass *asBaseClass() override
|
||||
{ return this; }
|
||||
const BaseClass *asBaseClass() const override { return this; }
|
||||
BaseClass *asBaseClass() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -522,12 +463,12 @@ private:
|
||||
FullySpecifiedType _type;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Class: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT Class final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
Class(Clone *clone, Subst *subst, Class *original);
|
||||
virtual ~Class();
|
||||
~Class() override = default;
|
||||
|
||||
enum Key {
|
||||
ClassKey,
|
||||
@@ -535,11 +476,12 @@ public:
|
||||
UnionKey
|
||||
};
|
||||
|
||||
bool isClass() const;
|
||||
bool isStruct() const;
|
||||
bool isUnion() const;
|
||||
Key classKey() const;
|
||||
void setClassKey(Key key);
|
||||
bool isClass() const { return _key == ClassKey; }
|
||||
bool isStruct() const { return _key == StructKey; }
|
||||
bool isUnion() const { return _key == UnionKey; }
|
||||
|
||||
Key classKey() const { return _key; }
|
||||
void setClassKey(Key key) { _key = key; }
|
||||
|
||||
int baseClassCount() const;
|
||||
BaseClass *baseClassAt(int index) const;
|
||||
@@ -549,18 +491,12 @@ public:
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Class *asClass() const override
|
||||
{ return this; }
|
||||
|
||||
Class *asClass() override
|
||||
{ return this; }
|
||||
const Class *asClass() const override { return this; }
|
||||
Class *asClass() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const Class *asClassType() const override
|
||||
{ return this; }
|
||||
|
||||
Class *asClassType() override
|
||||
{ return this; }
|
||||
const Class *asClassType() const override { return this; }
|
||||
Class *asClassType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -572,7 +508,7 @@ private:
|
||||
std::vector<BaseClass *> _baseClasses;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT QtPropertyDeclaration: public Symbol
|
||||
class CPLUSPLUS_EXPORT QtPropertyDeclaration final : public Symbol
|
||||
{
|
||||
public:
|
||||
enum Flag {
|
||||
@@ -597,21 +533,17 @@ public:
|
||||
public:
|
||||
QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
QtPropertyDeclaration(Clone *clone, Subst *subst, QtPropertyDeclaration *original);
|
||||
virtual ~QtPropertyDeclaration();
|
||||
~QtPropertyDeclaration() = default;
|
||||
|
||||
void setType(const FullySpecifiedType &type);
|
||||
|
||||
void setFlags(int flags);
|
||||
int flags() const;
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
void setFlags(int flags) { _flags = flags; }
|
||||
int flags() const { return _flags; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
|
||||
const QtPropertyDeclaration *asQtPropertyDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
QtPropertyDeclaration *asQtPropertyDeclaration() override
|
||||
{ return this; }
|
||||
const QtPropertyDeclaration *asQtPropertyDeclaration() const override { return this; }
|
||||
QtPropertyDeclaration *asQtPropertyDeclaration() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -621,88 +553,73 @@ private:
|
||||
int _flags;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT QtEnum: public Symbol
|
||||
class CPLUSPLUS_EXPORT QtEnum final : public Symbol
|
||||
{
|
||||
public:
|
||||
QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
QtEnum(Clone *clone, Subst *subst, QtEnum *original);
|
||||
virtual ~QtEnum();
|
||||
~QtEnum() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
FullySpecifiedType type() const override { return FullySpecifiedType(); }
|
||||
|
||||
const QtEnum *asQtEnum() const override
|
||||
{ return this; }
|
||||
|
||||
QtEnum *asQtEnum() override
|
||||
{ return this; }
|
||||
const QtEnum *asQtEnum() const override { return this; }
|
||||
QtEnum *asQtEnum() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCBaseClass: public Symbol
|
||||
class CPLUSPLUS_EXPORT ObjCBaseClass final : public Symbol
|
||||
{
|
||||
public:
|
||||
ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original);
|
||||
virtual ~ObjCBaseClass();
|
||||
~ObjCBaseClass() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCBaseClass *asObjCBaseClass() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCBaseClass *asObjCBaseClass() override
|
||||
{ return this; }
|
||||
const ObjCBaseClass *asObjCBaseClass() const override { return this; }
|
||||
ObjCBaseClass *asObjCBaseClass() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCBaseProtocol: public Symbol
|
||||
class CPLUSPLUS_EXPORT ObjCBaseProtocol final : public Symbol
|
||||
{
|
||||
public:
|
||||
ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol *original);
|
||||
virtual ~ObjCBaseProtocol();
|
||||
~ObjCBaseProtocol() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCBaseProtocol *asObjCBaseProtocol() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCBaseProtocol *asObjCBaseProtocol() override
|
||||
{ return this; }
|
||||
const ObjCBaseProtocol *asObjCBaseProtocol() const override { return this; }
|
||||
ObjCBaseProtocol *asObjCBaseProtocol() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration: public Symbol, public Type
|
||||
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration final : public Symbol, public Type
|
||||
{
|
||||
public:
|
||||
ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
||||
virtual ~ObjCForwardProtocolDeclaration();
|
||||
~ObjCForwardProtocolDeclaration() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() override
|
||||
{ return this; }
|
||||
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const override { return this; }
|
||||
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() override
|
||||
{ return this; }
|
||||
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const override { return this; }
|
||||
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -710,12 +627,12 @@ protected:
|
||||
bool match0(const Type *otherType, Matcher *matcher) const override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCProtocol: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT ObjCProtocol final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original);
|
||||
virtual ~ObjCProtocol();
|
||||
~ObjCProtocol() override = default;
|
||||
|
||||
int protocolCount() const;
|
||||
ObjCBaseProtocol *protocolAt(int index) const;
|
||||
@@ -724,18 +641,12 @@ public:
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCProtocol *asObjCProtocol() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCProtocol *asObjCProtocol() override
|
||||
{ return this; }
|
||||
const ObjCProtocol *asObjCProtocol() const override { return this; }
|
||||
ObjCProtocol *asObjCProtocol() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ObjCProtocol *asObjCProtocolType() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCProtocol *asObjCProtocolType() override
|
||||
{ return this; }
|
||||
const ObjCProtocol *asObjCProtocolType() const override { return this; }
|
||||
ObjCProtocol *asObjCProtocolType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -746,28 +657,22 @@ private:
|
||||
std::vector<ObjCBaseProtocol *> _protocols;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration: public Symbol, public Type
|
||||
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration final : public Symbol, public Type
|
||||
{
|
||||
public:
|
||||
ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
||||
virtual ~ObjCForwardClassDeclaration();
|
||||
~ObjCForwardClassDeclaration() override = default;
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() override
|
||||
{ return this; }
|
||||
const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const override { return this; }
|
||||
ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() override
|
||||
{ return this; }
|
||||
const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const override { return this; }
|
||||
ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -775,22 +680,22 @@ protected:
|
||||
bool match0(const Type *otherType, Matcher *matcher) const override;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCClass: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT ObjCClass final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCClass(Clone *clone, Subst *subst, ObjCClass *original);
|
||||
virtual ~ObjCClass();
|
||||
~ObjCClass() override = default;
|
||||
|
||||
bool isInterface() const;
|
||||
void setInterface(bool isInterface);
|
||||
bool isInterface() const { return _isInterface; }
|
||||
void setInterface(bool isInterface) { _isInterface = isInterface; }
|
||||
|
||||
bool isCategory() const;
|
||||
const Name *categoryName() const;
|
||||
void setCategoryName(const Name *categoryName);
|
||||
bool isCategory() const { return _categoryName != nullptr; }
|
||||
const Name *categoryName() const { return _categoryName; }
|
||||
void setCategoryName(const Name *categoryName) { _categoryName = categoryName; }
|
||||
|
||||
ObjCBaseClass *baseClass() const;
|
||||
void setBaseClass(ObjCBaseClass *baseClass);
|
||||
ObjCBaseClass *baseClass() const { return _baseClass; }
|
||||
void setBaseClass(ObjCBaseClass *baseClass) { _baseClass = baseClass; }
|
||||
|
||||
int protocolCount() const;
|
||||
ObjCBaseProtocol *protocolAt(int index) const;
|
||||
@@ -799,18 +704,12 @@ public:
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCClass *asObjCClass() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCClass *asObjCClass() override
|
||||
{ return this; }
|
||||
const ObjCClass *asObjCClass() const override { return this; }
|
||||
ObjCClass *asObjCClass() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ObjCClass *asObjCClassType() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCClass *asObjCClassType() override
|
||||
{ return this; }
|
||||
const ObjCClass *asObjCClassType() const override { return this; }
|
||||
ObjCClass *asObjCClassType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -824,15 +723,15 @@ private:
|
||||
bool _isInterface;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMethod: public Scope, public Type
|
||||
class CPLUSPLUS_EXPORT ObjCMethod final : public Scope, public Type
|
||||
{
|
||||
public:
|
||||
ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original);
|
||||
virtual ~ObjCMethod();
|
||||
~ObjCMethod() override = default;
|
||||
|
||||
FullySpecifiedType returnType() const;
|
||||
void setReturnType(const FullySpecifiedType &returnType);
|
||||
FullySpecifiedType returnType() const { return _returnType; }
|
||||
void setReturnType(const FullySpecifiedType &returnType) { _returnType = returnType; }
|
||||
|
||||
/** Convenience function that returns whether the function returns something (including void). */
|
||||
bool hasReturnType() const;
|
||||
@@ -843,24 +742,18 @@ public:
|
||||
/** Convenience function that returns whether the function receives any arguments. */
|
||||
bool hasArguments() const;
|
||||
|
||||
bool isVariadic() const;
|
||||
void setVariadic(bool isVariadic);
|
||||
bool isVariadic() const { return f._isVariadic; }
|
||||
void setVariadic(bool isVariadic) { f._isVariadic = isVariadic; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const ObjCMethod *asObjCMethod() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCMethod *asObjCMethod() override
|
||||
{ return this; }
|
||||
const ObjCMethod *asObjCMethod() const override { return this; }
|
||||
ObjCMethod *asObjCMethod() override { return this; }
|
||||
|
||||
// Type's interface
|
||||
const ObjCMethod *asObjCMethodType() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCMethod *asObjCMethodType() override
|
||||
{ return this; }
|
||||
const ObjCMethod *asObjCMethodType() const override { return this; }
|
||||
ObjCMethod *asObjCMethodType() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
@@ -878,7 +771,7 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCPropertyDeclaration: public Symbol
|
||||
class CPLUSPLUS_EXPORT ObjCPropertyDeclaration final : public Symbol
|
||||
{
|
||||
public:
|
||||
enum PropertyAttributes {
|
||||
@@ -901,31 +794,27 @@ public:
|
||||
int sourceLocation,
|
||||
const Name *name);
|
||||
ObjCPropertyDeclaration(Clone *clone, Subst *subst, ObjCPropertyDeclaration *original);
|
||||
virtual ~ObjCPropertyDeclaration();
|
||||
~ObjCPropertyDeclaration() override = default;
|
||||
|
||||
bool hasAttribute(int attribute) const;
|
||||
void setAttributes(int attributes);
|
||||
bool hasAttribute(int attribute) const { return _propertyAttributes & attribute; }
|
||||
void setAttributes(int attributes) { _propertyAttributes = attributes; }
|
||||
|
||||
bool hasGetter() const;
|
||||
bool hasSetter() const;
|
||||
bool hasGetter() const { return hasAttribute(Getter); }
|
||||
bool hasSetter() const { return hasAttribute(Setter); }
|
||||
|
||||
const Name *getterName() const;
|
||||
const Name *getterName() const { return _getterName; }
|
||||
void setGetterName(const Name *getterName) { _getterName = getterName; }
|
||||
|
||||
void setGetterName(const Name *getterName);
|
||||
const Name *setterName() const { return _setterName; }
|
||||
void setSetterName(const Name *setterName) { _setterName = setterName; }
|
||||
|
||||
const Name *setterName() const;
|
||||
void setSetterName(const Name *setterName);
|
||||
|
||||
void setType(const FullySpecifiedType &type);
|
||||
void setType(const FullySpecifiedType &type) { _type = type; }
|
||||
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
FullySpecifiedType type() const override { return _type; }
|
||||
|
||||
const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const override
|
||||
{ return this; }
|
||||
|
||||
ObjCPropertyDeclaration *asObjCPropertyDeclaration() override
|
||||
{ return this; }
|
||||
const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const override { return this; }
|
||||
ObjCPropertyDeclaration *asObjCPropertyDeclaration() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
|
@@ -174,7 +174,7 @@ protected:
|
||||
bool visit(Template *symbol) override
|
||||
{
|
||||
if (Symbol *decl = symbol->declaration()) {
|
||||
if (decl->isFunction() || decl->isClass() || decl->isDeclaration())
|
||||
if (decl->asFunction() || decl->asClass() || decl->asDeclaration())
|
||||
return process(symbol);
|
||||
}
|
||||
return true;
|
||||
@@ -522,7 +522,7 @@ QString Document::functionAt(int line, int column, int *lineOpeningDeclaratorPar
|
||||
if (!scope)
|
||||
scope = symbol->enclosingScope();
|
||||
|
||||
while (scope && !scope->isFunction() )
|
||||
while (scope && !scope->asFunction() )
|
||||
scope = scope->enclosingScope();
|
||||
|
||||
if (!scope)
|
||||
|
@@ -458,8 +458,8 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co
|
||||
SubstitutionEnvironment *env = rewrite->env;
|
||||
Scope *scope = env->scope();
|
||||
|
||||
if (name->isTemplateNameId() ||
|
||||
(name->isQualifiedNameId() && name->asQualifiedNameId()->name()->isTemplateNameId()))
|
||||
if (name->asTemplateNameId() ||
|
||||
(name->asQualifiedNameId() && name->asQualifiedNameId()->name()->asTemplateNameId()))
|
||||
return FullySpecifiedType();
|
||||
|
||||
if (! scope)
|
||||
|
@@ -514,7 +514,7 @@ QString FindUsages::matchingLine(const Token &tk) const
|
||||
bool FindUsages::isLocalScope(Scope *scope)
|
||||
{
|
||||
if (scope) {
|
||||
if (scope->isBlock() || scope->isTemplate() || scope->isFunction())
|
||||
if (scope->asBlock() || scope->asTemplate() || scope->asFunction())
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
|
||||
const LookupItem &r = candidates.at(i);
|
||||
|
||||
if (Symbol *s = r.declaration()) {
|
||||
if (_declSymbol->isTypenameArgument()) {
|
||||
if (_declSymbol->asTypenameArgument()) {
|
||||
if (s != _declSymbol)
|
||||
return false;
|
||||
}
|
||||
@@ -535,8 +535,8 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
|
||||
Scope *declEnclosingScope = _declSymbol->enclosingScope();
|
||||
Scope *enclosingScope = s->enclosingScope();
|
||||
if (isLocalScope(declEnclosingScope) || isLocalScope(enclosingScope)) {
|
||||
if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
|
||||
&& s->isClass() && enclosingScope->isTemplate()) {
|
||||
if (_declSymbol->asClass() && declEnclosingScope->asTemplate()
|
||||
&& s->asClass() && enclosingScope->asTemplate()) {
|
||||
// for definition of functions of class defined outside the class definition
|
||||
Scope *templEnclosingDeclSymbol = declEnclosingScope;
|
||||
Scope *scopeOfTemplEnclosingDeclSymbol
|
||||
@@ -547,9 +547,9 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
|
||||
|
||||
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
|
||||
return false;
|
||||
} else if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
|
||||
&& enclosingScope->isClass()
|
||||
&& enclosingScope->enclosingScope()->isTemplate()) {
|
||||
} else if (_declSymbol->asClass() && declEnclosingScope->asTemplate()
|
||||
&& enclosingScope->asClass()
|
||||
&& enclosingScope->enclosingScope()->asTemplate()) {
|
||||
// for declaration inside template class
|
||||
Scope *templEnclosingDeclSymbol = declEnclosingScope;
|
||||
Scope *scopeOfTemplEnclosingDeclSymbol
|
||||
@@ -560,18 +560,18 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
|
||||
|
||||
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
|
||||
return false;
|
||||
} else if (enclosingScope->isTemplate() && ! _declSymbol->isTypenameArgument()) {
|
||||
if (declEnclosingScope->isTemplate()) {
|
||||
} else if (enclosingScope->asTemplate() && ! _declSymbol->asTypenameArgument()) {
|
||||
if (declEnclosingScope->asTemplate()) {
|
||||
if (enclosingScope->enclosingScope() != declEnclosingScope->enclosingScope())
|
||||
return false;
|
||||
} else {
|
||||
if (enclosingScope->enclosingScope() != declEnclosingScope)
|
||||
return false;
|
||||
}
|
||||
} else if (declEnclosingScope->isTemplate() && s->isTemplate()) {
|
||||
} else if (declEnclosingScope->asTemplate() && s->asTemplate()) {
|
||||
if (declEnclosingScope->enclosingScope() != enclosingScope)
|
||||
return false;
|
||||
} else if (! s->isUsingDeclaration()
|
||||
} else if (! s->asUsingDeclaration()
|
||||
&& enclosingScope != declEnclosingScope) {
|
||||
return false;
|
||||
}
|
||||
@@ -854,7 +854,7 @@ void FindUsages::memInitializer(MemInitializerAST *ast)
|
||||
if (! ast)
|
||||
return;
|
||||
|
||||
if (_currentScope->isFunction()) {
|
||||
if (_currentScope->asFunction()) {
|
||||
Class *classScope = _currentScope->enclosingClass();
|
||||
if (! classScope) {
|
||||
if (ClassOrNamespace *binding = _context.lookupType(_currentScope)) {
|
||||
|
@@ -57,7 +57,7 @@ Utils::CodeModelIcon::Type iconTypeForSymbol(const Symbol *symbol)
|
||||
}
|
||||
|
||||
FullySpecifiedType symbolType = symbol->type();
|
||||
if (symbol->isFunction() || (symbol->isDeclaration() && symbolType &&
|
||||
if (symbol->asFunction() || (symbol->asDeclaration() && symbolType &&
|
||||
symbolType->isFunctionType()))
|
||||
{
|
||||
const Function *function = symbol->asFunction();
|
||||
@@ -80,9 +80,9 @@ Utils::CodeModelIcon::Type iconTypeForSymbol(const Symbol *symbol)
|
||||
} else if (symbol->isPrivate()) {
|
||||
return symbol->isStatic() ? FuncPrivateStatic : FuncPrivate;
|
||||
}
|
||||
} else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) {
|
||||
} else if (symbol->enclosingScope() && symbol->enclosingScope()->asEnum()) {
|
||||
return Enumerator;
|
||||
} else if (symbol->isDeclaration() || symbol->isArgument()) {
|
||||
} else if (symbol->asDeclaration() || symbol->asArgument()) {
|
||||
if (symbol->isPublic()) {
|
||||
return symbol->isStatic() ? VarPublicStatic : VarPublic;
|
||||
} else if (symbol->isProtected()) {
|
||||
@@ -90,26 +90,26 @@ Utils::CodeModelIcon::Type iconTypeForSymbol(const Symbol *symbol)
|
||||
} else if (symbol->isPrivate()) {
|
||||
return symbol->isStatic() ? VarPrivateStatic : VarPrivate;
|
||||
}
|
||||
} else if (symbol->isEnum()) {
|
||||
} else if (symbol->asEnum()) {
|
||||
return Utils::CodeModelIcon::Enum;
|
||||
} else if (symbol->isForwardClassDeclaration()) {
|
||||
} else if (symbol->asForwardClassDeclaration()) {
|
||||
return Utils::CodeModelIcon::Class; // TODO: Store class key in ForwardClassDeclaration
|
||||
} else if (const Class *klass = symbol->asClass()) {
|
||||
return klass->isStruct() ? Struct : Utils::CodeModelIcon::Class;
|
||||
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
|
||||
} else if (symbol->asObjCClass() || symbol->asObjCForwardClassDeclaration()) {
|
||||
return Utils::CodeModelIcon::Class;
|
||||
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
|
||||
} else if (symbol->asObjCProtocol() || symbol->asObjCForwardProtocolDeclaration()) {
|
||||
return Utils::CodeModelIcon::Class;
|
||||
} else if (symbol->isObjCMethod()) {
|
||||
} else if (symbol->asObjCMethod()) {
|
||||
return FuncPublic;
|
||||
} else if (symbol->isNamespace()) {
|
||||
} else if (symbol->asNamespace()) {
|
||||
return Utils::CodeModelIcon::Namespace;
|
||||
} else if (symbol->isTypenameArgument()) {
|
||||
} else if (symbol->asTypenameArgument()) {
|
||||
return Utils::CodeModelIcon::Class;
|
||||
} else if (symbol->isQtPropertyDeclaration() || symbol->isObjCPropertyDeclaration()) {
|
||||
} else if (symbol->asQtPropertyDeclaration() || symbol->asObjCPropertyDeclaration()) {
|
||||
return Property;
|
||||
} else if (symbol->isUsingNamespaceDirective() ||
|
||||
symbol->isUsingDeclaration()) {
|
||||
} else if (symbol->asUsingNamespaceDirective() ||
|
||||
symbol->asUsingDeclaration()) {
|
||||
// TODO: Might be nice to have a different icons for these things
|
||||
return Utils::CodeModelIcon::Namespace;
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
addNames(q->base(), names);
|
||||
addNames(q->name(), names, addAllNames);
|
||||
} else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
|
||||
} else if (addAllNames || name->asNameId() || name->asTemplateNameId() || name->asAnonymousNameId()) {
|
||||
names->append(name);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static void path_helper(Symbol *symbol,
|
||||
path_helper(symbol->enclosingScope(), names, policy);
|
||||
|
||||
if (symbol->name()) {
|
||||
if (symbol->isClass() || symbol->isNamespace()) {
|
||||
if (symbol->asClass() || symbol->asNamespace()) {
|
||||
if (policy == LookupContext::HideInlineNamespaces) {
|
||||
auto ns = symbol->asNamespace();
|
||||
if (ns && ns->isInline())
|
||||
@@ -79,12 +79,12 @@ static void path_helper(Symbol *symbol,
|
||||
}
|
||||
addNames(symbol->name(), names);
|
||||
|
||||
} else if (symbol->isObjCClass() || symbol->isObjCBaseClass() || symbol->isObjCProtocol()
|
||||
|| symbol->isObjCForwardClassDeclaration() || symbol->isObjCForwardProtocolDeclaration()
|
||||
|| symbol->isForwardClassDeclaration()) {
|
||||
} else if (symbol->asObjCClass() || symbol->asObjCBaseClass() || symbol->asObjCProtocol()
|
||||
|| symbol->asObjCForwardClassDeclaration() || symbol->asObjCForwardProtocolDeclaration()
|
||||
|| symbol->asForwardClassDeclaration()) {
|
||||
addNames(symbol->name(), names);
|
||||
|
||||
} else if (symbol->isFunction()) {
|
||||
} else if (symbol->asFunction()) {
|
||||
if (const QualifiedNameId *q = symbol->name()->asQualifiedNameId())
|
||||
addNames(q->base(), names);
|
||||
} else if (Enum *e = symbol->asEnum()) {
|
||||
@@ -316,7 +316,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name,
|
||||
{
|
||||
QList<LookupItem> candidates;
|
||||
// if it is a nameId there can be a using declaration for it
|
||||
if (name->isNameId() || name->isTemplateNameId()) {
|
||||
if (name->asNameId() || name->asTemplateNameId()) {
|
||||
const QList<Symbol *> symbols = bindingScope->symbols();
|
||||
for (Symbol *s : symbols) {
|
||||
if (Scope *scope = s->asScope()) {
|
||||
@@ -409,7 +409,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
}
|
||||
}
|
||||
} else if (UsingDeclaration *ud = m->asUsingDeclaration()) {
|
||||
if (name->isNameId()) {
|
||||
if (name->asNameId()) {
|
||||
if (const Name *usingDeclarationName = ud->name()) {
|
||||
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
||||
if (q->name() && q->name()->match(name))
|
||||
@@ -433,7 +433,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
} else if (ClassOrNamespace *b = bindings()->lookupType(scope, enclosingBinding)) {
|
||||
return b->lookupType(name);
|
||||
} else if (Class *scopeAsClass = scope->asClass()) {
|
||||
if (scopeAsClass->enclosingScope()->isBlock()) {
|
||||
if (scopeAsClass->enclosingScope()->asBlock()) {
|
||||
if (ClassOrNamespace *b = lookupType(scopeAsClass->name(),
|
||||
scopeAsClass->enclosingScope(),
|
||||
enclosingBinding,
|
||||
@@ -460,13 +460,13 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
return candidates;
|
||||
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if (name->identifier() != nullptr && scope->isBlock()) {
|
||||
if (name->identifier() != nullptr && scope->asBlock()) {
|
||||
bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
|
||||
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's a local.
|
||||
//for qualified it can be outside of the local scope
|
||||
if (name->isQualifiedNameId())
|
||||
if (name->asQualifiedNameId())
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
@@ -502,13 +502,13 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's an argument or a template parameter.
|
||||
//for qualified it can be outside of the local scope
|
||||
if (name->isQualifiedNameId())
|
||||
if (name->asQualifiedNameId())
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (fun->name() && fun->name()->isQualifiedNameId()) {
|
||||
if (fun->name() && fun->name()->asQualifiedNameId()) {
|
||||
if (ClassOrNamespace *binding = bindings()->lookupType(fun)) {
|
||||
candidates = binding->find(name);
|
||||
|
||||
@@ -540,7 +540,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's a template parameter.
|
||||
//for qualified it can be outside of the local scope
|
||||
if (name->isQualifiedNameId())
|
||||
if (name->asQualifiedNameId())
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
@@ -572,7 +572,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
if (! candidates.isEmpty())
|
||||
return candidates;
|
||||
|
||||
} else if (scope->isObjCClass() || scope->isObjCProtocol()) {
|
||||
} else if (scope->asObjCClass() || scope->asObjCProtocol()) {
|
||||
if (ClassOrNamespace *binding = bindings()->lookupType(scope))
|
||||
candidates = binding->find(name);
|
||||
|
||||
@@ -740,7 +740,7 @@ void ClassOrNamespace::lookup_helper(const Name *name, ClassOrNamespace *binding
|
||||
for (Symbol *s : symbols) {
|
||||
if (s->isFriend())
|
||||
continue;
|
||||
else if (s->isUsingNamespaceDirective())
|
||||
else if (s->asUsingNamespaceDirective())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -825,11 +825,11 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
||||
for (Symbol *s = scope->find(id); s; s = s->next()) {
|
||||
if (s->isFriend())
|
||||
continue; // skip friends
|
||||
else if (s->isUsingNamespaceDirective())
|
||||
else if (s->asUsingNamespaceDirective())
|
||||
continue; // skip using namespace directives
|
||||
else if (! id->match(s->identifier()))
|
||||
continue;
|
||||
else if (s->name() && s->name()->isQualifiedNameId())
|
||||
else if (s->name() && s->name()->asQualifiedNameId())
|
||||
continue; // skip qualified ids.
|
||||
|
||||
if (Q_UNLIKELY(debug)) {
|
||||
@@ -851,7 +851,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
||||
}
|
||||
}
|
||||
|
||||
if (templateId && (s->isDeclaration() || s->isFunction())) {
|
||||
if (templateId && (s->asDeclaration() || s->asFunction())) {
|
||||
FullySpecifiedType ty = DeprecatedGenTemplateInstance::instantiate(templateId, s, control());
|
||||
item.setType(ty); // override the type.
|
||||
}
|
||||
@@ -991,7 +991,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
|
||||
} else if (! processed->contains(this)) {
|
||||
processed->insert(this);
|
||||
|
||||
if (name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
|
||||
if (name->asNameId() || name->asTemplateNameId() || name->asAnonymousNameId()) {
|
||||
flush();
|
||||
|
||||
const QList<Symbol *> symbolList = symbols();
|
||||
@@ -1136,7 +1136,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
ClassOrNamespace *origin)
|
||||
{
|
||||
Q_ASSERT(name != nullptr);
|
||||
Q_ASSERT(name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId());
|
||||
Q_ASSERT(name->asNameId() || name->asTemplateNameId() || name->asAnonymousNameId());
|
||||
|
||||
const_cast<ClassOrNamespace *>(this)->flush();
|
||||
|
||||
@@ -1255,7 +1255,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
return reference;
|
||||
}
|
||||
|
||||
if (!name->isTemplateNameId())
|
||||
if (!name->asTemplateNameId())
|
||||
_alreadyConsideredClasses.insert(referenceClass);
|
||||
|
||||
QSet<ClassOrNamespace *> knownUsings = Utils::toSet(reference->usings());
|
||||
@@ -1270,7 +1270,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
instantiation->_templateId = templId;
|
||||
|
||||
QSet<ClassOrNamespace *> otherProcessed;
|
||||
while (!origin->_symbols.isEmpty() && origin->_symbols[0]->isBlock()) {
|
||||
while (!origin->_symbols.isEmpty() && origin->_symbols[0]->asBlock()) {
|
||||
if (otherProcessed.contains(origin))
|
||||
break;
|
||||
otherProcessed.insert(origin);
|
||||
@@ -1634,7 +1634,7 @@ ClassOrNamespace *ClassOrNamespace::findOrCreateType(const Name *name, ClassOrNa
|
||||
|
||||
return findOrCreateType(q->base(), origin)->findOrCreateType(q->name(), origin, clazz);
|
||||
|
||||
} else if (name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
|
||||
} else if (name->asNameId() || name->asTemplateNameId() || name->asAnonymousNameId()) {
|
||||
QSet<ClassOrNamespace *> processed;
|
||||
ClassOrNamespace *e = nestedType(name, &processed, origin);
|
||||
|
||||
@@ -1791,7 +1791,7 @@ bool CreateBindings::visit(Class *klass)
|
||||
ClassOrNamespace *previous = _currentClassOrNamespace;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (klass->name() && klass->name()->isQualifiedNameId())
|
||||
if (klass->name() && klass->name()->asQualifiedNameId())
|
||||
binding = _currentClassOrNamespace->lookupType(klass->name());
|
||||
|
||||
if (! binding)
|
||||
@@ -1956,7 +1956,7 @@ bool CreateBindings::visit(NamespaceAlias *a)
|
||||
return false;
|
||||
|
||||
} else if (ClassOrNamespace *e = _currentClassOrNamespace->lookupType(a->namespaceName())) {
|
||||
if (a->name()->isNameId() || a->name()->isTemplateNameId() || a->name()->isAnonymousNameId())
|
||||
if (a->name()->asNameId() || a->name()->asTemplateNameId() || a->name()->asAnonymousNameId())
|
||||
_currentClassOrNamespace->addNestedType(a->name(), e);
|
||||
|
||||
} else if (false) {
|
||||
@@ -2042,12 +2042,12 @@ Symbol *CreateBindings::instantiateTemplateFunction(const Name *instantiationNam
|
||||
Template *specialization) const
|
||||
{
|
||||
if (!specialization || !specialization->declaration()
|
||||
|| !specialization->declaration()->isFunction())
|
||||
|| !specialization->declaration()->asFunction())
|
||||
return nullptr;
|
||||
|
||||
int argumentCountOfInstantiation = 0;
|
||||
const TemplateNameId *instantiation = nullptr;
|
||||
if (instantiationName->isTemplateNameId()) {
|
||||
if (instantiationName->asTemplateNameId()) {
|
||||
instantiation = instantiationName->asTemplateNameId();
|
||||
argumentCountOfInstantiation = instantiation->templateArgumentCount();
|
||||
} else {
|
||||
|
@@ -1045,7 +1045,7 @@ ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &origina
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (Class *klass = ty->asClassType()) {
|
||||
if (scope->isBlock())
|
||||
if (scope->asBlock())
|
||||
binding = _context.lookupType(klass->name(), scope, enclosingBinding);
|
||||
if (!binding)
|
||||
binding = _context.lookupType(klass, enclosingBinding);
|
||||
@@ -1135,7 +1135,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
instantiatedFunction = overloadTy->asFunctionType();
|
||||
} else if (overloadType->isTemplateType()
|
||||
&& overloadType->asTemplateType()->declaration()
|
||||
&& overloadType->asTemplateType()->declaration()->isFunction()) {
|
||||
&& overloadType->asTemplateType()->declaration()->asFunction()) {
|
||||
instantiatedFunction = overloadType->asTemplateType()->declaration()->asFunction();
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ void SymbolNameVisitor::accept(Symbol *symbol)
|
||||
if (Scope *scope = symbol->enclosingScope())
|
||||
accept(scope);
|
||||
|
||||
if (! symbol->isTemplate()) {
|
||||
if (! symbol->asTemplate()) {
|
||||
if (const Name *name = symbol->name()) {
|
||||
std::swap(_symbol, symbol);
|
||||
accept(name);
|
||||
|
@@ -105,17 +105,17 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
|
||||
// any symbol which does not contain :: in the name
|
||||
|
||||
//! \todo collect statistics and reorder to optimize
|
||||
if (symbol->isForwardClassDeclaration()
|
||||
if (symbol->asForwardClassDeclaration()
|
||||
|| symbol->isExtern()
|
||||
|| symbol->isFriend()
|
||||
|| symbol->isGenerated()
|
||||
|| symbol->isUsingNamespaceDirective()
|
||||
|| symbol->isUsingDeclaration()
|
||||
|| symbol->asUsingNamespaceDirective()
|
||||
|| symbol->asUsingDeclaration()
|
||||
)
|
||||
return;
|
||||
|
||||
const CPlusPlus::Name *symbolName = symbol->name();
|
||||
if (symbolName && symbolName->isQualifiedNameId())
|
||||
if (symbolName && symbolName->asQualifiedNameId())
|
||||
return;
|
||||
|
||||
QString name = g_overview.prettyName(symbolName).trimmed();
|
||||
@@ -139,7 +139,7 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
|
||||
childItem->d->m_symbolLocations.insert(location);
|
||||
|
||||
// prevent showing a content of the functions
|
||||
if (!symbol->isFunction()) {
|
||||
if (!symbol->asFunction()) {
|
||||
if (const CPlusPlus::Scope *scope = symbol->asScope()) {
|
||||
CPlusPlus::Scope::iterator cur = scope->memberBegin();
|
||||
CPlusPlus::Scope::iterator last = scope->memberEnd();
|
||||
@@ -155,7 +155,7 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
|
||||
}
|
||||
|
||||
// if item is empty and has not to be added
|
||||
if (!symbol->isNamespace() || childItem->childCount())
|
||||
if (!symbol->asNamespace() || childItem->childCount())
|
||||
m_symbolInformations.insert(information, childItem);
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ protected:
|
||||
addType(q->base());
|
||||
addType(q->name());
|
||||
|
||||
} else if (name->isNameId() || name->isTemplateNameId()) {
|
||||
} else if (name->asNameId() || name->asTemplateNameId()) {
|
||||
addType(name->identifier());
|
||||
|
||||
}
|
||||
@@ -132,7 +132,7 @@ protected:
|
||||
if (!name) {
|
||||
return;
|
||||
|
||||
} else if (name->isNameId()) {
|
||||
} else if (name->asNameId()) {
|
||||
const Identifier *id = name->identifier();
|
||||
_fields.insert(QByteArray::fromRawData(id->chars(), id->size()));
|
||||
|
||||
@@ -144,7 +144,7 @@ protected:
|
||||
if (!name) {
|
||||
return;
|
||||
|
||||
} else if (name->isNameId()) {
|
||||
} else if (name->asNameId()) {
|
||||
const Identifier *id = name->identifier();
|
||||
_functions.insert(QByteArray::fromRawData(id->chars(), id->size()));
|
||||
}
|
||||
@@ -155,7 +155,7 @@ protected:
|
||||
if (!name) {
|
||||
return;
|
||||
|
||||
} else if (name->isNameId() || name->isTemplateNameId()) {
|
||||
} else if (name->asNameId() || name->asTemplateNameId()) {
|
||||
const Identifier *id = name->identifier();
|
||||
_statics.insert(QByteArray::fromRawData(id->chars(), id->size()));
|
||||
|
||||
@@ -195,7 +195,7 @@ protected:
|
||||
|
||||
if (symbol->isTypedef())
|
||||
addType(symbol->name());
|
||||
else if (!symbol->type()->isFunctionType() && symbol->enclosingScope()->isClass())
|
||||
else if (!symbol->type()->isFunctionType() && symbol->enclosingScope()->asClass())
|
||||
addField(symbol->name());
|
||||
|
||||
return true;
|
||||
@@ -791,7 +791,7 @@ void CheckSymbols::checkNamespace(NameAST *name)
|
||||
if (ClassOrNamespace *b = _context.lookupType(name->name, enclosingScope())) {
|
||||
const QList<Symbol *> symbols = b->symbols();
|
||||
for (const Symbol *s : symbols) {
|
||||
if (s->isNamespace())
|
||||
if (s->asNamespace())
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -812,7 +812,7 @@ bool CheckSymbols::hasVirtualDestructor(Class *klass) const
|
||||
for (Symbol *s = klass->find(id); s; s = s->next()) {
|
||||
if (!s->name())
|
||||
continue;
|
||||
if (s->name()->isDestructorNameId()) {
|
||||
if (s->name()->asDestructorNameId()) {
|
||||
if (Function *funTy = s->type()->asFunctionType()) {
|
||||
if (funTy->isVirtual() && id->match(s->identifier()))
|
||||
return true;
|
||||
@@ -1229,7 +1229,7 @@ void CheckSymbols::addType(ClassOrNamespace *b, NameAST *ast)
|
||||
Kind kind = SemanticHighlighter::TypeUse;
|
||||
const QList<Symbol *> &symbols = b->symbols();
|
||||
for (const Symbol * const s : symbols) {
|
||||
if (s->isNamespace()) {
|
||||
if (s->asNamespace()) {
|
||||
kind = SemanticHighlighter::NamespaceUse;
|
||||
break;
|
||||
}
|
||||
@@ -1243,8 +1243,8 @@ bool CheckSymbols::isTemplateClass(Symbol *symbol) const
|
||||
if (symbol) {
|
||||
if (Template *templ = symbol->asTemplate()) {
|
||||
if (Symbol *declaration = templ->declaration()) {
|
||||
return declaration->isClass()
|
||||
|| declaration->isForwardClassDeclaration()
|
||||
return declaration->asClass()
|
||||
|| declaration->asForwardClassDeclaration()
|
||||
|| declaration->isTypedef();
|
||||
}
|
||||
}
|
||||
@@ -1264,14 +1264,14 @@ bool CheckSymbols::maybeAddTypeOrStatic(const QList<LookupItem> &candidates, Nam
|
||||
|
||||
for (const LookupItem &r : candidates) {
|
||||
Symbol *c = r.declaration();
|
||||
if (c->isUsingDeclaration()) // skip using declarations...
|
||||
if (c->asUsingDeclaration()) // skip using declarations...
|
||||
continue;
|
||||
if (c->isUsingNamespaceDirective()) // ... and using namespace directives.
|
||||
if (c->asUsingNamespaceDirective()) // ... and using namespace directives.
|
||||
continue;
|
||||
if (c->isTypedef() || c->isNamespace() ||
|
||||
if (c->isTypedef() || c->asNamespace() ||
|
||||
c->isStatic() || //consider also static variable
|
||||
c->isClass() || c->isEnum() || isTemplateClass(c) ||
|
||||
c->isForwardClassDeclaration() || c->isTypenameArgument() || c->enclosingEnum()) {
|
||||
c->asClass() || c->asEnum() || isTemplateClass(c) ||
|
||||
c->asForwardClassDeclaration() || c->asTypenameArgument() || c->enclosingEnum()) {
|
||||
int line, column;
|
||||
getTokenStartPosition(startToken, &line, &column);
|
||||
const unsigned length = tok.utf16chars();
|
||||
@@ -1279,7 +1279,7 @@ bool CheckSymbols::maybeAddTypeOrStatic(const QList<LookupItem> &candidates, Nam
|
||||
Kind kind = SemanticHighlighter::TypeUse;
|
||||
if (c->enclosingEnum() != nullptr)
|
||||
kind = SemanticHighlighter::EnumerationUse;
|
||||
else if (c->isNamespace())
|
||||
else if (c->asNamespace())
|
||||
kind = SemanticHighlighter::NamespaceUse;
|
||||
else if (c->isStatic())
|
||||
// treat static variable as a field(highlighting)
|
||||
@@ -1309,9 +1309,9 @@ bool CheckSymbols::maybeAddField(const QList<LookupItem> &candidates, NameAST *a
|
||||
Symbol *c = r.declaration();
|
||||
if (!c)
|
||||
continue;
|
||||
if (!c->isDeclaration())
|
||||
if (!c->asDeclaration())
|
||||
return false;
|
||||
if (!(c->enclosingScope() && c->enclosingScope()->isClass()))
|
||||
if (!(c->enclosingScope() && c->enclosingScope()->asClass()))
|
||||
return false; // shadowed
|
||||
if (c->isTypedef() || (c->type() && c->type()->isFunctionType()))
|
||||
return false; // shadowed
|
||||
@@ -1359,7 +1359,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
|
||||
|
||||
// In addition check for destructors, since the leading ~ is not taken into consideration.
|
||||
// We don't want to compare destructors with something else or the other way around.
|
||||
if (isDestructor != c->name()->isDestructorNameId())
|
||||
if (isDestructor != (c->name()->asDestructorNameId() != nullptr))
|
||||
continue;
|
||||
|
||||
isConstructor = isConstructorDeclaration(c);
|
||||
|
@@ -951,7 +951,7 @@ QVariant SymbolsModel::data(const QModelIndex &index, int role) const
|
||||
} else if (column == SymbolColumn) {
|
||||
QString name = Overview().prettyName(symbol->name());
|
||||
if (name.isEmpty())
|
||||
name = QLatin1String(symbol->isBlock() ? "<block>" : "<no name>");
|
||||
name = QLatin1String(symbol->asBlock() ? "<block>" : "<no name>");
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@@ -232,7 +232,7 @@ void CppAssistProposalItem::applyContextualContent(TextDocumentManipulatorInterf
|
||||
// except when it might take template parameters.
|
||||
if (!function->hasReturnType()
|
||||
&& (function->unqualifiedName()
|
||||
&& !function->unqualifiedName()->isDestructorNameId())) {
|
||||
&& !function->unqualifiedName()->asDestructorNameId())) {
|
||||
// Don't insert any magic, since the user might have just wanted to select the class
|
||||
|
||||
/// ### port me
|
||||
@@ -488,7 +488,7 @@ public:
|
||||
AssistProposalItem *operator()(Symbol *symbol)
|
||||
{
|
||||
//using declaration can be qualified
|
||||
if (!symbol || !symbol->name() || (symbol->name()->isQualifiedNameId()
|
||||
if (!symbol || !symbol->name() || (symbol->name()->asQualifiedNameId()
|
||||
&& !symbol->asUsingDeclaration()))
|
||||
return nullptr;
|
||||
|
||||
@@ -526,7 +526,7 @@ protected:
|
||||
void visit(const Identifier *name) override
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
if (!_symbol->isScope() || _symbol->isFunction())
|
||||
if (!_symbol->asScope() || _symbol->asFunction())
|
||||
_item->setDetail(overview.prettyType(_symbol->type(), name));
|
||||
}
|
||||
|
||||
@@ -1441,7 +1441,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
if (ClassOrNamespace *binding = context.lookupType(scope)) {
|
||||
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||
Symbol *member = scope->memberAt(i);
|
||||
if (member->isEnum()) {
|
||||
if (member->asEnum()) {
|
||||
if (ClassOrNamespace *b = binding->findBlock(block))
|
||||
completeNamespace(b);
|
||||
}
|
||||
@@ -1451,21 +1451,21 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
if (ClassOrNamespace *b = binding->lookupType(u->name()))
|
||||
usingBindings.append(b);
|
||||
} else if (Class *c = member->asClass()) {
|
||||
if (c->name()->isAnonymousNameId()) {
|
||||
if (c->name()->asAnonymousNameId()) {
|
||||
if (ClassOrNamespace *b = binding->findBlock(block))
|
||||
completeClass(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (scope->isFunction() || scope->isClass() || scope->isNamespace()) {
|
||||
} else if (scope->asFunction() || scope->asClass() || scope->asNamespace()) {
|
||||
currentBinding = context.lookupType(scope);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isBlock()) {
|
||||
if (scope->asBlock()) {
|
||||
for (int i = 0; i < scope->memberCount(); ++i)
|
||||
addCompletionItem(scope->memberAt(i), FunctionLocalsOrder);
|
||||
} else if (Function *fun = scope->asFunction()) {
|
||||
@@ -1491,7 +1491,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
const QList<Symbol *> symbols = currentBinding->symbols();
|
||||
|
||||
if (!symbols.isEmpty()) {
|
||||
if (symbols.first()->isClass())
|
||||
if (symbols.first()->asClass())
|
||||
completeClass(currentBinding);
|
||||
else
|
||||
completeNamespace(currentBinding);
|
||||
@@ -1567,7 +1567,7 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem>
|
||||
}
|
||||
|
||||
// it can be class defined inside a block
|
||||
if (classTy->enclosingScope()->isBlock()) {
|
||||
if (classTy->enclosingScope()->asBlock()) {
|
||||
if (ClassOrNamespace *b = context.lookupType(classTy->name(), classTy->enclosingScope())) {
|
||||
completeClass(b);
|
||||
break;
|
||||
@@ -1590,7 +1590,7 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem>
|
||||
|
||||
} else if (Enum *e = ty->asEnumType()) {
|
||||
// it can be class defined inside a block
|
||||
if (e->enclosingScope()->isBlock()) {
|
||||
if (e->enclosingScope()->asBlock()) {
|
||||
if (ClassOrNamespace *b = context.lookupType(e)) {
|
||||
Block *block = e->enclosingScope()->asBlock();
|
||||
if (ClassOrNamespace *bb = b->findBlock(block)) {
|
||||
@@ -1708,18 +1708,18 @@ void InternalCppCompletionAssistProcessor::addClassMembersToCompletion(Scope *sc
|
||||
for (Scope::iterator it = scope->memberBegin(); it != scope->memberEnd(); ++it) {
|
||||
Symbol *member = *it;
|
||||
if (member->isFriend()
|
||||
|| member->isQtPropertyDeclaration()
|
||||
|| member->isQtEnum()) {
|
||||
|| member->asQtPropertyDeclaration()
|
||||
|| member->asQtEnum()) {
|
||||
continue;
|
||||
} else if (!staticLookup && (member->isTypedef() ||
|
||||
member->isEnum() ||
|
||||
member->isClass())) {
|
||||
member->asEnum() ||
|
||||
member->asClass())) {
|
||||
continue;
|
||||
} else if (member->isClass() && member->name()->isAnonymousNameId()) {
|
||||
} else if (member->asClass() && member->name()->asAnonymousNameId()) {
|
||||
nestedAnonymouses.insert(member->asClass());
|
||||
} else if (member->isDeclaration()) {
|
||||
} else if (member->asDeclaration()) {
|
||||
Class *declTypeAsClass = member->asDeclaration()->type()->asClassType();
|
||||
if (declTypeAsClass && declTypeAsClass->name()->isAnonymousNameId())
|
||||
if (declTypeAsClass && declTypeAsClass->name()->asAnonymousNameId())
|
||||
nestedAnonymouses.erase(declTypeAsClass);
|
||||
}
|
||||
|
||||
@@ -1924,7 +1924,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q
|
||||
if (!memberName)
|
||||
continue; // skip anonymous member.
|
||||
|
||||
else if (memberName->isQualifiedNameId())
|
||||
else if (memberName->asQualifiedNameId())
|
||||
continue; // skip
|
||||
|
||||
if (Function *funTy = member->type()->asFunctionType()) {
|
||||
@@ -2015,7 +2015,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q
|
||||
|
||||
Scope *sc = context.thisDocument()->scopeAt(line, column);
|
||||
|
||||
if (sc && (sc->isClass() || sc->isNamespace())) {
|
||||
if (sc && (sc->asClass() || sc->asNamespace())) {
|
||||
// It may still be a function call. If the whole line parses as a function
|
||||
// declaration, we should be certain that it isn't.
|
||||
bool autocompleteSignature = false;
|
||||
|
@@ -124,10 +124,10 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
|
||||
overview.showReturnTypes = true;
|
||||
overview.showTemplateParameters = true;
|
||||
name = overview.prettyName(declaration->name());
|
||||
if (declaration->enclosingScope()->isClass() ||
|
||||
declaration->enclosingScope()->isNamespace() ||
|
||||
declaration->enclosingScope()->isEnum() ||
|
||||
declaration->enclosingScope()->isTemplate()) {
|
||||
if (declaration->enclosingScope()->asClass() ||
|
||||
declaration->enclosingScope()->asNamespace() ||
|
||||
declaration->enclosingScope()->asEnum() ||
|
||||
declaration->enclosingScope()->asTemplate()) {
|
||||
qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
|
||||
helpIdCandidates = stripName(qualifiedName);
|
||||
} else {
|
||||
@@ -187,7 +187,7 @@ void CppClass::lookupBases(QFutureInterfaceBase &futureInterface,
|
||||
for (ClassOrNamespace *baseClass : bases) {
|
||||
const QList<Symbol *> &symbols = baseClass->symbols();
|
||||
for (Symbol *symbol : symbols) {
|
||||
if (symbol->isClass() && (
|
||||
if (symbol->asClass() && (
|
||||
clazz = context.lookupType(symbol)) &&
|
||||
!visited.contains(clazz)) {
|
||||
CppClass baseCppClass(symbol);
|
||||
@@ -345,16 +345,16 @@ public:
|
||||
|
||||
static bool isCppClass(Symbol *symbol)
|
||||
{
|
||||
return symbol->isClass() || symbol->isForwardClassDeclaration()
|
||||
|| (symbol->isTemplate() && symbol->asTemplate()->declaration()
|
||||
&& (symbol->asTemplate()->declaration()->isClass()
|
||||
|| symbol->asTemplate()->declaration()->isForwardClassDeclaration()));
|
||||
return symbol->asClass() || symbol->asForwardClassDeclaration()
|
||||
|| (symbol->asTemplate() && symbol->asTemplate()->declaration()
|
||||
&& (symbol->asTemplate()->declaration()->asClass()
|
||||
|| symbol->asTemplate()->declaration()->asForwardClassDeclaration()));
|
||||
}
|
||||
|
||||
static Symbol *followClassDeclaration(Symbol *symbol, const Snapshot &snapshot, SymbolFinder symbolFinder,
|
||||
LookupContext *context = nullptr)
|
||||
{
|
||||
if (!symbol->isForwardClassDeclaration())
|
||||
if (!symbol->asForwardClassDeclaration())
|
||||
return symbol;
|
||||
|
||||
Symbol *classDeclaration = symbolFinder.findMatchingClassDeclaration(symbol, snapshot);
|
||||
@@ -422,7 +422,7 @@ static QSharedPointer<CppElement> handleLookupItemMatch(const Snapshot &snapshot
|
||||
element = QSharedPointer<CppElement>(new Unknown(type));
|
||||
} else {
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
if (declaration->isNamespace()) {
|
||||
if (declaration->asNamespace()) {
|
||||
element = QSharedPointer<CppElement>(new CppNamespace(declaration));
|
||||
} else if (isCppClass(declaration)) {
|
||||
LookupContext contextToUse = context;
|
||||
@@ -434,11 +434,11 @@ static QSharedPointer<CppElement> handleLookupItemMatch(const Snapshot &snapshot
|
||||
element = QSharedPointer<CppElement>(new CppEnumerator(enumerator));
|
||||
} else if (declaration->isTypedef()) {
|
||||
element = QSharedPointer<CppElement>(new CppTypedef(declaration));
|
||||
} else if (declaration->isFunction()
|
||||
} else if (declaration->asFunction()
|
||||
|| (type.isValid() && type->isFunctionType())
|
||||
|| declaration->isTemplate()) {
|
||||
|| declaration->asTemplate()) {
|
||||
element = QSharedPointer<CppElement>(new CppFunction(declaration));
|
||||
} else if (declaration->isDeclaration() && type.isValid()) {
|
||||
} else if (declaration->asDeclaration() && type.isValid()) {
|
||||
element = QSharedPointer<CppElement>(
|
||||
new CppVariable(declaration, context, lookupItem.scope()));
|
||||
} else {
|
||||
@@ -451,7 +451,7 @@ static QSharedPointer<CppElement> handleLookupItemMatch(const Snapshot &snapshot
|
||||
// special case for bug QTCREATORBUG-4780
|
||||
static bool shouldOmitElement(const LookupItem &lookupItem, const Scope *scope)
|
||||
{
|
||||
return !lookupItem.declaration() && scope && scope->isFunction()
|
||||
return !lookupItem.declaration() && scope && scope->asFunction()
|
||||
&& lookupItem.type().match(scope->asFunction()->returnType());
|
||||
}
|
||||
|
||||
@@ -484,8 +484,8 @@ static LookupItem findLookupItem(const CPlusPlus::Snapshot &snapshot, CPlusPlus:
|
||||
return LookupItem();
|
||||
|
||||
auto isInteresting = [followTypedef](Symbol *symbol) {
|
||||
return symbol && (!followTypedef || (symbol->isClass() || symbol->isTemplate()
|
||||
|| symbol->isForwardClassDeclaration() || symbol->isTypedef()));
|
||||
return symbol && (!followTypedef || (symbol->asClass() || symbol->asTemplate()
|
||||
|| symbol->asForwardClassDeclaration() || symbol->isTypedef()));
|
||||
};
|
||||
|
||||
for (const LookupItem &item : lookupItems) {
|
||||
@@ -749,7 +749,7 @@ Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, c
|
||||
Symbol *symbol = item.declaration();
|
||||
if (!symbol)
|
||||
continue;
|
||||
if (!symbol->isClass() && !symbol->isTemplate())
|
||||
if (!symbol->asClass() && !symbol->asTemplate())
|
||||
continue;
|
||||
return symbol->toLink();
|
||||
}
|
||||
|
@@ -413,11 +413,11 @@ static void find_helper(QFutureInterface<CPlusPlus::Usage> &future,
|
||||
symbol->fileNameLength());
|
||||
Utils::FilePaths files{sourceFile};
|
||||
|
||||
if (symbol->isClass()
|
||||
|| symbol->isForwardClassDeclaration()
|
||||
if (symbol->asClass()
|
||||
|| symbol->asForwardClassDeclaration()
|
||||
|| (symbol->enclosingScope()
|
||||
&& !symbol->isStatic()
|
||||
&& symbol->enclosingScope()->isNamespace())) {
|
||||
&& symbol->enclosingScope()->asNamespace())) {
|
||||
const CPlusPlus::Snapshot snapshotFromContext = context.snapshot();
|
||||
for (auto i = snapshotFromContext.begin(), ei = snapshotFromContext.end(); i != ei; ++i) {
|
||||
if (i.key() == sourceFile)
|
||||
@@ -479,7 +479,7 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol,
|
||||
parameters.symbolFileName = QByteArray(symbol->fileName());
|
||||
parameters.categorize = codeModelSettings()->categorizeFindReferences();
|
||||
|
||||
if (symbol->isClass() || symbol->isForwardClassDeclaration()) {
|
||||
if (symbol->asClass() || symbol->asForwardClassDeclaration()) {
|
||||
CPlusPlus::Overview overview;
|
||||
parameters.prettySymbolName =
|
||||
overview.prettyName(CPlusPlus::LookupContext::path(symbol).constLast());
|
||||
|
@@ -117,13 +117,13 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
|
||||
if (!m_document || m_snapshot.isEmpty() || !m_function || !m_scope)
|
||||
return false;
|
||||
|
||||
if (m_scope->isClass() && m_function->isPureVirtual()) {
|
||||
if (m_scope->asClass() && m_function->isPureVirtual()) {
|
||||
m_staticClassOfFunctionCallExpression = m_scope->asClass();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!m_baseExpressionAST || !m_expressionDocument
|
||||
|| m_scope->isClass() || m_scope->isFunction()) {
|
||||
|| m_scope->asClass() || m_scope->asFunction()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ Class *VirtualFunctionHelper::staticClassOfFunctionCallExpression_internal() con
|
||||
const QList<Symbol *> symbols = binding->symbols();
|
||||
if (!symbols.isEmpty()) {
|
||||
Symbol * const first = symbols.first();
|
||||
if (first->isForwardClassDeclaration())
|
||||
if (first->asForwardClassDeclaration())
|
||||
result = m_finder->findMatchingClassDeclaration(first, m_snapshot);
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,7 @@ static bool isForwardClassDeclaration(Type *type)
|
||||
return true;
|
||||
} else if (Template *templ = type->asTemplateType()) {
|
||||
if (Symbol *declaration = templ->declaration()) {
|
||||
if (declaration->isForwardClassDeclaration())
|
||||
if (declaration->asForwardClassDeclaration())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -384,7 +384,7 @@ Link attemptDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
||||
|
||||
Symbol *findDefinition(Symbol *symbol, const Snapshot &snapshot, SymbolFinder *symbolFinder)
|
||||
{
|
||||
if (symbol->isFunction())
|
||||
if (symbol->asFunction())
|
||||
return nullptr; // symbol is a function definition.
|
||||
|
||||
if (!symbol->type()->isFunctionType())
|
||||
@@ -706,7 +706,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
|
||||
for (const LookupItem &r : resolvedSymbols) {
|
||||
if (Symbol *d = r.declaration()) {
|
||||
if (d->isDeclaration() || d->isFunction()) {
|
||||
if (d->asDeclaration() || d->asFunction()) {
|
||||
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
|
||||
if (data.filePath().toString() == fileName) {
|
||||
if (line == d->line() && positionInBlock >= d->column()) {
|
||||
@@ -715,7 +715,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (d->isUsingDeclaration()) {
|
||||
} else if (d->asUsingDeclaration()) {
|
||||
int tokenBeginLineNumber = 0;
|
||||
int tokenBeginColumnNumber = 0;
|
||||
Utils::Text::convertPosition(document, beginOfToken, &tokenBeginLineNumber,
|
||||
@@ -768,11 +768,11 @@ void FollowSymbolUnderCursor::findLink(
|
||||
if (def == lastVisibleSymbol)
|
||||
def = nullptr; // jump to declaration then.
|
||||
|
||||
if (symbol->isForwardClassDeclaration()) {
|
||||
if (symbol->asForwardClassDeclaration()) {
|
||||
def = symbolFinder->findMatchingClassDeclaration(symbol, snapshot);
|
||||
} else if (Template *templ = symbol->asTemplate()) {
|
||||
if (Symbol *declaration = templ->declaration()) {
|
||||
if (declaration->isForwardClassDeclaration())
|
||||
if (declaration->asForwardClassDeclaration())
|
||||
def = symbolFinder->findMatchingClassDeclaration(declaration, snapshot);
|
||||
}
|
||||
}
|
||||
@@ -828,7 +828,7 @@ void FollowSymbolUnderCursor::switchDeclDef(
|
||||
} else if (SimpleDeclarationAST *simpleDeclaration = ast->asSimpleDeclaration()) {
|
||||
if (List<Symbol *> *symbols = simpleDeclaration->symbols) {
|
||||
if (Symbol *symbol = symbols->value) {
|
||||
if (symbol->isDeclaration()) {
|
||||
if (symbol->asDeclaration()) {
|
||||
declarationSymbol = symbol;
|
||||
if (symbol->type()->isFunctionType()) {
|
||||
functionDeclarationSymbol = symbol;
|
||||
|
@@ -76,8 +76,8 @@ protected:
|
||||
if (Symbol *member = scope->memberAt(i)) {
|
||||
if (member->isTypedef())
|
||||
continue;
|
||||
if (!member->isGenerated() && (member->isDeclaration() || member->isArgument())) {
|
||||
if (member->name() && member->name()->isNameId()) {
|
||||
if (!member->isGenerated() && (member->asDeclaration() || member->asArgument())) {
|
||||
if (member->name() && member->name()->asNameId()) {
|
||||
const Token token = tokenAt(member->sourceLocation());
|
||||
int line, column;
|
||||
getPosition(token.utf16charsBegin(), &line, &column);
|
||||
@@ -99,10 +99,10 @@ protected:
|
||||
const Identifier *id = identifier(simpleName->identifier_token);
|
||||
for (int i = _scopeStack.size() - 1; i != -1; --i) {
|
||||
if (Symbol *member = _scopeStack.at(i)->find(id)) {
|
||||
if (member->isTypedef() || !(member->isDeclaration() || member->isArgument()))
|
||||
if (member->isTypedef() || !(member->asDeclaration() || member->asArgument()))
|
||||
continue;
|
||||
if (!member->isGenerated() && (member->sourceLocation() < firstToken
|
||||
|| member->enclosingScope()->isFunction())) {
|
||||
|| member->enclosingScope()->asFunction())) {
|
||||
int line, column;
|
||||
getTokenStartPosition(simpleName->identifier_token, &line, &column);
|
||||
localUses[member].append(
|
||||
|
@@ -1485,13 +1485,13 @@ QSet<QString> CppModelManager::symbolsInFiles(const QSet<Utils::FilePath> &files
|
||||
|
||||
const CPlusPlus::Identifier *symId = sym->identifier();
|
||||
// Add any class, function or namespace identifiers
|
||||
if ((sym->isClass() || sym->isFunction() || sym->isNamespace()) && symId
|
||||
if ((sym->asClass() || sym->asFunction() || sym->asNamespace()) && symId
|
||||
&& symId->chars()) {
|
||||
uniqueSymbols.insert(QString::fromUtf8(symId->chars()));
|
||||
}
|
||||
|
||||
// Handle specific case : get "Foo" in "void Foo::function() {}"
|
||||
if (sym->isFunction() && !sym->asFunction()->isDeclaration()) {
|
||||
if (sym->asFunction() && !sym->asFunction()->asDeclaration()) {
|
||||
const char *className = belongingClassName(sym->asFunction());
|
||||
if (className)
|
||||
uniqueSymbols.insert(QString::fromUtf8(className));
|
||||
|
@@ -67,11 +67,11 @@ public:
|
||||
QString name = overviewModel->_overview.prettyName(symbol->name());
|
||||
if (name.isEmpty())
|
||||
name = QLatin1String("anonymous");
|
||||
if (symbol->isObjCForwardClassDeclaration())
|
||||
if (symbol->asObjCForwardClassDeclaration())
|
||||
name = QLatin1String("@class ") + name;
|
||||
if (symbol->isObjCForwardProtocolDeclaration() || symbol->isObjCProtocol())
|
||||
if (symbol->asObjCForwardProtocolDeclaration() || symbol->asObjCProtocol())
|
||||
name = QLatin1String("@protocol ") + name;
|
||||
if (symbol->isObjCClass()) {
|
||||
if (symbol->asObjCClass()) {
|
||||
ObjCClass *clazz = symbol->asObjCClass();
|
||||
if (clazz->isInterface())
|
||||
name = QLatin1String("@interface ") + name;
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
clazz->categoryName()));
|
||||
}
|
||||
}
|
||||
if (symbol->isObjCPropertyDeclaration())
|
||||
if (symbol->asObjCPropertyDeclaration())
|
||||
name = QLatin1String("@property ") + name;
|
||||
// if symbol is a template we might change it now - so, use a copy instead as we're const
|
||||
Symbol *symbl = symbol;
|
||||
@@ -98,13 +98,13 @@ public:
|
||||
name += QString("<%1>").arg(parameters.join(QLatin1String(", ")));
|
||||
symbl = templateDeclaration;
|
||||
}
|
||||
if (symbl->isObjCMethod()) {
|
||||
if (symbl->asObjCMethod()) {
|
||||
ObjCMethod *method = symbl->asObjCMethod();
|
||||
if (method->isStatic())
|
||||
name = QLatin1Char('+') + name;
|
||||
else
|
||||
name = QLatin1Char('-') + name;
|
||||
} else if (! symbl->isScope() || symbl->isFunction()) {
|
||||
} else if (! symbl->asScope() || symbl->asFunction()) {
|
||||
QString type = overviewModel->_overview.prettyType(symbl->type());
|
||||
if (Function *f = symbl->type()->asFunctionType()) {
|
||||
name += type;
|
||||
|
@@ -412,9 +412,9 @@ void PointerDeclarationFormatter::checkAndRewrite(DeclaratorAST *declarator,
|
||||
QString rewrittenDeclaration;
|
||||
const Name *name = symbol->name();
|
||||
if (name) {
|
||||
if (name->isOperatorNameId()
|
||||
|| (name->isQualifiedNameId()
|
||||
&& name->asQualifiedNameId()->name()->isOperatorNameId())) {
|
||||
if (name->asOperatorNameId()
|
||||
|| (name->asQualifiedNameId()
|
||||
&& name->asQualifiedNameId()->name()->asOperatorNameId())) {
|
||||
const QString operatorText = m_cppRefactoringFile->textOf(declarator->core_declarator);
|
||||
m_overview.includeWhiteSpaceInOperatorName = operatorText.contains(QLatin1Char(' '));
|
||||
}
|
||||
|
@@ -159,7 +159,7 @@ Class *isMemberFunction(const LookupContext &context, Function *function)
|
||||
QTC_ASSERT(function, return nullptr);
|
||||
|
||||
Scope *enclosingScope = function->enclosingScope();
|
||||
while (!(enclosingScope->isNamespace() || enclosingScope->isClass()))
|
||||
while (!(enclosingScope->asNamespace() || enclosingScope->asClass()))
|
||||
enclosingScope = enclosingScope->enclosingScope();
|
||||
QTC_ASSERT(enclosingScope != nullptr, return nullptr);
|
||||
|
||||
@@ -167,7 +167,7 @@ Class *isMemberFunction(const LookupContext &context, Function *function)
|
||||
if (!functionName)
|
||||
return nullptr;
|
||||
|
||||
if (!functionName->isQualifiedNameId())
|
||||
if (!functionName->asQualifiedNameId())
|
||||
return nullptr; // trying to add a declaration for a global function
|
||||
|
||||
const QualifiedNameId *q = functionName->asQualifiedNameId();
|
||||
@@ -192,7 +192,7 @@ Namespace *isNamespaceFunction(const LookupContext &context, Function *function)
|
||||
return nullptr;
|
||||
|
||||
Scope *enclosingScope = function->enclosingScope();
|
||||
while (!(enclosingScope->isNamespace() || enclosingScope->isClass()))
|
||||
while (!(enclosingScope->asNamespace() || enclosingScope->asClass()))
|
||||
enclosingScope = enclosingScope->enclosingScope();
|
||||
QTC_ASSERT(enclosingScope != nullptr, return nullptr);
|
||||
|
||||
@@ -201,7 +201,7 @@ Namespace *isNamespaceFunction(const LookupContext &context, Function *function)
|
||||
return nullptr;
|
||||
|
||||
// global namespace
|
||||
if (!functionName->isQualifiedNameId()) {
|
||||
if (!functionName->asQualifiedNameId()) {
|
||||
const QList<Symbol *> symbols = context.globalNamespace()->symbols();
|
||||
for (Symbol *s : symbols) {
|
||||
if (Namespace *matchingNamespace = s->asNamespace())
|
||||
@@ -259,8 +259,8 @@ void insertNewIncludeDirective(const QString &include, CppRefactoringFilePtr fil
|
||||
|
||||
bool nameIncludesOperatorName(const Name *name)
|
||||
{
|
||||
return name->isOperatorNameId()
|
||||
|| (name->isQualifiedNameId() && name->asQualifiedNameId()->name()->isOperatorNameId());
|
||||
return name->asOperatorNameId()
|
||||
|| (name->asQualifiedNameId() && name->asQualifiedNameId()->name()->asOperatorNameId());
|
||||
}
|
||||
|
||||
QString memberBaseName(const QString &name)
|
||||
@@ -1981,15 +1981,15 @@ LookupResult lookUpDefinition(const CppQuickFixInterface &interface, const NameA
|
||||
const QList<LookupItem> results = interface.context().lookup(name, scope);
|
||||
for (const LookupItem &item : results) {
|
||||
if (Symbol *declaration = item.declaration()) {
|
||||
if (declaration->isClass())
|
||||
if (declaration->asClass())
|
||||
return LookupResult::Declared;
|
||||
if (declaration->isForwardClassDeclaration())
|
||||
if (declaration->asForwardClassDeclaration())
|
||||
return LookupResult::ForwardDeclared;
|
||||
if (Template *templ = declaration->asTemplate()) {
|
||||
if (Symbol *declaration = templ->declaration()) {
|
||||
if (declaration->isClass())
|
||||
if (declaration->asClass())
|
||||
return LookupResult::Declared;
|
||||
if (declaration->isForwardClassDeclaration())
|
||||
if (declaration->asForwardClassDeclaration())
|
||||
return LookupResult::ForwardDeclared;
|
||||
}
|
||||
}
|
||||
@@ -2648,7 +2648,7 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
for (Symbol *symbol = matchingClass->find(qName->identifier());
|
||||
symbol; symbol = symbol->next()) {
|
||||
Symbol *s = symbol;
|
||||
if (fun->enclosingScope()->isTemplate()) {
|
||||
if (fun->enclosingScope()->asTemplate()) {
|
||||
if (const Template *templ = s->type()->asTemplateType()) {
|
||||
if (Symbol *decl = templ->declaration()) {
|
||||
if (decl->type()->isFunctionType())
|
||||
@@ -3221,7 +3221,7 @@ public:
|
||||
// Collect all member functions.
|
||||
for (auto it = theClass->memberBegin(); it != theClass->memberEnd(); ++it) {
|
||||
Symbol * const s = *it;
|
||||
if (!s->identifier() || !s->type() || !s->isDeclaration() || s->asFunction())
|
||||
if (!s->identifier() || !s->type() || !s->asDeclaration() || s->asFunction())
|
||||
continue;
|
||||
Function * const func = s->type()->asFunctionType();
|
||||
if (!func || func->isSignal() || func->isFriend())
|
||||
@@ -3676,7 +3676,7 @@ protected:
|
||||
if (m_settings->addUsingNamespaceinCppFile()) {
|
||||
// check if we have to insert a using namespace ...
|
||||
auto requiredNamespaces = getNamespaceNames(
|
||||
symbol->isClass() ? symbol : symbol->enclosingClass());
|
||||
symbol->asClass() ? symbol : symbol->enclosingClass());
|
||||
NSCheckerVisitor visitor(m_sourceFile.get(),
|
||||
requiredNamespaces,
|
||||
m_sourceFile->position(m_sourceFileInsertionPoint.line(),
|
||||
@@ -3933,7 +3933,7 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d
|
||||
|
||||
auto getterLocation = m_settings->determineGetterLocation(1);
|
||||
// if we have an anonymous class we must add code inside the class
|
||||
if (data.clazz->name()->isAnonymousNameId())
|
||||
if (data.clazz->name()->asAnonymousNameId())
|
||||
getterLocation = CppQuickFixSettings::FunctionLocation::InsideClass;
|
||||
|
||||
if (getterLocation == CppQuickFixSettings::FunctionLocation::InsideClass) {
|
||||
@@ -4055,7 +4055,7 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d
|
||||
|
||||
auto setterLocation = m_settings->determineSetterLocation(body.count('\n') - 2);
|
||||
// if we have an anonymous class we must add code inside the class
|
||||
if (data.clazz->name()->isAnonymousNameId())
|
||||
if (data.clazz->name()->asAnonymousNameId())
|
||||
setterLocation = CppQuickFixSettings::FunctionLocation::InsideClass;
|
||||
|
||||
if (setterLocation == CppQuickFixSettings::FunctionLocation::CppFile && !hasSourceFile())
|
||||
@@ -4133,7 +4133,7 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d
|
||||
// body.count('\n') - 2 : do not count the 2 at start
|
||||
auto resetLocation = m_settings->determineSetterLocation(body.count('\n') - 2);
|
||||
// if we have an anonymous class we must add code inside the class
|
||||
if (data.clazz->name()->isAnonymousNameId())
|
||||
if (data.clazz->name()->asAnonymousNameId())
|
||||
resetLocation = CppQuickFixSettings::FunctionLocation::InsideClass;
|
||||
|
||||
if (resetLocation == CppQuickFixSettings::FunctionLocation::CppFile && !hasSourceFile())
|
||||
@@ -4287,7 +4287,7 @@ QList<Symbol *> getMemberFunctions(const Class *clazz)
|
||||
Symbol *const s = *it;
|
||||
if (!s->identifier() || !s->type())
|
||||
continue;
|
||||
if ((s->isDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
if ((s->asDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
memberFunctions << s;
|
||||
}
|
||||
return memberFunctions;
|
||||
@@ -4372,7 +4372,7 @@ void GenerateGetterSetter::match(const CppQuickFixInterface &interface, QuickFix
|
||||
// no type can be determined
|
||||
return;
|
||||
}
|
||||
if (!symbol->isDeclaration()) {
|
||||
if (!symbol->asDeclaration()) {
|
||||
return;
|
||||
}
|
||||
existing.declarationSymbol = symbol->asDeclaration();
|
||||
@@ -4668,9 +4668,9 @@ public:
|
||||
Symbol *const s = *it;
|
||||
if (!s->identifier() || !s->type() || s->type().isTypedef())
|
||||
continue;
|
||||
if ((s->isDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
if ((s->asDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
memberFunctions << s;
|
||||
else if (s->isDeclaration() && (s->isPrivate() || s->isProtected()))
|
||||
else if (s->asDeclaration() && (s->isPrivate() || s->isProtected()))
|
||||
dataMembers << s;
|
||||
}
|
||||
|
||||
@@ -5263,7 +5263,7 @@ void ExtractFunction::match(const CppQuickFixInterface &interface, QuickFixOpera
|
||||
|| !refFuncDef->function_body->asCompoundStatement()->statement_list
|
||||
|| !refFuncDef->symbol
|
||||
|| !refFuncDef->symbol->name()
|
||||
|| refFuncDef->symbol->enclosingScope()->isTemplate() /* TODO: Templates... */) {
|
||||
|| refFuncDef->symbol->enclosingScope()->asTemplate() /* TODO: Templates... */) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5467,7 +5467,7 @@ public:
|
||||
|| !qName->identifier()->match(s->identifier())
|
||||
|| !s->type()->isFunctionType()
|
||||
|| !s->type().match(func->type())
|
||||
|| s->isFunction()) {
|
||||
|| s->asFunction()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -6657,7 +6657,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
for (Symbol *symbol = matchingClass->find(qName->identifier());
|
||||
symbol; symbol = symbol->next()) {
|
||||
Symbol *s = symbol;
|
||||
if (func->enclosingScope()->isTemplate()) {
|
||||
if (func->enclosingScope()->asTemplate()) {
|
||||
if (const Template *templ = s->type()->asTemplateType()) {
|
||||
if (Symbol *decl = templ->declaration()) {
|
||||
if (decl->type()->isFunctionType())
|
||||
@@ -6669,7 +6669,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
|| !qName->identifier()->match(s->identifier())
|
||||
|| !s->type()->isFunctionType()
|
||||
|| !s->type().match(func->type())
|
||||
|| s->isFunction()) {
|
||||
|| s->asFunction()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7362,8 +7362,8 @@ bool findRawAccessFunction(Class *klass, PointerType *pointerType, QString *objA
|
||||
for (auto it = klass->memberBegin(), end = klass->memberEnd(); it != end; ++it) {
|
||||
if (Function *func = (*it)->asFunction()) {
|
||||
const Name *funcName = func->name();
|
||||
if (!funcName->isOperatorNameId()
|
||||
&& !funcName->isConversionNameId()
|
||||
if (!funcName->asOperatorNameId()
|
||||
&& !funcName->asConversionNameId()
|
||||
&& func->returnType().type() == pointerType
|
||||
&& func->isConst()
|
||||
&& func->argumentCount() == 0) {
|
||||
@@ -8200,7 +8200,7 @@ void RemoveUsingNamespace::match(const CppQuickFixInterface &interface, QuickFix
|
||||
if (path.last()->asName())
|
||||
--n;
|
||||
UsingDirectiveAST *usingDirective = path.at(n)->asUsingDirective();
|
||||
if (usingDirective && usingDirective->name->name->isNameId()) {
|
||||
if (usingDirective && usingDirective->name->name->asNameId()) {
|
||||
result << new RemoveUsingNamespaceOperation(interface, usingDirective, false);
|
||||
const bool isHeader = ProjectFile::isHeader(ProjectFile::classify(interface.filePath().toString()));
|
||||
if (isHeader && path.at(n - 1)->asTranslationUnit()) // using namespace at global scope
|
||||
@@ -8813,9 +8813,9 @@ public:
|
||||
Symbol *const s = *it;
|
||||
if (!s->identifier() || !s->type() || s->type().isTypedef())
|
||||
continue;
|
||||
if ((s->isDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
if ((s->asDeclaration() && s->type()->asFunctionType()) || s->asFunction())
|
||||
continue;
|
||||
if (s->isDeclaration() && (s->isPrivate() || s->isProtected()) && !s->isStatic()) {
|
||||
if (s->asDeclaration() && (s->isPrivate() || s->isProtected()) && !s->isStatic()) {
|
||||
const auto name = QString::fromUtf8(s->identifier()->chars(),
|
||||
s->identifier()->size());
|
||||
parameterModel.emplaceBackParameter(name, s, memberCounter++);
|
||||
|
@@ -178,7 +178,7 @@ bool isOwnershipRAIIType(Symbol *symbol, const LookupContext &context)
|
||||
|
||||
// This is not a "real" comparison of types. What we do is to resolve the symbol
|
||||
// in question and then try to match its name with already known ones.
|
||||
if (symbol->isDeclaration()) {
|
||||
if (symbol->asDeclaration()) {
|
||||
Declaration *declaration = symbol->asDeclaration();
|
||||
const NamedType *namedType = declaration->type()->asNamedType();
|
||||
if (namedType) {
|
||||
|
@@ -216,7 +216,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
|
||||
if (ClassSpecifierAST *classSpec = spec->asClassSpecifier()) {
|
||||
if (classSpec->name) {
|
||||
QString aggregate;
|
||||
if (classSpec->symbol->isClass())
|
||||
if (classSpec->symbol->asClass())
|
||||
aggregate = QLatin1String("class");
|
||||
else if (classSpec->symbol->isStruct())
|
||||
aggregate = QLatin1String("struct");
|
||||
|
@@ -130,11 +130,11 @@ static bool isVirtualFunction_helper(const Function *function,
|
||||
|
||||
const QList<LookupItem> results = context.lookup(function->name(), function->enclosingScope());
|
||||
if (!results.isEmpty()) {
|
||||
const bool isDestructor = function->name()->isDestructorNameId();
|
||||
const bool isDestructor = function->name()->asDestructorNameId();
|
||||
for (const LookupItem &item : results) {
|
||||
if (Symbol *symbol = item.declaration()) {
|
||||
if (Function *functionType = symbol->type()->asFunctionType()) {
|
||||
if (functionType->name()->isDestructorNameId() != isDestructor)
|
||||
if ((functionType->name()->asDestructorNameId() != nullptr) != isDestructor)
|
||||
continue;
|
||||
if (functionType == function) // already tested
|
||||
continue;
|
||||
|
@@ -267,9 +267,9 @@ QString SearchSymbols::scopeName(const QString &name, const Symbol *symbol) cons
|
||||
if (!name.isEmpty())
|
||||
return name;
|
||||
|
||||
if (symbol->isNamespace()) {
|
||||
if (symbol->asNamespace()) {
|
||||
return QLatin1String("<anonymous namespace>");
|
||||
} else if (symbol->isEnum()) {
|
||||
} else if (symbol->asEnum()) {
|
||||
return QLatin1String("<anonymous enum>");
|
||||
} else if (const Class *c = symbol->asClass()) {
|
||||
if (c->isUnion())
|
||||
|
@@ -378,7 +378,7 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context,
|
||||
return;
|
||||
|
||||
Scope *enclosingScope = functionType->enclosingScope();
|
||||
while (!(enclosingScope->isNamespace() || enclosingScope->isClass()))
|
||||
while (!(enclosingScope->asNamespace() || enclosingScope->asClass()))
|
||||
enclosingScope = enclosingScope->enclosingScope();
|
||||
QTC_ASSERT(enclosingScope != nullptr, return);
|
||||
|
||||
@@ -451,9 +451,9 @@ QList<Declaration *> SymbolFinder::findMatchingDeclaration(const LookupContext &
|
||||
// For member functions not defined inline, add fuzzy matches as fallbacks. We cannot do
|
||||
// this for free functions, because there is no guarantee that there's a separate declaration.
|
||||
QList<Declaration *> fuzzyMatches = argumentCountMatch + nameMatch;
|
||||
if (!functionType->enclosingScope() || !functionType->enclosingScope()->isClass()) {
|
||||
if (!functionType->enclosingScope() || !functionType->enclosingScope()->asClass()) {
|
||||
for (Declaration * const d : fuzzyMatches) {
|
||||
if (d->enclosingScope() && d->enclosingScope()->isClass())
|
||||
if (d->enclosingScope() && d->enclosingScope()->asClass())
|
||||
result.append(d);
|
||||
}
|
||||
}
|
||||
|
@@ -159,7 +159,7 @@ LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, con
|
||||
Symbol *s = item.declaration();
|
||||
if (!s)
|
||||
continue;
|
||||
if (!s->isClass() && !s->isTemplate() && !s->isTypedef())
|
||||
if (!s->asClass() && !s->asTemplate() && !s->isTypedef())
|
||||
continue;
|
||||
if (!typedefs.insert(s).second)
|
||||
continue;
|
||||
|
@@ -70,15 +70,15 @@ static void debugCppSymbolRecursion(QTextStream &str, const Overview &o,
|
||||
for (int i = 0; i < recursion; i++)
|
||||
str << " ";
|
||||
str << "Symbol: " << o.prettyName(s.name()) << " at line " << s.line();
|
||||
if (s.isFunction())
|
||||
if (s.asFunction())
|
||||
str << " function";
|
||||
if (s.isClass())
|
||||
if (s.asClass())
|
||||
str << " class";
|
||||
if (s.isDeclaration())
|
||||
if (s.asDeclaration())
|
||||
str << " declaration";
|
||||
if (s.isBlock())
|
||||
if (s.asBlock())
|
||||
str << " block";
|
||||
if (doRecurse && s.isScope()) {
|
||||
if (doRecurse && s.asScope()) {
|
||||
const Scope *scoped = s.asScope();
|
||||
const int size = scoped->memberCount();
|
||||
str << " scoped symbol of " << size << '\n';
|
||||
@@ -106,17 +106,17 @@ QDebug operator<<(QDebug d, const Scope &scope)
|
||||
QTextStream str(&output);
|
||||
const int size = scope.memberCount();
|
||||
str << "Scope of " << size;
|
||||
if (scope.isNamespace())
|
||||
if (scope.asNamespace())
|
||||
str << " namespace";
|
||||
if (scope.isClass())
|
||||
if (scope.asClass())
|
||||
str << " class";
|
||||
if (scope.isEnum())
|
||||
if (scope.asEnum())
|
||||
str << " enum";
|
||||
if (scope.isBlock())
|
||||
if (scope.asBlock())
|
||||
str << " block";
|
||||
if (scope.isFunction())
|
||||
if (scope.asFunction())
|
||||
str << " function";
|
||||
if (scope.isDeclaration())
|
||||
if (scope.asDeclaration())
|
||||
str << " prototype";
|
||||
#if 0 // ### port me
|
||||
if (const Symbol *owner = &scope) {
|
||||
@@ -168,7 +168,7 @@ static void blockRecursion(const Overview &overview,
|
||||
// Fixme: loop variables or similar are currently seen in the outer scope
|
||||
for (int s = scope->memberCount() - 1; s >= 0; --s){
|
||||
const CPlusPlus::Symbol *symbol = scope->memberAt(s);
|
||||
if (symbol->isDeclaration()) {
|
||||
if (symbol->asDeclaration()) {
|
||||
// Find out about shadowed symbols by bookkeeping
|
||||
// the already seen occurrences in a hash.
|
||||
const QString name = overview.prettyName(symbol->name());
|
||||
@@ -210,7 +210,7 @@ QStringList getUninitializedVariables(const Snapshot &snapshot,
|
||||
// and the innermost scope at cursor position
|
||||
const Function *function = nullptr;
|
||||
const Scope *innerMostScope = nullptr;
|
||||
if (symbolAtLine->isFunction()) {
|
||||
if (symbolAtLine->asFunction()) {
|
||||
function = symbolAtLine->asFunction();
|
||||
if (function->memberCount() == 1) // Skip over function block
|
||||
if (Block *block = function->memberAt(0)->asBlock())
|
||||
@@ -218,7 +218,7 @@ QStringList getUninitializedVariables(const Snapshot &snapshot,
|
||||
} else {
|
||||
if (const Scope *functionScope = symbolAtLine->enclosingFunction()) {
|
||||
function = functionScope->asFunction();
|
||||
innerMostScope = symbolAtLine->isBlock() ?
|
||||
innerMostScope = symbolAtLine->asBlock() ?
|
||||
symbolAtLine->asBlock() :
|
||||
symbolAtLine->enclosingBlock();
|
||||
}
|
||||
@@ -380,7 +380,7 @@ static int firstRelevantLine(const Document::Ptr document, int line, int column)
|
||||
if (!scope)
|
||||
scope = symbol->enclosingScope();
|
||||
|
||||
while (scope && !scope->isFunction() )
|
||||
while (scope && !scope->asFunction() )
|
||||
scope = scope->enclosingScope();
|
||||
|
||||
if (!scope)
|
||||
|
@@ -106,7 +106,7 @@ protected:
|
||||
|
||||
void postVisit(Symbol *symbol)
|
||||
{
|
||||
if (symbol->isClass())
|
||||
if (symbol->asClass())
|
||||
m_currentClass.clear();
|
||||
}
|
||||
|
||||
|
@@ -76,7 +76,7 @@ void ClassViewController::appendClassDeclarationsFromSymbol(CPlusPlus::Symbol *s
|
||||
int line, int column,
|
||||
QSet<QString> *classNames)
|
||||
{
|
||||
if (symbol->isClass()
|
||||
if (symbol->asClass()
|
||||
&& (line <= 0 || (symbol->line() == line && symbol->column() == column + 1)))
|
||||
{
|
||||
CPlusPlus::Overview overview;
|
||||
@@ -87,7 +87,7 @@ void ClassViewController::appendClassDeclarationsFromSymbol(CPlusPlus::Symbol *s
|
||||
classNames->insert(className);
|
||||
}
|
||||
|
||||
if (symbol->isScope()) {
|
||||
if (symbol->asScope()) {
|
||||
CPlusPlus::Scope *scope = symbol->asScope();
|
||||
int total = scope->memberCount();
|
||||
for (int i = 0; i < total; ++i) {
|
||||
|
@@ -864,7 +864,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
|
||||
if (!symbol)
|
||||
return;
|
||||
|
||||
if (!symbol->isFunction())
|
||||
if (!symbol->asFunction())
|
||||
return;
|
||||
|
||||
CPlusPlus::Overview view;
|
||||
|
@@ -210,7 +210,7 @@ void tst_Semantic::function_declaration_1()
|
||||
QCOMPARE(funTy->argumentCount(), 0);
|
||||
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
||||
|
||||
QVERIFY(decl->name()->isNameId());
|
||||
QVERIFY(decl->name()->asNameId());
|
||||
const Identifier *funId = decl->name()->asNameId()->identifier();
|
||||
QVERIFY(funId);
|
||||
|
||||
@@ -261,7 +261,7 @@ void tst_Semantic::function_declaration_2()
|
||||
QCOMPARE(QByteArray(namedTypeId->chars(), namedTypeId->size()),
|
||||
QByteArray("QString"));
|
||||
|
||||
QVERIFY(decl->name()->isNameId());
|
||||
QVERIFY(decl->name()->asNameId());
|
||||
const Identifier *funId = decl->name()->asNameId()->identifier();
|
||||
QVERIFY(funId);
|
||||
|
||||
@@ -378,7 +378,7 @@ void tst_Semantic::function_definition_1()
|
||||
QCOMPARE(funTy->argumentCount(), 0);
|
||||
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
||||
|
||||
QVERIFY(funTy->name()->isNameId());
|
||||
QVERIFY(funTy->name()->asNameId());
|
||||
const Identifier *funId = funTy->name()->asNameId()->identifier();
|
||||
QVERIFY(funId);
|
||||
|
||||
|
Reference in New Issue
Block a user