diff options
Diffstat (limited to 'src/libs/3rdparty/cplusplus/CoreTypes.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/CoreTypes.h | 165 |
1 files changed, 67 insertions, 98 deletions
diff --git a/src/libs/3rdparty/cplusplus/CoreTypes.h b/src/libs/3rdparty/cplusplus/CoreTypes.h index c0d799c4f2..7ccd861bb9 100644 --- a/src/libs/3rdparty/cplusplus/CoreTypes.h +++ b/src/libs/3rdparty/cplusplus/CoreTypes.h @@ -26,41 +26,31 @@ namespace CPlusPlus { -class CPLUSPLUS_EXPORT UndefinedType : public Type +class CPLUSPLUS_EXPORT UndefinedType final : public Type { public: - static UndefinedType *instance() - { - static UndefinedType t; - return &t; - } + static UndefinedType instance; - virtual const UndefinedType *asUndefinedType() const - { return this; } - - virtual UndefinedType *asUndefinedType() - { return this; } + const UndefinedType *asUndefinedType() const override { return this; } + UndefinedType *asUndefinedType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; }; -class CPLUSPLUS_EXPORT VoidType: public Type +class CPLUSPLUS_EXPORT VoidType final : public Type { public: - virtual const VoidType *asVoidType() const - { return this; } - - virtual VoidType *asVoidType() - { return this; } + const VoidType *asVoidType() const override { return this; } + VoidType *asVoidType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; }; -class CPLUSPLUS_EXPORT IntegerType: public Type +class CPLUSPLUS_EXPORT IntegerType final : public Type { public: enum Kind { @@ -76,26 +66,23 @@ public: }; public: - IntegerType(int kind); - virtual ~IntegerType(); - - int kind() const; + IntegerType(int kind) : _kind(kind) {} + ~IntegerType() override = default; - virtual IntegerType *asIntegerType() - { return this; } + int kind() const { return _kind; } - virtual const IntegerType *asIntegerType() const - { return this; } + IntegerType *asIntegerType() override { return this; } + const IntegerType *asIntegerType() const override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: int _kind; }; -class CPLUSPLUS_EXPORT FloatType: public Type +class CPLUSPLUS_EXPORT FloatType final : public Type { public: enum Kind { @@ -105,136 +92,118 @@ public: }; public: - FloatType(int kind); - virtual ~FloatType(); + FloatType(int kind) : _kind(kind) {} + ~FloatType() override = default; - int kind() const; + int kind() const { return _kind; } - virtual const FloatType *asFloatType() const - { return this; } - - virtual FloatType *asFloatType() - { return this; } + const FloatType *asFloatType() const override { return this; } + FloatType *asFloatType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: int _kind; }; -class CPLUSPLUS_EXPORT PointerType: public Type +class CPLUSPLUS_EXPORT PointerType final : public Type { public: - PointerType(const FullySpecifiedType &elementType); - virtual ~PointerType(); - - FullySpecifiedType elementType() const; + PointerType(const FullySpecifiedType &elementType) : _elementType(elementType) {} + ~PointerType() override = default; - virtual const PointerType *asPointerType() const - { return this; } + FullySpecifiedType elementType() const { return _elementType; } - virtual PointerType *asPointerType() - { return this; } + const PointerType *asPointerType() const override { return this; } + PointerType *asPointerType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: FullySpecifiedType _elementType; }; -class CPLUSPLUS_EXPORT PointerToMemberType: public Type +class CPLUSPLUS_EXPORT PointerToMemberType final : public Type { public: PointerToMemberType(const Name *memberName, const FullySpecifiedType &elementType); - virtual ~PointerToMemberType(); + ~PointerToMemberType() override = default; - const Name *memberName() const; - FullySpecifiedType elementType() const; + const Name *memberName() const { return _memberName; } + FullySpecifiedType elementType() const { return _elementType; } - virtual const PointerToMemberType *asPointerToMemberType() const - { return this; } - - virtual PointerToMemberType *asPointerToMemberType() - { return this; } + const PointerToMemberType *asPointerToMemberType() const override { return this; } + PointerToMemberType *asPointerToMemberType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: const Name *_memberName; FullySpecifiedType _elementType; }; -class CPLUSPLUS_EXPORT ReferenceType: public Type +class CPLUSPLUS_EXPORT ReferenceType final : public Type { public: ReferenceType(const FullySpecifiedType &elementType, bool rvalueRef); - virtual ~ReferenceType(); - - FullySpecifiedType elementType() const; - bool isRvalueReference() const; + ~ReferenceType() override = default; - virtual const ReferenceType *asReferenceType() const - { return this; } + FullySpecifiedType elementType() const { return _elementType; } + bool isRvalueReference() const { return _rvalueReference; } - virtual ReferenceType *asReferenceType() - { return this; } + const ReferenceType *asReferenceType() const override { return this; } + ReferenceType *asReferenceType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: FullySpecifiedType _elementType; bool _rvalueReference; }; -class CPLUSPLUS_EXPORT ArrayType: public Type +class CPLUSPLUS_EXPORT ArrayType final : public Type { public: ArrayType(const FullySpecifiedType &elementType, unsigned size); - virtual ~ArrayType(); + ~ArrayType() override = default; - FullySpecifiedType elementType() const; - unsigned size() const; + FullySpecifiedType elementType() const { return _elementType; } + unsigned size() const { return _size; } - virtual const ArrayType *asArrayType() const - { return this; } - - virtual ArrayType *asArrayType() - { return this; } + const ArrayType *asArrayType() const override { return this; } + ArrayType *asArrayType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: FullySpecifiedType _elementType; unsigned _size; }; -class CPLUSPLUS_EXPORT NamedType: public Type +class CPLUSPLUS_EXPORT NamedType final : public Type { public: - NamedType(const Name *name); - virtual ~NamedType(); - - const Name *name() const; + NamedType(const Name *name) : _name(name) {} + ~NamedType() override = default; - virtual const NamedType *asNamedType() const - { return this; } + const Name *name() const { return _name; } - virtual NamedType *asNamedType() - { return this; } + const NamedType *asNamedType() const override { return this; } + NamedType *asNamedType() override { return this; } protected: - virtual void accept0(TypeVisitor *visitor); - virtual bool match0(const Type *otherType, Matcher *matcher) const; + void accept0(TypeVisitor *visitor) override; + bool match0(const Type *otherType, Matcher *matcher) const override; private: const Name *_name; |