2008-12-02 12:01:29 +01:00
|
|
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
|
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
|
//
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
|
//
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include "CPlusPlusForwardDeclarations.h"
|
|
|
|
|
#include "Symbol.h"
|
|
|
|
|
#include "Type.h"
|
|
|
|
|
#include "FullySpecifiedType.h"
|
2010-08-11 12:26:02 +02:00
|
|
|
#include "Scope.h"
|
2010-03-18 15:21:07 +01:00
|
|
|
#include <vector>
|
2009-10-20 11:21:25 +02:00
|
|
|
|
|
|
|
|
namespace CPlusPlus {
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-10-07 14:31:32 +02:00
|
|
|
class StringLiteral;
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT UsingNamespaceDirective final : public Symbol
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
UsingNamespaceDirective(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
UsingNamespaceDirective(Clone *clone, Subst *subst, UsingNamespaceDirective *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~UsingNamespaceDirective() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const UsingNamespaceDirective *asUsingNamespaceDirective() const override { return this; }
|
|
|
|
|
UsingNamespaceDirective *asUsingNamespaceDirective() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT UsingDeclaration final : public Symbol
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
UsingDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~UsingDeclaration() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const UsingDeclaration *asUsingDeclaration() const override { return this; }
|
|
|
|
|
UsingDeclaration *asUsingDeclaration() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT NamespaceAlias final : public Symbol
|
2010-05-05 10:18:11 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
NamespaceAlias(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~NamespaceAlias() override = default;
|
2010-05-05 10:18:11 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Name *namespaceName() const { return _namespaceName; }
|
|
|
|
|
void setNamespaceName(const Name *namespaceName) { _namespaceName = namespaceName; }
|
2010-05-05 10:18:11 +02:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2010-05-05 10:18:11 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const NamespaceAlias *asNamespaceAlias() const override { return this; }
|
|
|
|
|
NamespaceAlias *asNamespaceAlias() override { return this; }
|
2010-05-05 10:18:11 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2010-05-05 10:18:11 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const Name *_namespaceName;
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Declaration : public Symbol
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Declaration(Clone *clone, Subst *subst, Declaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Declaration() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
|
|
|
|
void setInitializer(StringLiteral const* initializer) { _initializer = initializer; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
|
|
|
|
const StringLiteral *getInitializer() const { return _initializer; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Declaration *asDeclaration() const override { return this; }
|
|
|
|
|
Declaration *asDeclaration() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
virtual EnumeratorDeclaration *asEnumeratorDeclarator() { return nullptr; }
|
|
|
|
|
virtual const EnumeratorDeclaration *asEnumeratorDeclarator() const { return nullptr; }
|
2011-05-09 13:52:03 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FullySpecifiedType _type;
|
2012-01-28 22:58:08 +04:00
|
|
|
const StringLiteral *_initializer;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT EnumeratorDeclaration final : public Declaration
|
2011-05-09 13:52:03 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2022-06-23 16:56:36 +02:00
|
|
|
~EnumeratorDeclaration() override = default;
|
2011-05-09 13:52:03 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const StringLiteral *constantValue() const { return _constantValue; }
|
|
|
|
|
void setConstantValue(const StringLiteral *constantValue) { _constantValue = constantValue; }
|
2011-05-09 13:52:03 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
EnumeratorDeclaration *asEnumeratorDeclarator() override { return this; }
|
|
|
|
|
const EnumeratorDeclaration *asEnumeratorDeclarator() const override { return this; }
|
2011-05-09 13:52:03 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const StringLiteral *_constantValue;
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Argument final : public Symbol
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Argument(Clone *clone, Subst *subst, Argument *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Argument() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool hasInitializer() const { return _initializer != nullptr; }
|
2009-12-08 11:34:22 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const StringLiteral *initializer() const { return _initializer; }
|
|
|
|
|
void setInitializer(const StringLiteral *initializer) { _initializer = initializer; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Argument *asArgument() const override { return this; }
|
|
|
|
|
Argument *asArgument() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-12-08 11:34:22 +01:00
|
|
|
const StringLiteral *_initializer;
|
2010-09-03 12:11:15 +02:00
|
|
|
FullySpecifiedType _type;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT TypenameArgument final : public Symbol
|
2009-12-08 11:58:27 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~TypenameArgument() = default;
|
2009-12-08 11:58:27 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
2016-07-31 23:53:01 +03:00
|
|
|
void setClassDeclarator(bool isClassDecl) { _isClassDeclarator = isClassDecl; }
|
|
|
|
|
bool isClassDeclarator() const { return _isClassDeclarator; }
|
2009-12-08 11:58:27 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
2009-12-08 11:58:27 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const TypenameArgument *asTypenameArgument() const override { return this; }
|
|
|
|
|
TypenameArgument *asTypenameArgument() override { return this; }
|
2009-12-08 11:58:27 +01:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2009-12-08 11:58:27 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FullySpecifiedType _type;
|
2016-07-31 23:53:01 +03:00
|
|
|
bool _isClassDeclarator;
|
2009-12-08 11:58:27 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Block final : public Scope
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Block(TranslationUnit *translationUnit, int sourceLocation);
|
2011-03-28 13:21:37 +02:00
|
|
|
Block(Clone *clone, Subst *subst, Block *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Block() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-24 16:37:14 +02:00
|
|
|
const Block *asBlock() const override { return this; }
|
|
|
|
|
Block *asBlock() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ForwardClassDeclaration final : public Symbol, public Type
|
2009-02-16 15:43:24 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ForwardClassDeclaration() override = default;
|
2009-02-16 15:43:24 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-02-16 15:43:24 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ForwardClassDeclaration *asForwardClassDeclaration() const override { return this; }
|
|
|
|
|
ForwardClassDeclaration *asForwardClassDeclaration() override { return this; }
|
2009-02-16 15:43:24 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ForwardClassDeclaration *asForwardClassDeclarationType() const override { return this; }
|
|
|
|
|
ForwardClassDeclaration *asForwardClassDeclarationType() override { return this; }
|
2009-02-16 15:43:24 +01:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-02-16 15:43:24 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Enum final : public Scope, public Type
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Enum(Clone *clone, Subst *subst, Enum *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Enum() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isScoped() const { return _isScoped; }
|
|
|
|
|
void setScoped(bool scoped) { _isScoped = scoped; }
|
2014-05-15 12:00:13 -04:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Enum *asEnum() const override { return this; }
|
|
|
|
|
Enum *asEnum() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const Enum *asEnumType() const override { return this; }
|
|
|
|
|
Enum *asEnumType() override { return this; }
|
2009-02-09 17:44:06 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2012-10-25 07:56:01 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool _isScoped;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Function final : public Scope, public Type
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum MethodKey {
|
|
|
|
|
NormalMethod,
|
|
|
|
|
SlotMethod,
|
2010-02-06 14:32:25 +01:00
|
|
|
SignalMethod,
|
|
|
|
|
InvokableMethod
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2014-11-13 22:18:53 +03:00
|
|
|
enum RefQualifier {
|
|
|
|
|
NoRefQualifier, // a function declared w/o & and && => *this may be lvalue or rvalue
|
|
|
|
|
LvalueRefQualifier, // a function declared with & => *this is lvalue
|
|
|
|
|
RvalueRefQualifier // a function declared with && => *this is rvalue
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Function(Clone *clone, Subst *subst, Function *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Function() override = default;
|
|
|
|
|
|
|
|
|
|
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; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
int methodKey() const { return f._methodKey; }
|
|
|
|
|
void setMethodKey(int key) { f._methodKey = key; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType returnType() const { return _returnType; }
|
|
|
|
|
void setReturnType(const FullySpecifiedType &returnType) { _returnType = returnType; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-03-26 16:43:38 +01:00
|
|
|
/** Convenience function that returns whether the function returns something (including void). */
|
|
|
|
|
bool hasReturnType() const;
|
|
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int argumentCount() const;
|
|
|
|
|
Symbol *argumentAt(int index) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-03-26 16:43:38 +01:00
|
|
|
/** Convenience function that returns whether the function receives any arguments. */
|
|
|
|
|
bool hasArguments() const;
|
2019-07-24 18:40:10 +02:00
|
|
|
int minimumArgumentCount() const;
|
2009-03-26 16:43:38 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVirtual() const { return f._isVirtual; }
|
|
|
|
|
void setVirtual(bool isVirtual) { f._isVirtual = isVirtual; }
|
2009-09-25 13:45:13 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isOverride() const { return f._isOverride; }
|
|
|
|
|
void setOverride(bool isOverride) { f._isOverride = isOverride; }
|
2012-06-25 23:49:17 +04:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isFinal() const { return f._isFinal; }
|
|
|
|
|
void setFinal(bool isFinal) { f._isFinal = isFinal; }
|
2012-06-25 23:49:17 +04:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVariadic() const { return f._isVariadic; }
|
|
|
|
|
void setVariadic(bool isVariadic) { f._isVariadic = isVariadic; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVariadicTemplate() const { return f._isVariadicTemplate; }
|
|
|
|
|
void setVariadicTemplate(bool isVariadicTemplate) { f._isVariadicTemplate = isVariadicTemplate; }
|
2020-05-14 23:07:05 +03:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isConst() const { return f._isConst; }
|
|
|
|
|
void setConst(bool isConst) { f._isConst = isConst; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-11-06 14:15:18 +01:00
|
|
|
bool isStatic() const { return f._isStatic; }
|
|
|
|
|
void setStatic(bool isStatic) { f._isStatic = isStatic; }
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVolatile() const { return f._isVolatile; }
|
|
|
|
|
void setVolatile(bool isVolatile) { f._isVolatile = isVolatile; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isPureVirtual() const { return f._isPureVirtual; }
|
|
|
|
|
void setPureVirtual(bool isPureVirtual) { f._isPureVirtual = isPureVirtual; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
RefQualifier refQualifier() const { return static_cast<RefQualifier>(f._refQualifier); }
|
|
|
|
|
void setRefQualifier(RefQualifier refQualifier) { f._refQualifier = refQualifier; }
|
2014-11-13 22:18:53 +03:00
|
|
|
|
2019-07-31 17:21:41 +02:00
|
|
|
bool isSignatureEqualTo(const Function *other, Matcher *matcher = nullptr) const;
|
2013-12-05 19:51:53 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isAmbiguous() const { return f._isAmbiguous; } // internal
|
|
|
|
|
void setAmbiguous(bool isAmbiguous) { f._isAmbiguous = isAmbiguous; } // internal
|
2014-05-15 12:00:13 -04:00
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
bool maybeValidPrototype(int actualArgumentCount) const;
|
2014-05-15 12:00:13 -04:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const StringLiteral *exceptionSpecification() { return _exceptionSpecification; }
|
|
|
|
|
void setExceptionSpecification(const StringLiteral *spec) { _exceptionSpecification = spec; }
|
2019-10-07 14:31:32 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Function *asFunction() const override { return this; }
|
|
|
|
|
Function *asFunction() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const Function *asFunctionType() const override { return this; }
|
|
|
|
|
Function *asFunctionType() override { return this; }
|
2009-02-09 17:44:06 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FullySpecifiedType _returnType;
|
2019-10-07 14:31:32 +02:00
|
|
|
const StringLiteral *_exceptionSpecification = nullptr;
|
2009-07-27 21:47:03 +02:00
|
|
|
struct Flags {
|
2009-09-25 13:45:13 +02:00
|
|
|
unsigned _isVirtual: 1;
|
2012-06-25 23:49:17 +04:00
|
|
|
unsigned _isOverride: 1;
|
|
|
|
|
unsigned _isFinal: 1;
|
2020-11-06 14:15:18 +01:00
|
|
|
unsigned _isStatic: 1;
|
2009-07-27 21:47:03 +02:00
|
|
|
unsigned _isVariadic: 1;
|
2020-05-14 23:07:05 +03:00
|
|
|
unsigned _isVariadicTemplate: 1;
|
2009-07-27 21:47:03 +02:00
|
|
|
unsigned _isPureVirtual: 1;
|
|
|
|
|
unsigned _isConst: 1;
|
|
|
|
|
unsigned _isVolatile: 1;
|
|
|
|
|
unsigned _isAmbiguous: 1;
|
|
|
|
|
unsigned _methodKey: 3;
|
2014-11-13 22:18:53 +03:00
|
|
|
unsigned _refQualifier: 2;
|
2009-07-27 21:47:03 +02:00
|
|
|
};
|
2008-12-02 12:01:29 +01:00
|
|
|
union {
|
|
|
|
|
unsigned _flags;
|
2009-07-27 21:47:03 +02:00
|
|
|
Flags f;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Template final : public Scope, public Type
|
2010-08-11 13:46:32 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Template(Clone *clone, Subst *subst, Template *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Template() override = default;
|
2010-08-11 13:46:32 +02:00
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int templateParameterCount() const;
|
2022-06-23 16:56:36 +02:00
|
|
|
Symbol *templateParameterAt(int index) const { return memberAt(index); }
|
2010-08-11 13:46:32 +02:00
|
|
|
Symbol *declaration() const;
|
|
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2010-08-11 13:46:32 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Template *asTemplate() const override { return this; }
|
|
|
|
|
Template *asTemplate() override { return this; }
|
2010-08-11 13:46:32 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const Template *asTemplateType() const override { return this; }
|
|
|
|
|
Template *asTemplateType() override { return this; }
|
2010-08-11 13:46:32 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2010-08-11 13:46:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Namespace final : public Scope, public Type
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Namespace(Clone *clone, Subst *subst, Namespace *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Namespace() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Namespace *asNamespace() const override { return this; }
|
|
|
|
|
Namespace *asNamespace() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const Namespace *asNamespaceType() const override { return this; }
|
|
|
|
|
Namespace *asNamespaceType() override { return this; }
|
2009-02-09 17:44:06 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isInline() const { return _isInline; }
|
|
|
|
|
void setInline(bool onoff) { _isInline = onoff; }
|
2012-02-02 10:19:58 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2012-02-02 10:19:58 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool _isInline;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT BaseClass final : public Symbol
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
BaseClass(Clone *clone, Subst *subst, BaseClass *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~BaseClass() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVirtual() const { return _isVirtual; }
|
|
|
|
|
void setVirtual(bool isVirtual) { _isVirtual = isVirtual; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVariadic() const { return _isVariadic; }
|
|
|
|
|
void setVariadic(bool isVariadic) { _isVariadic = isVariadic; }
|
2015-02-25 21:22:16 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
|
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const BaseClass *asBaseClass() const override { return this; }
|
|
|
|
|
BaseClass *asBaseClass() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2017-05-31 15:44:04 +02:00
|
|
|
bool _isVariadic = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
bool _isVirtual;
|
2010-01-06 11:23:41 +01:00
|
|
|
FullySpecifiedType _type;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT Class final : public Scope, public Type
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
Class(Clone *clone, Subst *subst, Class *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~Class() override = default;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
enum Key {
|
|
|
|
|
ClassKey,
|
|
|
|
|
StructKey,
|
|
|
|
|
UnionKey
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
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; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int baseClassCount() const;
|
|
|
|
|
BaseClass *baseClassAt(int index) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
void addBaseClass(BaseClass *baseClass);
|
2021-01-30 22:11:04 +01:00
|
|
|
const std::vector<BaseClass *> &baseClasses() const { return _baseClasses; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Class *asClass() const override { return this; }
|
|
|
|
|
Class *asClass() override { return this; }
|
2009-02-09 16:15:02 +01:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const Class *asClassType() const override { return this; }
|
|
|
|
|
Class *asClassType() override { return this; }
|
2009-02-09 17:44:06 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Key _key;
|
2010-03-18 15:21:07 +01:00
|
|
|
std::vector<BaseClass *> _baseClasses;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT QtPropertyDeclaration final : public Symbol
|
2010-12-06 12:16:45 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum Flag {
|
2010-12-06 13:10:09 +01:00
|
|
|
NoFlags = 0,
|
2010-12-06 12:16:45 +01:00
|
|
|
ReadFunction = 1 << 0,
|
|
|
|
|
WriteFunction = 1 << 1,
|
2013-10-08 13:42:39 +02:00
|
|
|
MemberVariable = 1 << 2,
|
|
|
|
|
ResetFunction = 1 << 3,
|
|
|
|
|
NotifyFunction = 1 << 4,
|
|
|
|
|
DesignableFlag = 1 << 5,
|
|
|
|
|
DesignableFunction = 1 << 6,
|
|
|
|
|
ScriptableFlag = 1 << 7,
|
|
|
|
|
ScriptableFunction = 1 << 8,
|
|
|
|
|
StoredFlag = 1 << 9,
|
|
|
|
|
StoredFunction = 1 << 10,
|
|
|
|
|
UserFlag = 1 << 11,
|
|
|
|
|
UserFunction = 1 << 12,
|
|
|
|
|
ConstantFlag = 1 << 13,
|
|
|
|
|
FinalFlag = 1 << 14
|
2010-12-06 12:16:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
QtPropertyDeclaration(Clone *clone, Subst *subst, QtPropertyDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~QtPropertyDeclaration() = default;
|
2010-12-06 12:16:45 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
|
|
|
|
void setFlags(int flags) { _flags = flags; }
|
|
|
|
|
int flags() const { return _flags; }
|
2010-12-06 12:16:45 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
2010-12-06 12:16:45 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const QtPropertyDeclaration *asQtPropertyDeclaration() const override { return this; }
|
|
|
|
|
QtPropertyDeclaration *asQtPropertyDeclaration() override { return this; }
|
2010-12-06 12:16:45 +01:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2010-12-06 12:16:45 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FullySpecifiedType _type;
|
|
|
|
|
int _flags;
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT QtEnum final : public Symbol
|
2010-12-06 13:10:09 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
QtEnum(Clone *clone, Subst *subst, QtEnum *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~QtEnum() override = default;
|
2010-12-06 13:10:09 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return FullySpecifiedType(); }
|
2010-12-06 13:10:09 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const QtEnum *asQtEnum() const override { return this; }
|
|
|
|
|
QtEnum *asQtEnum() override { return this; }
|
2010-12-06 13:10:09 +01:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2010-12-06 13:10:09 +01:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCBaseClass final : public Symbol
|
2009-10-05 18:02:01 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCBaseClass() override = default;
|
2009-10-05 18:02:01 +02:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-10-05 18:02:01 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCBaseClass *asObjCBaseClass() const override { return this; }
|
|
|
|
|
ObjCBaseClass *asObjCBaseClass() override { return this; }
|
2009-10-05 18:02:01 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2009-10-05 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCBaseProtocol final : public Symbol
|
2009-10-05 18:02:01 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCBaseProtocol() override = default;
|
2009-10-05 18:02:01 +02:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-10-05 18:02:01 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCBaseProtocol *asObjCBaseProtocol() const override { return this; }
|
|
|
|
|
ObjCBaseProtocol *asObjCBaseProtocol() override { return this; }
|
2009-10-05 18:02:01 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2009-10-05 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration final : public Symbol, public Type
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCForwardProtocolDeclaration() override = default;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const override { return this; }
|
|
|
|
|
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const override { return this; }
|
|
|
|
|
ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() override { return this; }
|
2009-09-28 11:46:00 +02:00
|
|
|
|
2009-07-28 16:34:15 +02:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCProtocol final : public Scope, public Type
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCProtocol() override = default;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int protocolCount() const;
|
|
|
|
|
ObjCBaseProtocol *protocolAt(int index) const;
|
2010-03-30 15:35:42 +02:00
|
|
|
void addProtocol(ObjCBaseProtocol *protocol);
|
2009-10-05 18:02:01 +02:00
|
|
|
|
2009-07-28 16:34:15 +02:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCProtocol *asObjCProtocol() const override { return this; }
|
|
|
|
|
ObjCProtocol *asObjCProtocol() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCProtocol *asObjCProtocolType() const override { return this; }
|
|
|
|
|
ObjCProtocol *asObjCProtocolType() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-03-18 15:21:07 +01:00
|
|
|
std::vector<ObjCBaseProtocol *> _protocols;
|
2009-07-28 16:34:15 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration final : public Symbol, public Type
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCForwardClassDeclaration() override = default;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const override { return this; }
|
|
|
|
|
ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const override { return this; }
|
|
|
|
|
ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() override { return this; }
|
2009-09-28 11:46:00 +02:00
|
|
|
|
2009-07-28 16:34:15 +02:00
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCClass final : public Scope, public Type
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCClass(Clone *clone, Subst *subst, ObjCClass *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCClass() override = default;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isInterface() const { return _isInterface; }
|
|
|
|
|
void setInterface(bool isInterface) { _isInterface = isInterface; }
|
2009-08-05 18:30:18 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isCategory() const { return _categoryName != nullptr; }
|
|
|
|
|
const Name *categoryName() const { return _categoryName; }
|
|
|
|
|
void setCategoryName(const Name *categoryName) { _categoryName = categoryName; }
|
2009-09-28 11:46:00 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
ObjCBaseClass *baseClass() const { return _baseClass; }
|
|
|
|
|
void setBaseClass(ObjCBaseClass *baseClass) { _baseClass = baseClass; }
|
2009-09-28 11:46:00 +02:00
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int protocolCount() const;
|
|
|
|
|
ObjCBaseProtocol *protocolAt(int index) const;
|
2010-03-30 15:35:42 +02:00
|
|
|
void addProtocol(ObjCBaseProtocol *protocol);
|
2009-09-28 11:46:00 +02:00
|
|
|
|
2009-07-28 16:34:15 +02:00
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCClass *asObjCClass() const override { return this; }
|
|
|
|
|
ObjCClass *asObjCClass() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCClass *asObjCClassType() const override { return this; }
|
|
|
|
|
ObjCClass *asObjCClassType() override { return this; }
|
2009-07-28 16:34:15 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-07-28 16:34:15 +02:00
|
|
|
|
|
|
|
|
private:
|
2009-12-01 12:46:15 +01:00
|
|
|
const Name *_categoryName;
|
2009-10-05 18:02:01 +02:00
|
|
|
ObjCBaseClass * _baseClass;
|
2010-03-18 15:21:07 +01:00
|
|
|
std::vector<ObjCBaseProtocol *> _protocols;
|
2010-09-03 12:11:15 +02:00
|
|
|
bool _isInterface;
|
2009-07-28 16:34:15 +02:00
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCMethod final : public Scope, public Type
|
2009-08-05 18:30:18 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2019-07-24 18:40:10 +02:00
|
|
|
ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCMethod() override = default;
|
2009-08-05 18:30:18 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType returnType() const { return _returnType; }
|
|
|
|
|
void setReturnType(const FullySpecifiedType &returnType) { _returnType = returnType; }
|
2009-08-05 18:30:18 +02:00
|
|
|
|
|
|
|
|
/** Convenience function that returns whether the function returns something (including void). */
|
|
|
|
|
bool hasReturnType() const;
|
|
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
int argumentCount() const;
|
|
|
|
|
Symbol *argumentAt(int index) const;
|
2009-08-05 18:30:18 +02:00
|
|
|
|
|
|
|
|
/** Convenience function that returns whether the function receives any arguments. */
|
|
|
|
|
bool hasArguments() const;
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool isVariadic() const { return f._isVariadic; }
|
|
|
|
|
void setVariadic(bool isVariadic) { f._isVariadic = isVariadic; }
|
2009-08-05 18:30:18 +02:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2020-11-23 16:44:16 +01:00
|
|
|
FullySpecifiedType type() const override;
|
2009-08-05 18:30:18 +02:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCMethod *asObjCMethod() const override { return this; }
|
|
|
|
|
ObjCMethod *asObjCMethod() override { return this; }
|
2009-08-05 18:30:18 +02:00
|
|
|
|
2014-05-15 12:00:13 -04:00
|
|
|
// Type's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCMethod *asObjCMethodType() const override { return this; }
|
|
|
|
|
ObjCMethod *asObjCMethodType() override { return this; }
|
2009-08-05 18:30:18 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
|
|
|
|
void accept0(TypeVisitor *visitor) override;
|
|
|
|
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
2009-08-05 18:30:18 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FullySpecifiedType _returnType;
|
|
|
|
|
struct Flags {
|
|
|
|
|
unsigned _isVariadic: 1;
|
|
|
|
|
};
|
|
|
|
|
union {
|
|
|
|
|
unsigned _flags;
|
|
|
|
|
Flags f;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
class CPLUSPLUS_EXPORT ObjCPropertyDeclaration final : public Symbol
|
2009-11-11 09:32:05 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum PropertyAttributes {
|
|
|
|
|
None = 0,
|
|
|
|
|
Assign = 1 << 0,
|
|
|
|
|
Retain = 1 << 1,
|
|
|
|
|
Copy = 1 << 2,
|
|
|
|
|
ReadOnly = 1 << 3,
|
|
|
|
|
ReadWrite = 1 << 4,
|
|
|
|
|
Getter = 1 << 5,
|
|
|
|
|
Setter = 1 << 6,
|
|
|
|
|
NonAtomic = 1 << 7,
|
|
|
|
|
|
|
|
|
|
WritabilityMask = ReadOnly | ReadWrite,
|
2010-02-25 12:39:39 +01:00
|
|
|
SetterSemanticsMask = Assign | Retain | Copy
|
2009-11-11 09:32:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ObjCPropertyDeclaration(TranslationUnit *translationUnit,
|
2019-07-24 18:40:10 +02:00
|
|
|
int sourceLocation,
|
2009-12-01 12:46:15 +01:00
|
|
|
const Name *name);
|
2011-03-28 13:21:37 +02:00
|
|
|
ObjCPropertyDeclaration(Clone *clone, Subst *subst, ObjCPropertyDeclaration *original);
|
2022-06-23 16:56:36 +02:00
|
|
|
~ObjCPropertyDeclaration() override = default;
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool hasAttribute(int attribute) const { return _propertyAttributes & attribute; }
|
|
|
|
|
void setAttributes(int attributes) { _propertyAttributes = attributes; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
bool hasGetter() const { return hasAttribute(Getter); }
|
|
|
|
|
bool hasSetter() const { return hasAttribute(Setter); }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Name *getterName() const { return _getterName; }
|
|
|
|
|
void setGetterName(const Name *getterName) { _getterName = getterName; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const Name *setterName() const { return _setterName; }
|
|
|
|
|
void setSetterName(const Name *setterName) { _setterName = setterName; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
void setType(const FullySpecifiedType &type) { _type = type; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
|
|
|
|
// Symbol's interface
|
2022-06-23 16:56:36 +02:00
|
|
|
FullySpecifiedType type() const override { return _type; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
2022-06-23 16:56:36 +02:00
|
|
|
const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const override { return this; }
|
|
|
|
|
ObjCPropertyDeclaration *asObjCPropertyDeclaration() override { return this; }
|
2009-11-11 09:32:05 +01:00
|
|
|
|
|
|
|
|
protected:
|
2020-11-23 16:44:16 +01:00
|
|
|
void visitSymbol0(SymbolVisitor *visitor) override;
|
2009-11-11 09:32:05 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-12-01 12:46:15 +01:00
|
|
|
const Name *_getterName;
|
|
|
|
|
const Name *_setterName;
|
2010-09-03 12:11:15 +02:00
|
|
|
FullySpecifiedType _type;
|
|
|
|
|
int _propertyAttributes;
|
2009-11-11 09:32:05 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-04 09:52:39 +01:00
|
|
|
} // namespace CPlusPlus
|