diff options
author | hjk <hjk@qt.io> | 2022-06-24 16:45:12 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-06-28 11:02:22 +0000 |
commit | e2bb204d4df47636549f2877c243e8c891cd71f3 (patch) | |
tree | 9554fa669890313b0c6ad0b2baa8ebcb41f475c7 /src/libs/3rdparty/cplusplus/CoreTypes.h | |
parent | 27d51e9804f795876129700863e94096f6bc7839 (diff) |
CPlusPlus: Inline more simple Type related functions
Change-Id: I2103e8047b385b438e58072e8a2689f1889d2724
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/CoreTypes.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/CoreTypes.h | 123 |
1 files changed, 48 insertions, 75 deletions
diff --git a/src/libs/3rdparty/cplusplus/CoreTypes.h b/src/libs/3rdparty/cplusplus/CoreTypes.h index 5f2c30e89c..7ccd861bb9 100644 --- a/src/libs/3rdparty/cplusplus/CoreTypes.h +++ b/src/libs/3rdparty/cplusplus/CoreTypes.h @@ -26,37 +26,31 @@ namespace CPlusPlus { -class CPLUSPLUS_EXPORT UndefinedType : public Type +class CPLUSPLUS_EXPORT UndefinedType final : public Type { public: static UndefinedType instance; - const UndefinedType *asUndefinedType() const override - { return this; } - - UndefinedType *asUndefinedType() override - { return this; } + const UndefinedType *asUndefinedType() const override { return this; } + UndefinedType *asUndefinedType() override { return this; } protected: 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: - const VoidType *asVoidType() const override - { return this; } - - VoidType *asVoidType() override - { return this; } + const VoidType *asVoidType() const override { return this; } + VoidType *asVoidType() override { return this; } protected: 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 { @@ -72,16 +66,13 @@ public: }; public: - IntegerType(int kind); - virtual ~IntegerType(); - - int kind() const; + IntegerType(int kind) : _kind(kind) {} + ~IntegerType() override = default; - IntegerType *asIntegerType() override - { return this; } + int kind() const { return _kind; } - const IntegerType *asIntegerType() const override - { return this; } + IntegerType *asIntegerType() override { return this; } + const IntegerType *asIntegerType() const override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -91,7 +82,7 @@ private: int _kind; }; -class CPLUSPLUS_EXPORT FloatType: public Type +class CPLUSPLUS_EXPORT FloatType final : public Type { public: enum Kind { @@ -101,16 +92,13 @@ public: }; public: - FloatType(int kind); - virtual ~FloatType(); + FloatType(int kind) : _kind(kind) {} + ~FloatType() override = default; - int kind() const; + int kind() const { return _kind; } - const FloatType *asFloatType() const override - { return this; } - - FloatType *asFloatType() override - { return this; } + const FloatType *asFloatType() const override { return this; } + FloatType *asFloatType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -120,19 +108,16 @@ 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; - const PointerType *asPointerType() const override - { return this; } + FullySpecifiedType elementType() const { return _elementType; } - PointerType *asPointerType() override - { return this; } + const PointerType *asPointerType() const override { return this; } + PointerType *asPointerType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -142,20 +127,17 @@ 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; } - const PointerToMemberType *asPointerToMemberType() const override - { return this; } - - PointerToMemberType *asPointerToMemberType() override - { return this; } + const PointerToMemberType *asPointerToMemberType() const override { return this; } + PointerToMemberType *asPointerToMemberType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -166,20 +148,17 @@ private: 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; - const ReferenceType *asReferenceType() const override - { return this; } + FullySpecifiedType elementType() const { return _elementType; } + bool isRvalueReference() const { return _rvalueReference; } - ReferenceType *asReferenceType() override - { return this; } + const ReferenceType *asReferenceType() const override { return this; } + ReferenceType *asReferenceType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -190,20 +169,17 @@ private: 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; } - const ArrayType *asArrayType() const override - { return this; } - - ArrayType *asArrayType() override - { return this; } + const ArrayType *asArrayType() const override { return this; } + ArrayType *asArrayType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; @@ -214,19 +190,16 @@ private: 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; - const NamedType *asNamedType() const override - { return this; } + const Name *name() const { return _name; } - NamedType *asNamedType() override - { return this; } + const NamedType *asNamedType() const override { return this; } + NamedType *asNamedType() override { return this; } protected: void accept0(TypeVisitor *visitor) override; |