forked from qt-creator/qt-creator
CPlusPlus: Inline more simple Type related functions
Change-Id: I2103e8047b385b438e58072e8a2689f1889d2724 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
6
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
6
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -371,7 +371,7 @@ FullySpecifiedType Bind::declarator(DeclaratorAST *ast, const FullySpecifiedType
|
|||||||
if (type.isAuto())
|
if (type.isAuto())
|
||||||
isAuto = true;
|
isAuto = true;
|
||||||
}
|
}
|
||||||
if (!type->isFunctionType()) {
|
if (!type->asFunctionType()) {
|
||||||
ExpressionTy initializer = this->expression(ast->initializer);
|
ExpressionTy initializer = this->expression(ast->initializer);
|
||||||
if (cxx11Enabled && isAuto) {
|
if (cxx11Enabled && isAuto) {
|
||||||
type = initializer;
|
type = initializer;
|
||||||
@@ -3249,7 +3249,7 @@ bool Bind::visit(PointerToMemberAST *ast)
|
|||||||
|
|
||||||
bool Bind::visit(PointerAST *ast)
|
bool Bind::visit(PointerAST *ast)
|
||||||
{
|
{
|
||||||
if (_type->isReferenceType())
|
if (_type->asReferenceType())
|
||||||
translationUnit()->error(ast->firstToken(), "cannot declare pointer to a reference");
|
translationUnit()->error(ast->firstToken(), "cannot declare pointer to a reference");
|
||||||
|
|
||||||
FullySpecifiedType type(control()->pointerType(_type));
|
FullySpecifiedType type(control()->pointerType(_type));
|
||||||
@@ -3264,7 +3264,7 @@ bool Bind::visit(ReferenceAST *ast)
|
|||||||
{
|
{
|
||||||
const bool rvalueRef = (tokenKind(ast->reference_token) == T_AMPER_AMPER);
|
const bool rvalueRef = (tokenKind(ast->reference_token) == T_AMPER_AMPER);
|
||||||
|
|
||||||
if (_type->isReferenceType())
|
if (_type->asReferenceType())
|
||||||
translationUnit()->error(ast->firstToken(), "cannot declare reference to a reference");
|
translationUnit()->error(ast->firstToken(), "cannot declare reference to a reference");
|
||||||
|
|
||||||
FullySpecifiedType type(control()->referenceType(_type, rvalueRef));
|
FullySpecifiedType type(control()->referenceType(_type, rvalueRef));
|
||||||
|
60
src/libs/3rdparty/cplusplus/CoreTypes.cpp
vendored
60
src/libs/3rdparty/cplusplus/CoreTypes.cpp
vendored
@@ -21,6 +21,7 @@
|
|||||||
#include "CoreTypes.h"
|
#include "CoreTypes.h"
|
||||||
#include "TypeVisitor.h"
|
#include "TypeVisitor.h"
|
||||||
#include "Matcher.h"
|
#include "Matcher.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
@@ -54,14 +55,6 @@ PointerToMemberType::PointerToMemberType(const Name *memberName, const FullySpec
|
|||||||
_elementType(elementType)
|
_elementType(elementType)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
PointerToMemberType::~PointerToMemberType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
const Name *PointerToMemberType::memberName() const
|
|
||||||
{ return _memberName; }
|
|
||||||
|
|
||||||
FullySpecifiedType PointerToMemberType::elementType() const
|
|
||||||
{ return _elementType; }
|
|
||||||
|
|
||||||
void PointerToMemberType::accept0(TypeVisitor *visitor)
|
void PointerToMemberType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
@@ -74,12 +67,6 @@ bool PointerToMemberType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerType::PointerType(const FullySpecifiedType &elementType)
|
|
||||||
: _elementType(elementType)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
PointerType::~PointerType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void PointerType::accept0(TypeVisitor *visitor)
|
void PointerType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
@@ -92,16 +79,11 @@ bool PointerType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullySpecifiedType PointerType::elementType() const
|
|
||||||
{ return _elementType; }
|
|
||||||
|
|
||||||
ReferenceType::ReferenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
ReferenceType::ReferenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
||||||
: _elementType(elementType), _rvalueReference(rvalueRef)
|
: _elementType(elementType), _rvalueReference(rvalueRef)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ReferenceType::~ReferenceType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void ReferenceType::accept0(TypeVisitor *visitor)
|
void ReferenceType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -113,19 +95,6 @@ bool ReferenceType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullySpecifiedType ReferenceType::elementType() const
|
|
||||||
{ return _elementType; }
|
|
||||||
|
|
||||||
bool ReferenceType::isRvalueReference() const
|
|
||||||
{ return _rvalueReference; }
|
|
||||||
|
|
||||||
IntegerType::IntegerType(int kind)
|
|
||||||
: _kind(kind)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
IntegerType::~IntegerType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void IntegerType::accept0(TypeVisitor *visitor)
|
void IntegerType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -137,15 +106,6 @@ bool IntegerType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IntegerType::kind() const
|
|
||||||
{ return _kind; }
|
|
||||||
|
|
||||||
FloatType::FloatType(int kind)
|
|
||||||
: _kind(kind)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
FloatType::~FloatType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void FloatType::accept0(TypeVisitor *visitor)
|
void FloatType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
@@ -158,16 +118,11 @@ bool FloatType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FloatType::kind() const
|
|
||||||
{ return _kind; }
|
|
||||||
|
|
||||||
ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size)
|
ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size)
|
||||||
: _elementType(elementType), _size(size)
|
: _elementType(elementType), _size(size)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ArrayType::~ArrayType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void ArrayType::accept0(TypeVisitor *visitor)
|
void ArrayType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -179,21 +134,8 @@ bool ArrayType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullySpecifiedType ArrayType::elementType() const
|
|
||||||
{ return _elementType; }
|
|
||||||
|
|
||||||
unsigned ArrayType::size() const
|
|
||||||
{ return _size; }
|
|
||||||
|
|
||||||
NamedType::NamedType(const Name *name)
|
|
||||||
: _name(name)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
NamedType::~NamedType()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
const Name *NamedType::name() const
|
|
||||||
{ return _name; }
|
|
||||||
|
|
||||||
void NamedType::accept0(TypeVisitor *visitor)
|
void NamedType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
123
src/libs/3rdparty/cplusplus/CoreTypes.h
vendored
123
src/libs/3rdparty/cplusplus/CoreTypes.h
vendored
@@ -26,37 +26,31 @@
|
|||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT UndefinedType : public Type
|
class CPLUSPLUS_EXPORT UndefinedType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static UndefinedType instance;
|
static UndefinedType instance;
|
||||||
|
|
||||||
const UndefinedType *asUndefinedType() const override
|
const UndefinedType *asUndefinedType() const override { return this; }
|
||||||
{ return this; }
|
UndefinedType *asUndefinedType() override { return this; }
|
||||||
|
|
||||||
UndefinedType *asUndefinedType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
bool match0(const Type *otherType, Matcher *matcher) const override;
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT VoidType: public Type
|
class CPLUSPLUS_EXPORT VoidType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const VoidType *asVoidType() const override
|
const VoidType *asVoidType() const override { return this; }
|
||||||
{ return this; }
|
VoidType *asVoidType() override { return this; }
|
||||||
|
|
||||||
VoidType *asVoidType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
bool match0(const Type *otherType, Matcher *matcher) const override;
|
bool match0(const Type *otherType, Matcher *matcher) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT IntegerType: public Type
|
class CPLUSPLUS_EXPORT IntegerType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Kind {
|
enum Kind {
|
||||||
@@ -72,16 +66,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IntegerType(int kind);
|
IntegerType(int kind) : _kind(kind) {}
|
||||||
virtual ~IntegerType();
|
~IntegerType() override = default;
|
||||||
|
|
||||||
int kind() const;
|
int kind() const { return _kind; }
|
||||||
|
|
||||||
IntegerType *asIntegerType() override
|
IntegerType *asIntegerType() override { return this; }
|
||||||
{ return this; }
|
const IntegerType *asIntegerType() const override { return this; }
|
||||||
|
|
||||||
const IntegerType *asIntegerType() const override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -91,7 +82,7 @@ private:
|
|||||||
int _kind;
|
int _kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT FloatType: public Type
|
class CPLUSPLUS_EXPORT FloatType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Kind {
|
enum Kind {
|
||||||
@@ -101,16 +92,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FloatType(int kind);
|
FloatType(int kind) : _kind(kind) {}
|
||||||
virtual ~FloatType();
|
~FloatType() override = default;
|
||||||
|
|
||||||
int kind() const;
|
int kind() const { return _kind; }
|
||||||
|
|
||||||
const FloatType *asFloatType() const override
|
const FloatType *asFloatType() const override { return this; }
|
||||||
{ return this; }
|
FloatType *asFloatType() override { return this; }
|
||||||
|
|
||||||
FloatType *asFloatType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -120,19 +108,16 @@ private:
|
|||||||
int _kind;
|
int _kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT PointerType: public Type
|
class CPLUSPLUS_EXPORT PointerType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointerType(const FullySpecifiedType &elementType);
|
PointerType(const FullySpecifiedType &elementType) : _elementType(elementType) {}
|
||||||
virtual ~PointerType();
|
~PointerType() override = default;
|
||||||
|
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const { return _elementType; }
|
||||||
|
|
||||||
const PointerType *asPointerType() const override
|
const PointerType *asPointerType() const override { return this; }
|
||||||
{ return this; }
|
PointerType *asPointerType() override { return this; }
|
||||||
|
|
||||||
PointerType *asPointerType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -142,20 +127,17 @@ private:
|
|||||||
FullySpecifiedType _elementType;
|
FullySpecifiedType _elementType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT PointerToMemberType: public Type
|
class CPLUSPLUS_EXPORT PointerToMemberType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointerToMemberType(const Name *memberName, const FullySpecifiedType &elementType);
|
PointerToMemberType(const Name *memberName, const FullySpecifiedType &elementType);
|
||||||
virtual ~PointerToMemberType();
|
~PointerToMemberType() override = default;
|
||||||
|
|
||||||
const Name *memberName() const;
|
const Name *memberName() const { return _memberName; }
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const { return _elementType; }
|
||||||
|
|
||||||
const PointerToMemberType *asPointerToMemberType() const override
|
const PointerToMemberType *asPointerToMemberType() const override { return this; }
|
||||||
{ return this; }
|
PointerToMemberType *asPointerToMemberType() override { return this; }
|
||||||
|
|
||||||
PointerToMemberType *asPointerToMemberType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -166,20 +148,17 @@ private:
|
|||||||
FullySpecifiedType _elementType;
|
FullySpecifiedType _elementType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT ReferenceType: public Type
|
class CPLUSPLUS_EXPORT ReferenceType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReferenceType(const FullySpecifiedType &elementType, bool rvalueRef);
|
ReferenceType(const FullySpecifiedType &elementType, bool rvalueRef);
|
||||||
virtual ~ReferenceType();
|
~ReferenceType() override = default;
|
||||||
|
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const { return _elementType; }
|
||||||
bool isRvalueReference() const;
|
bool isRvalueReference() const { return _rvalueReference; }
|
||||||
|
|
||||||
const ReferenceType *asReferenceType() const override
|
const ReferenceType *asReferenceType() const override { return this; }
|
||||||
{ return this; }
|
ReferenceType *asReferenceType() override { return this; }
|
||||||
|
|
||||||
ReferenceType *asReferenceType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -190,20 +169,17 @@ private:
|
|||||||
bool _rvalueReference;
|
bool _rvalueReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT ArrayType: public Type
|
class CPLUSPLUS_EXPORT ArrayType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArrayType(const FullySpecifiedType &elementType, unsigned size);
|
ArrayType(const FullySpecifiedType &elementType, unsigned size);
|
||||||
virtual ~ArrayType();
|
~ArrayType() override = default;
|
||||||
|
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const { return _elementType; }
|
||||||
unsigned size() const;
|
unsigned size() const { return _size; }
|
||||||
|
|
||||||
const ArrayType *asArrayType() const override
|
const ArrayType *asArrayType() const override { return this; }
|
||||||
{ return this; }
|
ArrayType *asArrayType() override { return this; }
|
||||||
|
|
||||||
ArrayType *asArrayType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
@@ -214,19 +190,16 @@ private:
|
|||||||
unsigned _size;
|
unsigned _size;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT NamedType: public Type
|
class CPLUSPLUS_EXPORT NamedType final : public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NamedType(const Name *name);
|
NamedType(const Name *name) : _name(name) {}
|
||||||
virtual ~NamedType();
|
~NamedType() override = default;
|
||||||
|
|
||||||
const Name *name() const;
|
const Name *name() const { return _name; }
|
||||||
|
|
||||||
const NamedType *asNamedType() const override
|
const NamedType *asNamedType() const override { return this; }
|
||||||
{ return this; }
|
NamedType *asNamedType() override { return this; }
|
||||||
|
|
||||||
NamedType *asNamedType() override
|
|
||||||
{ return this; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept0(TypeVisitor *visitor) override;
|
void accept0(TypeVisitor *visitor) override;
|
||||||
|
123
src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp
vendored
123
src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp
vendored
@@ -62,135 +62,12 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const
|
|||||||
return ty;
|
return ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FullySpecifiedType::isConst() const
|
|
||||||
{ return f._isConst; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setConst(bool isConst)
|
|
||||||
{ f._isConst = isConst; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isVolatile() const
|
|
||||||
{ return f._isVolatile; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setVolatile(bool isVolatile)
|
|
||||||
{ f._isVolatile = isVolatile; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isSigned() const
|
|
||||||
{ return f._isSigned; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setSigned(bool isSigned)
|
|
||||||
{ f._isSigned = isSigned; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isUnsigned() const
|
|
||||||
{ return f._isUnsigned; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setUnsigned(bool isUnsigned)
|
|
||||||
{ f._isUnsigned = isUnsigned; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isFriend() const
|
|
||||||
{ return f._isFriend; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setFriend(bool isFriend)
|
|
||||||
{ f._isFriend = isFriend; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isAuto() const
|
|
||||||
{ return f._isAuto; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setAuto(bool isAuto)
|
|
||||||
{ f._isAuto = isAuto; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isRegister() const
|
|
||||||
{ return f._isRegister; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setRegister(bool isRegister)
|
|
||||||
{ f._isRegister = isRegister; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isStatic() const
|
|
||||||
{ return f._isStatic; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setStatic(bool isStatic)
|
|
||||||
{ f._isStatic = isStatic; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isExtern() const
|
|
||||||
{ return f._isExtern; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setExtern(bool isExtern)
|
|
||||||
{ f._isExtern = isExtern; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isMutable() const
|
|
||||||
{ return f._isMutable; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setMutable(bool isMutable)
|
|
||||||
{ f._isMutable = isMutable; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isTypedef() const
|
|
||||||
{ return f._isTypedef; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setTypedef(bool isTypedef)
|
|
||||||
{ f._isTypedef = isTypedef; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isInline() const
|
|
||||||
{ return f._isInline; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setInline(bool isInline)
|
|
||||||
{ f._isInline = isInline; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isVirtual() const
|
|
||||||
{ return f._isVirtual; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setVirtual(bool isVirtual)
|
|
||||||
{ f._isVirtual = isVirtual; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isOverride() const
|
|
||||||
{ return f._isOverride; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setOverride(bool isOverride)
|
|
||||||
{ f._isOverride = isOverride; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isFinal() const
|
|
||||||
{ return f._isFinal; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setFinal(bool isFinal)
|
|
||||||
{ f._isFinal = isFinal; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isExplicit() const
|
|
||||||
{ return f._isExplicit; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setExplicit(bool isExplicit)
|
|
||||||
{ f._isExplicit = isExplicit; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isDeprecated() const
|
|
||||||
{ return f._isDeprecated; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setDeprecated(bool isDeprecated)
|
|
||||||
{ f._isDeprecated = isDeprecated; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::isUnavailable() const
|
|
||||||
{ return f._isUnavailable; }
|
|
||||||
|
|
||||||
void FullySpecifiedType::setUnavailable(bool isUnavailable)
|
|
||||||
{ f._isUnavailable = isUnavailable; }
|
|
||||||
|
|
||||||
Type &FullySpecifiedType::operator*()
|
|
||||||
{ return *_type; }
|
|
||||||
|
|
||||||
FullySpecifiedType::operator bool() const
|
FullySpecifiedType::operator bool() const
|
||||||
{ return _type != &UndefinedType::instance; }
|
{ return _type != &UndefinedType::instance; }
|
||||||
|
|
||||||
const Type &FullySpecifiedType::operator*() const
|
|
||||||
{ return *_type; }
|
|
||||||
|
|
||||||
Type *FullySpecifiedType::operator->()
|
|
||||||
{ return _type; }
|
|
||||||
|
|
||||||
const Type *FullySpecifiedType::operator->() const
|
|
||||||
{ return _type; }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::operator == (const FullySpecifiedType &other) const
|
bool FullySpecifiedType::operator == (const FullySpecifiedType &other) const
|
||||||
{ return _type == other._type && _flags == other._flags; }
|
{ return _type == other._type && _flags == other._flags; }
|
||||||
|
|
||||||
bool FullySpecifiedType::operator != (const FullySpecifiedType &other) const
|
|
||||||
{ return ! operator ==(other); }
|
|
||||||
|
|
||||||
bool FullySpecifiedType::operator < (const FullySpecifiedType &other) const
|
bool FullySpecifiedType::operator < (const FullySpecifiedType &other) const
|
||||||
{
|
{
|
||||||
if (_type == other._type)
|
if (_type == other._type)
|
||||||
|
82
src/libs/3rdparty/cplusplus/FullySpecifiedType.h
vendored
82
src/libs/3rdparty/cplusplus/FullySpecifiedType.h
vendored
@@ -40,68 +40,68 @@ public:
|
|||||||
|
|
||||||
FullySpecifiedType qualifiedType() const;
|
FullySpecifiedType qualifiedType() const;
|
||||||
|
|
||||||
bool isConst() const;
|
bool isConst() const { return f._isConst; }
|
||||||
void setConst(bool isConst);
|
void setConst(bool isConst) { f._isConst = isConst; }
|
||||||
|
|
||||||
bool isVolatile() const;
|
bool isVolatile() const { return f._isVolatile; }
|
||||||
void setVolatile(bool isVolatile);
|
void setVolatile(bool isVolatile) { f._isVolatile = isVolatile; }
|
||||||
|
|
||||||
bool isSigned() const;
|
bool isSigned() const { return f._isSigned; }
|
||||||
void setSigned(bool isSigned);
|
void setSigned(bool isSigned) { f._isSigned = isSigned; }
|
||||||
|
|
||||||
bool isUnsigned() const;
|
bool isUnsigned() const { return f._isUnsigned; }
|
||||||
void setUnsigned(bool isUnsigned);
|
void setUnsigned(bool isUnsigned) { f._isUnsigned = isUnsigned; }
|
||||||
|
|
||||||
bool isFriend() const;
|
bool isFriend() const { return f._isFriend; }
|
||||||
void setFriend(bool isFriend);
|
void setFriend(bool isFriend) { f._isFriend = isFriend; }
|
||||||
|
|
||||||
bool isAuto() const;
|
bool isAuto() const { return f._isAuto; }
|
||||||
void setAuto(bool isAuto);
|
void setAuto(bool isAuto) { f._isAuto = isAuto; }
|
||||||
|
|
||||||
bool isRegister() const;
|
bool isRegister() const { return f._isRegister; }
|
||||||
void setRegister(bool isRegister);
|
void setRegister(bool isRegister) { f._isRegister = isRegister; }
|
||||||
|
|
||||||
bool isStatic() const;
|
bool isStatic() const { return f._isStatic; }
|
||||||
void setStatic(bool isStatic);
|
void setStatic(bool isStatic) { f._isStatic = isStatic; }
|
||||||
|
|
||||||
bool isExtern() const;
|
bool isExtern() const { return f._isExtern; }
|
||||||
void setExtern(bool isExtern);
|
void setExtern(bool isExtern) { f._isExtern = isExtern; }
|
||||||
|
|
||||||
bool isMutable() const;
|
bool isMutable() const { return f._isMutable; }
|
||||||
void setMutable(bool isMutable);
|
void setMutable(bool isMutable) { f._isMutable = isMutable; }
|
||||||
|
|
||||||
bool isTypedef() const;
|
bool isTypedef() const { return f._isTypedef; }
|
||||||
void setTypedef(bool isTypedef);
|
void setTypedef(bool isTypedef) { f._isTypedef = isTypedef; }
|
||||||
|
|
||||||
bool isInline() const;
|
bool isInline() const { return f._isInline; }
|
||||||
void setInline(bool isInline);
|
void setInline(bool isInline) { f._isInline = isInline; }
|
||||||
|
|
||||||
bool isVirtual() const;
|
bool isVirtual() const { return f._isVirtual; }
|
||||||
void setVirtual(bool isVirtual);
|
void setVirtual(bool isVirtual) { f._isVirtual = isVirtual; }
|
||||||
|
|
||||||
bool isOverride() const;
|
bool isOverride() const { return f._isOverride; }
|
||||||
void setOverride(bool isOverride);
|
void setOverride(bool isOverride) { f._isOverride = isOverride; }
|
||||||
|
|
||||||
bool isFinal() const;
|
bool isFinal() const { return f._isFinal; }
|
||||||
void setFinal(bool isFinal);
|
void setFinal(bool isFinal) { f._isFinal = isFinal; }
|
||||||
|
|
||||||
bool isExplicit() const;
|
bool isExplicit() const { return f._isExplicit; }
|
||||||
void setExplicit(bool isExplicit);
|
void setExplicit(bool isExplicit) { f._isExplicit = isExplicit; }
|
||||||
|
|
||||||
bool isDeprecated() const;
|
bool isDeprecated() const { return f._isDeprecated; }
|
||||||
void setDeprecated(bool isDeprecated);
|
void setDeprecated(bool isDeprecated) { f._isDeprecated = isDeprecated; }
|
||||||
|
|
||||||
bool isUnavailable() const;
|
bool isUnavailable() const { return f._isUnavailable; }
|
||||||
void setUnavailable(bool isUnavailable);
|
void setUnavailable(bool isUnavailable) { f._isUnavailable = isUnavailable; }
|
||||||
|
|
||||||
Type &operator*();
|
Type &operator*() { return *_type; }
|
||||||
const Type &operator*() const;
|
const Type &operator*() const { return *_type; }
|
||||||
|
|
||||||
Type *operator->();
|
Type *operator->() { return _type; }
|
||||||
const Type *operator->() const;
|
const Type *operator->() const { return _type; }
|
||||||
|
|
||||||
bool operator == (const FullySpecifiedType &other) const;
|
bool operator == (const FullySpecifiedType &other) const;
|
||||||
bool operator != (const FullySpecifiedType &other) const;
|
bool operator != (const FullySpecifiedType &other) const { return ! operator ==(other); }
|
||||||
bool operator < (const FullySpecifiedType &other) const;
|
bool operator < (const FullySpecifiedType &other) const;
|
||||||
|
|
||||||
size_t hash() const;
|
size_t hash() const;
|
||||||
|
14
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
14
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
@@ -283,10 +283,10 @@ bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
|
|||||||
Symbol *l = argumentAt(i);
|
Symbol *l = argumentAt(i);
|
||||||
Symbol *r = other->argumentAt(i);
|
Symbol *r = other->argumentAt(i);
|
||||||
if (! l->type().match(r->type(), matcher)) {
|
if (! l->type().match(r->type(), matcher)) {
|
||||||
if (!l->type()->isReferenceType() && !l->type()->isPointerType()
|
if (!l->type()->asReferenceType() && !l->type()->asPointerType()
|
||||||
&& !l->type()->isPointerToMemberType()
|
&& !l->type()->asPointerToMemberType()
|
||||||
&& !r->type()->isReferenceType() && !r->type()->isPointerType()
|
&& !r->type()->asReferenceType() && !r->type()->asPointerType()
|
||||||
&& !r->type()->isPointerToMemberType()) {
|
&& !r->type()->asPointerToMemberType()) {
|
||||||
FullySpecifiedType lType = l->type();
|
FullySpecifiedType lType = l->type();
|
||||||
FullySpecifiedType rType = r->type();
|
FullySpecifiedType rType = r->type();
|
||||||
lType.setConst(false);
|
lType.setConst(false);
|
||||||
@@ -333,7 +333,7 @@ bool Function::hasReturnType() const
|
|||||||
int Function::argumentCount() const
|
int Function::argumentCount() const
|
||||||
{
|
{
|
||||||
const int memCnt = memberCount();
|
const int memCnt = memberCount();
|
||||||
if (memCnt > 0 && memberAt(0)->type()->isVoidType())
|
if (memCnt > 0 && memberAt(0)->type()->asVoidType())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Definitions with function-try-blocks will have more than a block, and
|
// Definitions with function-try-blocks will have more than a block, and
|
||||||
@@ -362,7 +362,7 @@ Symbol *Function::argumentAt(int index) const
|
|||||||
bool Function::hasArguments() const
|
bool Function::hasArguments() const
|
||||||
{
|
{
|
||||||
int argc = argumentCount();
|
int argc = argumentCount();
|
||||||
return ! (argc == 0 || (argc == 1 && argumentAt(0)->type()->isVoidType()));
|
return ! (argc == 0 || (argc == 1 && argumentAt(0)->type()->asVoidType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Function::minimumArgumentCount() const
|
int Function::minimumArgumentCount() const
|
||||||
@@ -904,7 +904,7 @@ Symbol *ObjCMethod::argumentAt(int index) const
|
|||||||
bool ObjCMethod::hasArguments() const
|
bool ObjCMethod::hasArguments() const
|
||||||
{
|
{
|
||||||
return ! (argumentCount() == 0 ||
|
return ! (argumentCount() == 0 ||
|
||||||
(argumentCount() == 1 && argumentAt(0)->type()->isVoidType()));
|
(argumentCount() == 1 && argumentAt(0)->type()->asVoidType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
|
||||||
|
64
src/libs/3rdparty/cplusplus/Type.cpp
vendored
64
src/libs/3rdparty/cplusplus/Type.cpp
vendored
@@ -22,76 +22,14 @@
|
|||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
#include "TypeVisitor.h"
|
#include "TypeVisitor.h"
|
||||||
#include "CoreTypes.h"
|
#include "CoreTypes.h"
|
||||||
#include "Symbols.h"
|
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Type::Type()
|
Type::~Type() = default;
|
||||||
{ }
|
|
||||||
|
|
||||||
Type::~Type()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool Type::isUndefinedType() const
|
bool Type::isUndefinedType() const
|
||||||
{ return this == &UndefinedType::instance; }
|
{ return this == &UndefinedType::instance; }
|
||||||
|
|
||||||
bool Type::isVoidType() const
|
|
||||||
{ return asVoidType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isIntegerType() const
|
|
||||||
{ return asIntegerType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isFloatType() const
|
|
||||||
{ return asFloatType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isPointerType() const
|
|
||||||
{ return asPointerType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isPointerToMemberType() const
|
|
||||||
{ return asPointerToMemberType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isReferenceType() const
|
|
||||||
{ return asReferenceType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isArrayType() const
|
|
||||||
{ return asArrayType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isNamedType() const
|
|
||||||
{ return asNamedType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isFunctionType() const
|
|
||||||
{ return asFunctionType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isNamespaceType() const
|
|
||||||
{ return asNamespaceType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isTemplateType() const
|
|
||||||
{ return asTemplateType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isClassType() const
|
|
||||||
{ return asClassType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isEnumType() const
|
|
||||||
{ return asEnumType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isForwardClassDeclarationType() const
|
|
||||||
{ return asForwardClassDeclarationType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isObjCClassType() const
|
|
||||||
{ return asObjCClassType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isObjCProtocolType() const
|
|
||||||
{ return asObjCProtocolType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isObjCMethodType() const
|
|
||||||
{ return asObjCMethodType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isObjCForwardClassDeclarationType() const
|
|
||||||
{ return asObjCForwardClassDeclarationType() != nullptr; }
|
|
||||||
|
|
||||||
bool Type::isObjCForwardProtocolDeclarationType() const
|
|
||||||
{ return asObjCForwardProtocolDeclarationType() != nullptr; }
|
|
||||||
|
|
||||||
void Type::accept(TypeVisitor *visitor)
|
void Type::accept(TypeVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->preVisit(this))
|
if (visitor->preVisit(this))
|
||||||
|
21
src/libs/3rdparty/cplusplus/Type.h
vendored
21
src/libs/3rdparty/cplusplus/Type.h
vendored
@@ -27,29 +27,10 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT Type
|
class CPLUSPLUS_EXPORT Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Type();
|
Type() = default;
|
||||||
virtual ~Type();
|
virtual ~Type();
|
||||||
|
|
||||||
bool isUndefinedType() const;
|
bool isUndefinedType() const;
|
||||||
bool isVoidType() const;
|
|
||||||
bool isIntegerType() const;
|
|
||||||
bool isFloatType() const;
|
|
||||||
bool isPointerType() const;
|
|
||||||
bool isPointerToMemberType() const;
|
|
||||||
bool isReferenceType() const;
|
|
||||||
bool isArrayType() const;
|
|
||||||
bool isNamedType() const;
|
|
||||||
bool isFunctionType() const;
|
|
||||||
bool isNamespaceType() const;
|
|
||||||
bool isTemplateType() const;
|
|
||||||
bool isClassType() const;
|
|
||||||
bool isEnumType() const;
|
|
||||||
bool isForwardClassDeclarationType() const;
|
|
||||||
bool isObjCClassType() const;
|
|
||||||
bool isObjCProtocolType() const;
|
|
||||||
bool isObjCMethodType() const;
|
|
||||||
bool isObjCForwardClassDeclarationType() const;
|
|
||||||
bool isObjCForwardProtocolDeclarationType() const;
|
|
||||||
|
|
||||||
virtual const UndefinedType *asUndefinedType() const { return nullptr; }
|
virtual const UndefinedType *asUndefinedType() const { return nullptr; }
|
||||||
virtual const VoidType *asVoidType() const { return nullptr; }
|
virtual const VoidType *asVoidType() const { return nullptr; }
|
||||||
|
@@ -285,7 +285,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FullySpecifiedType ty = rewrite->env->apply(name->identifier(), rewrite);
|
const FullySpecifiedType ty = rewrite->env->apply(name->identifier(), rewrite);
|
||||||
const Name * const minName = ty->isNamedType() ? ty->asNamedType()->name() : name;
|
const Name * const minName = ty->asNamedType() ? ty->asNamedType()->name() : name;
|
||||||
const TemplateNameId * const newTemplateNameId = control()->templateNameId(
|
const TemplateNameId * const newTemplateNameId = control()->templateNameId(
|
||||||
identifier(minName->identifier()), name->isSpecialization(), args.data(),
|
identifier(minName->identifier()), name->isSpecialization(), args.data(),
|
||||||
args.size());
|
args.size());
|
||||||
|
@@ -315,7 +315,7 @@ private:
|
|||||||
return Usage::Type::Other;
|
return Usage::Type::Other;
|
||||||
if (const auto refType = type->asReferenceType())
|
if (const auto refType = type->asReferenceType())
|
||||||
return refType->elementType().isConst() ? Usage::Type::Read : Usage::Type::WritableRef;
|
return refType->elementType().isConst() ? Usage::Type::Read : Usage::Type::WritableRef;
|
||||||
while (type->isPointerType()) {
|
while (type->asPointerType()) {
|
||||||
type = type->asPointerType()->elementType();
|
type = type->asPointerType()->elementType();
|
||||||
if (!type.isConst())
|
if (!type.isConst())
|
||||||
return Usage::Type::WritableRef;
|
return Usage::Type::WritableRef;
|
||||||
@@ -434,7 +434,7 @@ private:
|
|||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
return Usage::Type::Other;
|
return Usage::Type::Other;
|
||||||
for (const LookupItem &item : qAsConst(items)) {
|
for (const LookupItem &item : qAsConst(items)) {
|
||||||
if (item.type()->isFunctionType()) {
|
if (item.type()->asFunctionType()) {
|
||||||
if (item.type().isConst())
|
if (item.type().isConst())
|
||||||
return Usage::Type::Read;
|
return Usage::Type::Read;
|
||||||
if (item.type().isStatic())
|
if (item.type().isStatic())
|
||||||
|
@@ -58,7 +58,7 @@ Utils::CodeModelIcon::Type iconTypeForSymbol(const Symbol *symbol)
|
|||||||
|
|
||||||
FullySpecifiedType symbolType = symbol->type();
|
FullySpecifiedType symbolType = symbol->type();
|
||||||
if (symbol->asFunction() || (symbol->asDeclaration() && symbolType &&
|
if (symbol->asFunction() || (symbol->asDeclaration() && symbolType &&
|
||||||
symbolType->isFunctionType()))
|
symbolType->asFunctionType()))
|
||||||
{
|
{
|
||||||
const Function *function = symbol->asFunction();
|
const Function *function = symbol->asFunction();
|
||||||
if (!function)
|
if (!function)
|
||||||
|
@@ -1089,14 +1089,14 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
|
|||||||
= specializationTemplateArgument.type().type()->asPointerType();
|
= specializationTemplateArgument.type().type()->asPointerType();
|
||||||
// specialization and initialization argument have to be a pointer
|
// specialization and initialization argument have to be a pointer
|
||||||
// additionally type of pointer argument of specialization has to be namedType
|
// additionally type of pointer argument of specialization has to be namedType
|
||||||
if (specPointer && initializationTemplateArgument.type().type()->isPointerType()
|
if (specPointer && initializationTemplateArgument.type().type()->asPointerType()
|
||||||
&& specPointer->elementType().type()->isNamedType()) {
|
&& specPointer->elementType().type()->asNamedType()) {
|
||||||
return cit->second;
|
return cit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayType *specArray
|
ArrayType *specArray
|
||||||
= specializationTemplateArgument.type().type()->asArrayType();
|
= specializationTemplateArgument.type().type()->asArrayType();
|
||||||
if (specArray && initializationTemplateArgument.type().type()->isArrayType()) {
|
if (specArray && initializationTemplateArgument.type().type()->asArrayType()) {
|
||||||
if (const NamedType *argumentNamedType
|
if (const NamedType *argumentNamedType
|
||||||
= specArray->elementType().type()->asNamedType()) {
|
= specArray->elementType().type()->asNamedType()) {
|
||||||
if (const Name *argumentName = argumentNamedType->name()) {
|
if (const Name *argumentName = argumentNamedType->name()) {
|
||||||
@@ -1340,7 +1340,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
cloner.type(tParam->type(), &subst);
|
cloner.type(tParam->type(), &subst);
|
||||||
|
|
||||||
if (i < templSpecArgumentCount
|
if (i < templSpecArgumentCount
|
||||||
&& templSpecId->templateArgumentAt(i).type()->isPointerType()) {
|
&& templSpecId->templateArgumentAt(i).type()->asPointerType()) {
|
||||||
if (PointerType *pointerType = ty->asPointerType())
|
if (PointerType *pointerType = ty->asPointerType())
|
||||||
ty = pointerType->elementType();
|
ty = pointerType->elementType();
|
||||||
}
|
}
|
||||||
|
@@ -168,10 +168,10 @@ private:
|
|||||||
visited.insert(declaration);
|
visited.insert(declaration);
|
||||||
|
|
||||||
// continue working with the typedefed type and scope
|
// continue working with the typedefed type and scope
|
||||||
if (type->type()->isPointerType()) {
|
if (type->type()->asPointerType()) {
|
||||||
*type = FullySpecifiedType(
|
*type = FullySpecifiedType(
|
||||||
_context.bindings()->control()->pointerType(declaration->type()));
|
_context.bindings()->control()->pointerType(declaration->type()));
|
||||||
} else if (type->type()->isReferenceType()) {
|
} else if (type->type()->asReferenceType()) {
|
||||||
*type = FullySpecifiedType(
|
*type = FullySpecifiedType(
|
||||||
_context.bindings()->control()->referenceType(
|
_context.bindings()->control()->referenceType(
|
||||||
declaration->type(),
|
declaration->type(),
|
||||||
@@ -1129,11 +1129,11 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
|||||||
|
|
||||||
Function *instantiatedFunction = nullptr;
|
Function *instantiatedFunction = nullptr;
|
||||||
|
|
||||||
if (overloadType->isFunctionType()) {
|
if (overloadType->asFunctionType()) {
|
||||||
FullySpecifiedType overloadTy
|
FullySpecifiedType overloadTy
|
||||||
= instantiate(binding->templateId(), overload);
|
= instantiate(binding->templateId(), overload);
|
||||||
instantiatedFunction = overloadTy->asFunctionType();
|
instantiatedFunction = overloadTy->asFunctionType();
|
||||||
} else if (overloadType->isTemplateType()
|
} else if (overloadType->asTemplateType()
|
||||||
&& overloadType->asTemplateType()->declaration()
|
&& overloadType->asTemplateType()->declaration()
|
||||||
&& overloadType->asTemplateType()->declaration()->asFunction()) {
|
&& overloadType->asTemplateType()->declaration()->asFunction()) {
|
||||||
instantiatedFunction = overloadType->asTemplateType()->declaration()->asFunction();
|
instantiatedFunction = overloadType->asTemplateType()->declaration()->asFunction();
|
||||||
@@ -1146,7 +1146,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
|||||||
|
|
||||||
typedefsResolver.resolve(&retTy, &functionScope, r.binding());
|
typedefsResolver.resolve(&retTy, &functionScope, r.binding());
|
||||||
|
|
||||||
if (! retTy->isPointerType() && ! retTy->isNamedType())
|
if (! retTy->asPointerType() && ! retTy->asNamedType())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (PointerType *ptrTy = retTy->asPointerType())
|
if (PointerType *ptrTy = retTy->asPointerType())
|
||||||
@@ -1178,7 +1178,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
|||||||
}
|
}
|
||||||
} else if (accessOp == T_DOT) {
|
} else if (accessOp == T_DOT) {
|
||||||
if (replacedDotOperator) {
|
if (replacedDotOperator) {
|
||||||
*replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
|
*replacedDotOperator = originalType->asPointerType() || ty->asPointerType();
|
||||||
if (PointerType *ptrTy = ty->asPointerType())
|
if (PointerType *ptrTy = ty->asPointerType())
|
||||||
ty = ptrTy->elementType();
|
ty = ptrTy->elementType();
|
||||||
}
|
}
|
||||||
|
@@ -312,8 +312,8 @@ void TypePrettyPrinter::visit(PointerToMemberType *type)
|
|||||||
|
|
||||||
void TypePrettyPrinter::prependSpaceBeforeIndirection(const FullySpecifiedType &type)
|
void TypePrettyPrinter::prependSpaceBeforeIndirection(const FullySpecifiedType &type)
|
||||||
{
|
{
|
||||||
const bool elementTypeIsPointerOrReference = type.type()->isPointerType()
|
const bool elementTypeIsPointerOrReference = type.type()->asPointerType()
|
||||||
|| type.type()->isReferenceType();
|
|| type.type()->asReferenceType();
|
||||||
const bool elementIsConstPointerOrReference = elementTypeIsPointerOrReference && type.isConst();
|
const bool elementIsConstPointerOrReference = elementTypeIsPointerOrReference && type.isConst();
|
||||||
const bool shouldBindToLeftSpecifier = _overview->starBindFlags & Overview::BindToLeftSpecifier;
|
const bool shouldBindToLeftSpecifier = _overview->starBindFlags & Overview::BindToLeftSpecifier;
|
||||||
if (elementIsConstPointerOrReference && ! shouldBindToLeftSpecifier)
|
if (elementIsConstPointerOrReference && ! shouldBindToLeftSpecifier)
|
||||||
@@ -342,8 +342,8 @@ void TypePrettyPrinter::prependSpaceAfterIndirection(bool hasName)
|
|||||||
|
|
||||||
void TypePrettyPrinter::visit(PointerType *type)
|
void TypePrettyPrinter::visit(PointerType *type)
|
||||||
{
|
{
|
||||||
const bool isIndirectionToFunction = type->elementType().type()->isFunctionType();
|
const bool isIndirectionToFunction = type->elementType().type()->asFunctionType();
|
||||||
const bool isIndirectionToArray = type->elementType().type()->isArrayType();
|
const bool isIndirectionToArray = type->elementType().type()->asArrayType();
|
||||||
|
|
||||||
visitIndirectionType(aPointerType, type->elementType(),
|
visitIndirectionType(aPointerType, type->elementType(),
|
||||||
isIndirectionToFunction || isIndirectionToArray);
|
isIndirectionToFunction || isIndirectionToArray);
|
||||||
@@ -351,8 +351,8 @@ void TypePrettyPrinter::visit(PointerType *type)
|
|||||||
|
|
||||||
void TypePrettyPrinter::visit(ReferenceType *type)
|
void TypePrettyPrinter::visit(ReferenceType *type)
|
||||||
{
|
{
|
||||||
const bool isIndirectionToFunction = type->elementType().type()->isFunctionType();
|
const bool isIndirectionToFunction = type->elementType().type()->asFunctionType();
|
||||||
const bool isIndirectionToArray = type->elementType().type()->isArrayType();
|
const bool isIndirectionToArray = type->elementType().type()->asArrayType();
|
||||||
const IndirectionType indirectionType = type->isRvalueReference()
|
const IndirectionType indirectionType = type->isRvalueReference()
|
||||||
? aRvalueReferenceType : aReferenceType;
|
? aRvalueReferenceType : aReferenceType;
|
||||||
|
|
||||||
|
@@ -717,7 +717,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
|
|||||||
const FullySpecifiedType &type = propDecl->type();
|
const FullySpecifiedType &type = propDecl->type();
|
||||||
const bool isList = false; // ### fixme
|
const bool isList = false; // ### fixme
|
||||||
const bool isWritable = propDecl->flags() & QtPropertyDeclaration::WriteFunction;
|
const bool isWritable = propDecl->flags() & QtPropertyDeclaration::WriteFunction;
|
||||||
const bool isPointer = type.type() && type.type()->isPointerType();
|
const bool isPointer = type.type() && type.type()->asPointerType();
|
||||||
const int revision = 0; // ### fixme
|
const int revision = 0; // ### fixme
|
||||||
FakeMetaProperty property(
|
FakeMetaProperty property(
|
||||||
namePrinter.prettyName(propDecl->name()),
|
namePrinter.prettyName(propDecl->name()),
|
||||||
|
@@ -190,12 +190,12 @@ protected:
|
|||||||
if (symbol->enclosingEnum() != nullptr)
|
if (symbol->enclosingEnum() != nullptr)
|
||||||
addStatic(symbol->name());
|
addStatic(symbol->name());
|
||||||
|
|
||||||
if (symbol->type()->isFunctionType())
|
if (symbol->type()->asFunctionType())
|
||||||
addFunction(symbol->name());
|
addFunction(symbol->name());
|
||||||
|
|
||||||
if (symbol->isTypedef())
|
if (symbol->isTypedef())
|
||||||
addType(symbol->name());
|
addType(symbol->name());
|
||||||
else if (!symbol->type()->isFunctionType() && symbol->enclosingScope()->asClass())
|
else if (!symbol->type()->asFunctionType() && symbol->enclosingScope()->asClass())
|
||||||
addField(symbol->name());
|
addField(symbol->name());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1313,7 +1313,7 @@ bool CheckSymbols::maybeAddField(const QList<LookupItem> &candidates, NameAST *a
|
|||||||
return false;
|
return false;
|
||||||
if (!(c->enclosingScope() && c->enclosingScope()->asClass()))
|
if (!(c->enclosingScope() && c->enclosingScope()->asClass()))
|
||||||
return false; // shadowed
|
return false; // shadowed
|
||||||
if (c->isTypedef() || (c->type() && c->type()->isFunctionType()))
|
if (c->isTypedef() || (c->type() && c->type()->asFunctionType()))
|
||||||
return false; // shadowed
|
return false; // shadowed
|
||||||
|
|
||||||
int line, column;
|
int line, column;
|
||||||
|
@@ -258,7 +258,7 @@ void CppAssistProposalItem::applyContextualContent(TextDocumentManipulatorInterf
|
|||||||
// unless we're doing a scope completion (then it might be function definition).
|
// unless we're doing a scope completion (then it might be function definition).
|
||||||
const QChar characterAtCursor = manipulator.characterAt(manipulator.currentPosition());
|
const QChar characterAtCursor = manipulator.characterAt(manipulator.currentPosition());
|
||||||
bool endWithSemicolon = m_typedChar == QLatin1Char(';')
|
bool endWithSemicolon = m_typedChar == QLatin1Char(';')
|
||||||
|| (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON);
|
|| (function->returnType()->asVoidType() && m_completionOperator != T_COLON_COLON);
|
||||||
const QChar semicolon = m_typedChar.isNull() ? QLatin1Char(';') : m_typedChar;
|
const QChar semicolon = m_typedChar.isNull() ? QLatin1Char(';') : m_typedChar;
|
||||||
|
|
||||||
if (endWithSemicolon && characterAtCursor == semicolon) {
|
if (endWithSemicolon && characterAtCursor == semicolon) {
|
||||||
@@ -1106,7 +1106,7 @@ bool InternalCppCompletionAssistProcessor::tryObjCCompletion()
|
|||||||
|
|
||||||
for (const LookupItem &item : items) {
|
for (const LookupItem &item : items) {
|
||||||
FullySpecifiedType ty = item.type().simplified();
|
FullySpecifiedType ty = item.type().simplified();
|
||||||
if (ty->isPointerType()) {
|
if (ty->asPointerType()) {
|
||||||
ty = ty->asPointerType()->elementType().simplified();
|
ty = ty->asPointerType()->elementType().simplified();
|
||||||
|
|
||||||
if (NamedType *namedTy = ty->asNamedType()) {
|
if (NamedType *namedTy = ty->asNamedType()) {
|
||||||
@@ -1354,7 +1354,7 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
|||||||
|
|
||||||
// If it's a class, add completions for the constructors
|
// If it's a class, add completions for the constructors
|
||||||
for (const LookupItem &result : results) {
|
for (const LookupItem &result : results) {
|
||||||
if (result.type()->isClassType()) {
|
if (result.type()->asClassType()) {
|
||||||
if (completeConstructorOrFunction(results, endOfExpression, true))
|
if (completeConstructorOrFunction(results, endOfExpression, true))
|
||||||
return m_positionForProposal;
|
return m_positionForProposal;
|
||||||
|
|
||||||
|
@@ -282,15 +282,15 @@ public:
|
|||||||
const FullySpecifiedType &type = declaration->type();
|
const FullySpecifiedType &type = declaration->type();
|
||||||
|
|
||||||
const Name *typeName = nullptr;
|
const Name *typeName = nullptr;
|
||||||
if (type->isNamedType()) {
|
if (type->asNamedType()) {
|
||||||
typeName = type->asNamedType()->name();
|
typeName = type->asNamedType()->name();
|
||||||
} else if (type->isPointerType() || type->isReferenceType()) {
|
} else if (type->asPointerType() || type->asReferenceType()) {
|
||||||
FullySpecifiedType associatedType;
|
FullySpecifiedType associatedType;
|
||||||
if (type->isPointerType())
|
if (type->asPointerType())
|
||||||
associatedType = type->asPointerType()->elementType();
|
associatedType = type->asPointerType()->elementType();
|
||||||
else
|
else
|
||||||
associatedType = type->asReferenceType()->elementType();
|
associatedType = type->asReferenceType()->elementType();
|
||||||
if (associatedType->isNamedType())
|
if (associatedType->asNamedType())
|
||||||
typeName = associatedType->asNamedType()->name();
|
typeName = associatedType->asNamedType()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ static QSharedPointer<CppElement> handleLookupItemMatch(const Snapshot &snapshot
|
|||||||
} else if (declaration->isTypedef()) {
|
} else if (declaration->isTypedef()) {
|
||||||
element = QSharedPointer<CppElement>(new CppTypedef(declaration));
|
element = QSharedPointer<CppElement>(new CppTypedef(declaration));
|
||||||
} else if (declaration->asFunction()
|
} else if (declaration->asFunction()
|
||||||
|| (type.isValid() && type->isFunctionType())
|
|| (type.isValid() && type->asFunctionType())
|
||||||
|| declaration->asTemplate()) {
|
|| declaration->asTemplate()) {
|
||||||
element = QSharedPointer<CppElement>(new CppFunction(declaration));
|
element = QSharedPointer<CppElement>(new CppFunction(declaration));
|
||||||
} else if (declaration->asDeclaration() && type.isValid()) {
|
} else if (declaration->asDeclaration() && type.isValid()) {
|
||||||
|
@@ -151,7 +151,7 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
|
|||||||
if (!items.isEmpty()) {
|
if (!items.isEmpty()) {
|
||||||
const LookupItem item = items.first();
|
const LookupItem item = items.first();
|
||||||
if (Symbol *declaration = item.declaration())
|
if (Symbol *declaration = item.declaration())
|
||||||
result = declaration->type()->isReferenceType();
|
result = declaration->type()->asReferenceType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ static bool isForwardClassDeclaration(Type *type)
|
|||||||
if (!type)
|
if (!type)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (type->isForwardClassDeclarationType()) {
|
if (type->asForwardClassDeclarationType()) {
|
||||||
return true;
|
return true;
|
||||||
} else if (Template *templ = type->asTemplateType()) {
|
} else if (Template *templ = type->asTemplateType()) {
|
||||||
if (Symbol *declaration = templ->declaration()) {
|
if (Symbol *declaration = templ->declaration()) {
|
||||||
@@ -279,22 +279,22 @@ inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolvedSymbo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ty->isObjCForwardClassDeclarationType()) {
|
if (ty->asObjCForwardClassDeclarationType()) {
|
||||||
while (!candidates.isEmpty()) {
|
while (!candidates.isEmpty()) {
|
||||||
LookupItem r = candidates.takeFirst();
|
LookupItem r = candidates.takeFirst();
|
||||||
|
|
||||||
if (!r.type()->isObjCForwardClassDeclarationType()) {
|
if (!r.type()->asObjCForwardClassDeclarationType()) {
|
||||||
result = r;
|
result = r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ty->isObjCForwardProtocolDeclarationType()) {
|
if (ty->asObjCForwardProtocolDeclarationType()) {
|
||||||
while (!candidates.isEmpty()) {
|
while (!candidates.isEmpty()) {
|
||||||
LookupItem r = candidates.takeFirst();
|
LookupItem r = candidates.takeFirst();
|
||||||
|
|
||||||
if (!r.type()->isObjCForwardProtocolDeclarationType()) {
|
if (!r.type()->asObjCForwardProtocolDeclarationType()) {
|
||||||
result = r;
|
result = r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ Symbol *findDefinition(Symbol *symbol, const Snapshot &snapshot, SymbolFinder *s
|
|||||||
if (symbol->asFunction())
|
if (symbol->asFunction())
|
||||||
return nullptr; // symbol is a function definition.
|
return nullptr; // symbol is a function definition.
|
||||||
|
|
||||||
if (!symbol->type()->isFunctionType())
|
if (!symbol->type()->asFunctionType())
|
||||||
return nullptr; // not a function declaration
|
return nullptr; // not a function declaration
|
||||||
|
|
||||||
return symbolFinder->findMatchingDefinition(symbol, snapshot);
|
return symbolFinder->findMatchingDefinition(symbol, snapshot);
|
||||||
@@ -830,7 +830,7 @@ void FollowSymbolUnderCursor::switchDeclDef(
|
|||||||
if (Symbol *symbol = symbols->value) {
|
if (Symbol *symbol = symbols->value) {
|
||||||
if (symbol->asDeclaration()) {
|
if (symbol->asDeclaration()) {
|
||||||
declarationSymbol = symbol;
|
declarationSymbol = symbol;
|
||||||
if (symbol->type()->isFunctionType()) {
|
if (symbol->type()->asFunctionType()) {
|
||||||
functionDeclarationSymbol = symbol;
|
functionDeclarationSymbol = symbol;
|
||||||
break; // Function declaration found!
|
break; // Function declaration found!
|
||||||
}
|
}
|
||||||
|
@@ -355,7 +355,7 @@ void FunctionDeclDefLink::showMarker(CppEditorWidget *editor)
|
|||||||
static int declaredParameterCount(Function *function)
|
static int declaredParameterCount(Function *function)
|
||||||
{
|
{
|
||||||
int argc = function->argumentCount();
|
int argc = function->argumentCount();
|
||||||
if (argc == 0 && function->memberCount() > 0 && function->memberAt(0)->type().type()->isVoidType())
|
if (argc == 0 && function->memberCount() > 0 && function->memberAt(0)->type().type()->asVoidType())
|
||||||
return 1;
|
return 1;
|
||||||
return argc;
|
return argc;
|
||||||
}
|
}
|
||||||
|
@@ -1343,7 +1343,7 @@ void TranslateStringLiteral::match(const CppQuickFixInterface &interface,
|
|||||||
const QList<LookupItem> items = b->find(trName);
|
const QList<LookupItem> items = b->find(trName);
|
||||||
for (const LookupItem &r : items) {
|
for (const LookupItem &r : items) {
|
||||||
Symbol *s = r.declaration();
|
Symbol *s = r.declaration();
|
||||||
if (s->type()->isFunctionType()) {
|
if (s->type()->asFunctionType()) {
|
||||||
// no context required for tr
|
// no context required for tr
|
||||||
result << new WrapStringLiteralOp(interface, path.size() - 1,
|
result << new WrapStringLiteralOp(interface, path.size() - 1,
|
||||||
TranslateTrAction,
|
TranslateTrAction,
|
||||||
@@ -1692,7 +1692,7 @@ void AddLocalDeclaration::match(const CppQuickFixInterface &interface, QuickFixO
|
|||||||
if (!r.declaration())
|
if (!r.declaration())
|
||||||
continue;
|
continue;
|
||||||
if (Declaration *d = r.declaration()->asDeclaration()) {
|
if (Declaration *d = r.declaration()->asDeclaration()) {
|
||||||
if (!d->type()->isFunctionType()) {
|
if (!d->type()->asFunctionType()) {
|
||||||
decl = d;
|
decl = d;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2651,14 +2651,14 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
|
|||||||
if (fun->enclosingScope()->asTemplate()) {
|
if (fun->enclosingScope()->asTemplate()) {
|
||||||
if (const Template *templ = s->type()->asTemplateType()) {
|
if (const Template *templ = s->type()->asTemplateType()) {
|
||||||
if (Symbol *decl = templ->declaration()) {
|
if (Symbol *decl = templ->declaration()) {
|
||||||
if (decl->type()->isFunctionType())
|
if (decl->type()->asFunctionType())
|
||||||
s = decl;
|
s = decl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->match(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType())
|
|| !s->type()->asFunctionType())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s->type().match(fun->type())) {
|
if (s->type().match(fun->type())) {
|
||||||
@@ -3591,10 +3591,10 @@ protected:
|
|||||||
*customValueType = false;
|
*customValueType = false;
|
||||||
// a type is a value type if it is one of the following
|
// a type is a value type if it is one of the following
|
||||||
const auto isTypeValueType = [](const FullySpecifiedType &t) {
|
const auto isTypeValueType = [](const FullySpecifiedType &t) {
|
||||||
return t->isPointerType() || t->isEnumType() || t->isIntegerType() || t->isFloatType()
|
return t->asPointerType() || t->asEnumType() || t->asIntegerType() || t->asFloatType()
|
||||||
|| t->isReferenceType();
|
|| t->asReferenceType();
|
||||||
};
|
};
|
||||||
if (type->isNamedType()) {
|
if (type->asNamedType()) {
|
||||||
// we need a recursive search and a lookup context
|
// we need a recursive search and a lookup context
|
||||||
LookupContext context(m_headerFile->cppDocument(), m_changes.snapshot());
|
LookupContext context(m_headerFile->cppDocument(), m_changes.snapshot());
|
||||||
auto isValueType = [settings = m_settings,
|
auto isValueType = [settings = m_settings,
|
||||||
@@ -3616,7 +3616,7 @@ protected:
|
|||||||
for (auto &&i : localLookup) {
|
for (auto &&i : localLookup) {
|
||||||
if (isTypeValueType(i.type()))
|
if (isTypeValueType(i.type()))
|
||||||
return true;
|
return true;
|
||||||
if (i.type()->isNamedType()) { // check if we have to search recursively
|
if (i.type()->asNamedType()) { // check if we have to search recursively
|
||||||
const Name *newName = i.type()->asNamedType()->name();
|
const Name *newName = i.type()->asNamedType()->name();
|
||||||
Scope *newScope = i.declaration()->enclosingScope();
|
Scope *newScope = i.declaration()->enclosingScope();
|
||||||
if (Matcher::match(newName, name)
|
if (Matcher::match(newName, name)
|
||||||
@@ -5465,7 +5465,7 @@ public:
|
|||||||
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->match(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType()
|
|| !s->type()->asFunctionType()
|
||||||
|| !s->type().match(func->type())
|
|| !s->type().match(func->type())
|
||||||
|| s->asFunction()) {
|
|| s->asFunction()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -6028,7 +6028,7 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface,
|
|||||||
Scope *scope = file->scopeAt(declarator->firstToken());
|
Scope *scope = file->scopeAt(declarator->firstToken());
|
||||||
QList<LookupItem> result = typeOfExpression(file->textOf(declarator->initializer).toUtf8(),
|
QList<LookupItem> result = typeOfExpression(file->textOf(declarator->initializer).toUtf8(),
|
||||||
scope, TypeOfExpression::Preprocess);
|
scope, TypeOfExpression::Preprocess);
|
||||||
if (!result.isEmpty() && result.first().type()->isPointerType())
|
if (!result.isEmpty() && result.first().type()->asPointerType())
|
||||||
mode = ConvertFromAndToPointerOp::FromPointer;
|
mode = ConvertFromAndToPointerOp::FromPointer;
|
||||||
} else if (declarator->ptr_operator_list) {
|
} else if (declarator->ptr_operator_list) {
|
||||||
for (PtrOperatorListAST *ops = declarator->ptr_operator_list; ops; ops = ops->next) {
|
for (PtrOperatorListAST *ops = declarator->ptr_operator_list; ops; ops = ops->next) {
|
||||||
@@ -6660,14 +6660,14 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
|||||||
if (func->enclosingScope()->asTemplate()) {
|
if (func->enclosingScope()->asTemplate()) {
|
||||||
if (const Template *templ = s->type()->asTemplateType()) {
|
if (const Template *templ = s->type()->asTemplateType()) {
|
||||||
if (Symbol *decl = templ->declaration()) {
|
if (Symbol *decl = templ->declaration()) {
|
||||||
if (decl->type()->isFunctionType())
|
if (decl->type()->asFunctionType())
|
||||||
s = decl;
|
s = decl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->match(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType()
|
|| !s->type()->asFunctionType()
|
||||||
|| !s->type().match(func->type())
|
|| !s->type().match(func->type())
|
||||||
|| s->asFunction()) {
|
|| s->asFunction()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -6937,11 +6937,11 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Function *func = item.declaration()->asFunction()) {
|
if (Function *func = item.declaration()->asFunction()) {
|
||||||
if (func->isSignal() || func->returnType()->isVoidType())
|
if (func->isSignal() || func->returnType()->asVoidType())
|
||||||
return;
|
return;
|
||||||
} else if (Declaration *dec = item.declaration()->asDeclaration()) {
|
} else if (Declaration *dec = item.declaration()->asDeclaration()) {
|
||||||
if (Function *func = dec->type()->asFunctionType()) {
|
if (Function *func = dec->type()->asFunctionType()) {
|
||||||
if (func->isSignal() || func->returnType()->isVoidType())
|
if (func->isSignal() || func->returnType()->asVoidType())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7349,7 +7349,7 @@ private:
|
|||||||
Symbol *skipForwardDeclarations(const QList<Symbol *> &symbols)
|
Symbol *skipForwardDeclarations(const QList<Symbol *> &symbols)
|
||||||
{
|
{
|
||||||
for (Symbol *symbol : symbols) {
|
for (Symbol *symbol : symbols) {
|
||||||
if (!symbol->type()->isForwardClassDeclarationType())
|
if (!symbol->type()->asForwardClassDeclarationType())
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -205,7 +205,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
|
|||||||
}
|
}
|
||||||
if (funcDecltr->symbol
|
if (funcDecltr->symbol
|
||||||
&& funcDecltr->symbol->returnType().type()
|
&& funcDecltr->symbol->returnType().type()
|
||||||
&& !funcDecltr->symbol->returnType()->isVoidType()
|
&& !funcDecltr->symbol->returnType()->asVoidType()
|
||||||
&& !funcDecltr->symbol->returnType()->isUndefinedType()) {
|
&& !funcDecltr->symbol->returnType()->isUndefinedType()) {
|
||||||
writeContinuation(&comment);
|
writeContinuation(&comment);
|
||||||
writeCommand(&comment, ReturnCommand);
|
writeCommand(&comment, ReturnCommand);
|
||||||
|
@@ -423,13 +423,13 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context,
|
|||||||
|
|
||||||
if (funcId) {
|
if (funcId) {
|
||||||
for (Symbol *s = scope->find(funcId); s; s = s->next()) {
|
for (Symbol *s = scope->find(funcId); s; s = s->next()) {
|
||||||
if (!s->name() || !funcId->match(s->identifier()) || !s->type()->isFunctionType())
|
if (!s->name() || !funcId->match(s->identifier()) || !s->type()->asFunctionType())
|
||||||
continue;
|
continue;
|
||||||
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Symbol *s = scope->find(operatorNameId); s; s = s->next()) {
|
for (Symbol *s = scope->find(operatorNameId); s; s = s->next()) {
|
||||||
if (!s->name() || !s->type()->isFunctionType())
|
if (!s->name() || !s->type()->asFunctionType())
|
||||||
continue;
|
continue;
|
||||||
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
||||||
}
|
}
|
||||||
|
@@ -650,7 +650,7 @@ void tst_FindUsages::objc_args()
|
|||||||
Declaration *methodIface = iface->memberAt(0)->asDeclaration();
|
Declaration *methodIface = iface->memberAt(0)->asDeclaration();
|
||||||
QVERIFY(methodIface);
|
QVERIFY(methodIface);
|
||||||
QCOMPARE(methodIface->identifier()->chars(), "method");
|
QCOMPARE(methodIface->identifier()->chars(), "method");
|
||||||
QVERIFY(methodIface->type()->isObjCMethodType());
|
QVERIFY(methodIface->type()->asObjCMethodType());
|
||||||
|
|
||||||
ObjCClass *impl = doc->globalSymbolAt(1)->asObjCClass();
|
ObjCClass *impl = doc->globalSymbolAt(1)->asObjCClass();
|
||||||
QVERIFY(impl);
|
QVERIFY(impl);
|
||||||
|
@@ -451,7 +451,7 @@ void tst_Lookup::iface_impl_scoping()
|
|||||||
Argument *method1Arg = method1Impl->memberAt(0)->asArgument();
|
Argument *method1Arg = method1Impl->memberAt(0)->asArgument();
|
||||||
QVERIFY(method1Arg);
|
QVERIFY(method1Arg);
|
||||||
QCOMPARE(method1Arg->identifier()->chars(), "arg");
|
QCOMPARE(method1Arg->identifier()->chars(), "arg");
|
||||||
QVERIFY(method1Arg->type()->isIntegerType());
|
QVERIFY(method1Arg->type()->asIntegerType());
|
||||||
|
|
||||||
Block *method1Body = method1Impl->memberAt(1)->asBlock();
|
Block *method1Body = method1Impl->memberAt(1)->asBlock();
|
||||||
QVERIFY(method1Body);
|
QVERIFY(method1Body);
|
||||||
@@ -465,7 +465,7 @@ void tst_Lookup::iface_impl_scoping()
|
|||||||
QVERIFY(arg->name());
|
QVERIFY(arg->name());
|
||||||
QVERIFY(arg->name()->identifier());
|
QVERIFY(arg->name()->identifier());
|
||||||
QCOMPARE(arg->name()->identifier()->chars(), "arg");
|
QCOMPARE(arg->name()->identifier()->chars(), "arg");
|
||||||
QVERIFY(arg->type()->isIntegerType());
|
QVERIFY(arg->type()->asIntegerType());
|
||||||
|
|
||||||
const QList<LookupItem> candidates = context.lookup(arg->name(), method1Body->enclosingScope());
|
const QList<LookupItem> candidates = context.lookup(arg->name(), method1Body->enclosingScope());
|
||||||
QCOMPARE(candidates.size(), 1);
|
QCOMPARE(candidates.size(), 1);
|
||||||
|
@@ -206,7 +206,7 @@ void tst_Semantic::function_declaration_1()
|
|||||||
FullySpecifiedType declTy = decl->type();
|
FullySpecifiedType declTy = decl->type();
|
||||||
Function *funTy = declTy->asFunctionType();
|
Function *funTy = declTy->asFunctionType();
|
||||||
QVERIFY(funTy);
|
QVERIFY(funTy);
|
||||||
QVERIFY(funTy->returnType()->isVoidType());
|
QVERIFY(funTy->returnType()->asVoidType());
|
||||||
QCOMPARE(funTy->argumentCount(), 0);
|
QCOMPARE(funTy->argumentCount(), 0);
|
||||||
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ void tst_Semantic::function_declaration_2()
|
|||||||
FullySpecifiedType declTy = decl->type();
|
FullySpecifiedType declTy = decl->type();
|
||||||
Function *funTy = declTy->asFunctionType();
|
Function *funTy = declTy->asFunctionType();
|
||||||
QVERIFY(funTy);
|
QVERIFY(funTy);
|
||||||
QVERIFY(funTy->returnType()->isVoidType());
|
QVERIFY(funTy->returnType()->asVoidType());
|
||||||
QCOMPARE(funTy->argumentCount(), 1);
|
QCOMPARE(funTy->argumentCount(), 1);
|
||||||
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ void tst_Semantic::function_declaration_2()
|
|||||||
|
|
||||||
// check the type of the formal argument
|
// check the type of the formal argument
|
||||||
FullySpecifiedType argTy = arg->type();
|
FullySpecifiedType argTy = arg->type();
|
||||||
QVERIFY(argTy->isReferenceType());
|
QVERIFY(argTy->asReferenceType());
|
||||||
QVERIFY(argTy->asReferenceType()->elementType().isConst());
|
QVERIFY(argTy->asReferenceType()->elementType().isConst());
|
||||||
NamedType *namedTy = argTy->asReferenceType()->elementType()->asNamedType();
|
NamedType *namedTy = argTy->asReferenceType()->elementType()->asNamedType();
|
||||||
QVERIFY(namedTy);
|
QVERIFY(namedTy);
|
||||||
@@ -359,7 +359,7 @@ void tst_Semantic::function_declaration_ref_qualifier()
|
|||||||
FullySpecifiedType declTy = decl->type();
|
FullySpecifiedType declTy = decl->type();
|
||||||
Function *funTy = declTy->asFunctionType();
|
Function *funTy = declTy->asFunctionType();
|
||||||
QVERIFY(funTy);
|
QVERIFY(funTy);
|
||||||
QVERIFY(funTy->returnType()->isVoidType());
|
QVERIFY(funTy->returnType()->asVoidType());
|
||||||
QCOMPARE(funTy->argumentCount(), 0);
|
QCOMPARE(funTy->argumentCount(), 0);
|
||||||
|
|
||||||
// check the ref-qualifier
|
// check the ref-qualifier
|
||||||
@@ -374,7 +374,7 @@ void tst_Semantic::function_definition_1()
|
|||||||
|
|
||||||
Function *funTy = doc->globals->memberAt(0)->asFunction();
|
Function *funTy = doc->globals->memberAt(0)->asFunction();
|
||||||
QVERIFY(funTy);
|
QVERIFY(funTy);
|
||||||
QVERIFY(funTy->returnType()->isVoidType());
|
QVERIFY(funTy->returnType()->asVoidType());
|
||||||
QCOMPARE(funTy->argumentCount(), 0);
|
QCOMPARE(funTy->argumentCount(), 0);
|
||||||
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
QCOMPARE(funTy->refQualifier(), Function::NoRefQualifier);
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ void tst_Semantic::alias_declaration_1()
|
|||||||
|
|
||||||
QVERIFY(decl->isTypedef());
|
QVERIFY(decl->isTypedef());
|
||||||
QVERIFY(decl->type().isTypedef());
|
QVERIFY(decl->type().isTypedef());
|
||||||
QVERIFY(decl->type()->isIntegerType());
|
QVERIFY(decl->type()->asIntegerType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Semantic::typedef_1()
|
void tst_Semantic::typedef_1()
|
||||||
@@ -502,7 +502,7 @@ void tst_Semantic::typedef_2()
|
|||||||
Declaration *typedefPointDecl = doc->globals->memberAt(1)->asDeclaration();
|
Declaration *typedefPointDecl = doc->globals->memberAt(1)->asDeclaration();
|
||||||
QVERIFY(typedefPointDecl);
|
QVERIFY(typedefPointDecl);
|
||||||
QVERIFY(typedefPointDecl->isTypedef());
|
QVERIFY(typedefPointDecl->isTypedef());
|
||||||
QVERIFY(typedefPointDecl->type()->isNamedType());
|
QVERIFY(typedefPointDecl->type()->asNamedType());
|
||||||
QCOMPARE(typedefPointDecl->type()->asNamedType()->name(), _pointStruct->name());
|
QCOMPARE(typedefPointDecl->type()->asNamedType()->name(), _pointStruct->name());
|
||||||
|
|
||||||
Function *mainFun = doc->globals->memberAt(2)->asFunction();
|
Function *mainFun = doc->globals->memberAt(2)->asFunction();
|
||||||
@@ -527,7 +527,7 @@ void tst_Semantic::typedef_3()
|
|||||||
Declaration *typedefPointDecl = doc->globals->memberAt(1)->asDeclaration();
|
Declaration *typedefPointDecl = doc->globals->memberAt(1)->asDeclaration();
|
||||||
QVERIFY(typedefPointDecl);
|
QVERIFY(typedefPointDecl);
|
||||||
QVERIFY(typedefPointDecl->isTypedef());
|
QVERIFY(typedefPointDecl->isTypedef());
|
||||||
QVERIFY(typedefPointDecl->type()->isPointerType());
|
QVERIFY(typedefPointDecl->type()->asPointerType());
|
||||||
QCOMPARE(typedefPointDecl->type()->asPointerType()->elementType()->asClassType(),
|
QCOMPARE(typedefPointDecl->type()->asPointerType()->elementType()->asClassType(),
|
||||||
_pointStruct);
|
_pointStruct);
|
||||||
}
|
}
|
||||||
@@ -543,16 +543,16 @@ void tst_Semantic::const_1()
|
|||||||
|
|
||||||
Declaration *decl = doc->globals->memberAt(0)->asDeclaration();
|
Declaration *decl = doc->globals->memberAt(0)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QVERIFY(decl->type()->isFunctionType());
|
QVERIFY(decl->type()->asFunctionType());
|
||||||
Function *funTy = decl->type()->asFunctionType();
|
Function *funTy = decl->type()->asFunctionType();
|
||||||
QVERIFY(funTy->returnType()->isIntegerType());
|
QVERIFY(funTy->returnType()->asIntegerType());
|
||||||
QCOMPARE(funTy->argumentCount(), 1);
|
QCOMPARE(funTy->argumentCount(), 1);
|
||||||
Argument *arg = funTy->argumentAt(0)->asArgument();
|
Argument *arg = funTy->argumentAt(0)->asArgument();
|
||||||
QVERIFY(arg);
|
QVERIFY(arg);
|
||||||
QVERIFY(! arg->type().isConst());
|
QVERIFY(! arg->type().isConst());
|
||||||
QVERIFY(arg->type()->isPointerType());
|
QVERIFY(arg->type()->asPointerType());
|
||||||
QVERIFY(arg->type()->asPointerType()->elementType().isConst());
|
QVERIFY(arg->type()->asPointerType()->elementType().isConst());
|
||||||
QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType());
|
QVERIFY(arg->type()->asPointerType()->elementType()->asIntegerType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Semantic::const_2()
|
void tst_Semantic::const_2()
|
||||||
@@ -566,16 +566,16 @@ void tst_Semantic::const_2()
|
|||||||
|
|
||||||
Declaration *decl = doc->globals->memberAt(0)->asDeclaration();
|
Declaration *decl = doc->globals->memberAt(0)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QVERIFY(decl->type()->isFunctionType());
|
QVERIFY(decl->type()->asFunctionType());
|
||||||
Function *funTy = decl->type()->asFunctionType();
|
Function *funTy = decl->type()->asFunctionType();
|
||||||
QVERIFY(funTy->returnType()->isIntegerType());
|
QVERIFY(funTy->returnType()->asIntegerType());
|
||||||
QCOMPARE(funTy->argumentCount(), 1);
|
QCOMPARE(funTy->argumentCount(), 1);
|
||||||
Argument *arg = funTy->argumentAt(0)->asArgument();
|
Argument *arg = funTy->argumentAt(0)->asArgument();
|
||||||
QVERIFY(arg);
|
QVERIFY(arg);
|
||||||
QVERIFY(arg->type().isConst());
|
QVERIFY(arg->type().isConst());
|
||||||
QVERIFY(arg->type()->isPointerType());
|
QVERIFY(arg->type()->asPointerType());
|
||||||
QVERIFY(! arg->type()->asPointerType()->elementType().isConst());
|
QVERIFY(! arg->type()->asPointerType()->elementType().isConst());
|
||||||
QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType());
|
QVERIFY(arg->type()->asPointerType()->elementType()->asIntegerType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Semantic::pointer_to_function_1()
|
void tst_Semantic::pointer_to_function_1()
|
||||||
|
Reference in New Issue
Block a user