Commit f9f99091 authored by Roberto Raggi's avatar Roberto Raggi

Pass the fully specified type as const reference.

parent f2c4d84c
......@@ -86,7 +86,7 @@ ExpressionAST *CheckExpression::switchExpression(ExpressionAST *expression)
return previousExpression;
}
FullySpecifiedType CheckExpression::switchFullySpecifiedType(FullySpecifiedType type)
FullySpecifiedType CheckExpression::switchFullySpecifiedType(const FullySpecifiedType &type)
{
FullySpecifiedType previousType = _fullySpecifiedType;
_fullySpecifiedType = type;
......
......@@ -66,7 +66,7 @@ public:
protected:
ExpressionAST *switchExpression(ExpressionAST *expression);
FullySpecifiedType switchFullySpecifiedType(FullySpecifiedType type);
FullySpecifiedType switchFullySpecifiedType(const FullySpecifiedType &type);
Scope *switchScope(Scope *scope);
using ASTVisitor::visit;
......
......@@ -180,7 +180,7 @@ public:
return it->second;
}
ConversionNameId *findOrInsertConversionNameId(FullySpecifiedType type)
ConversionNameId *findOrInsertConversionNameId(const FullySpecifiedType &type)
{
std::map<FullySpecifiedType, ConversionNameId *>::iterator it =
conversionNameIds.lower_bound(type);
......@@ -238,7 +238,7 @@ public:
return it->second;
}
PointerType *findOrInsertPointerType(FullySpecifiedType elementType)
PointerType *findOrInsertPointerType(const FullySpecifiedType &elementType)
{
std::map<FullySpecifiedType, PointerType *>::iterator it =
pointerTypes.lower_bound(elementType);
......@@ -247,7 +247,7 @@ public:
return it->second;
}
ReferenceType *findOrInsertReferenceType(FullySpecifiedType elementType)
ReferenceType *findOrInsertReferenceType(const FullySpecifiedType &elementType)
{
std::map<FullySpecifiedType, ReferenceType *>::iterator it =
referenceTypes.lower_bound(elementType);
......@@ -256,7 +256,7 @@ public:
return it->second;
}
ArrayType *findOrInsertArrayType(FullySpecifiedType elementType, size_t size)
ArrayType *findOrInsertArrayType(const FullySpecifiedType &elementType, size_t size)
{
const ArrayKey key(elementType, size);
std::map<ArrayKey, ArrayType *>::iterator it =
......@@ -494,7 +494,7 @@ public:
size(0)
{ }
ArrayKey(FullySpecifiedType type, size_t size) :
ArrayKey(const FullySpecifiedType &type, size_t size) :
type(type), size(size)
{ }
......@@ -696,7 +696,7 @@ DestructorNameId *Control::destructorNameId(Identifier *id)
OperatorNameId *Control::operatorNameId(int kind)
{ return d->findOrInsertOperatorNameId(kind); }
ConversionNameId *Control::conversionNameId(FullySpecifiedType type)
ConversionNameId *Control::conversionNameId(const FullySpecifiedType &type)
{ return d->findOrInsertConversionNameId(type); }
QualifiedNameId *Control::qualifiedNameId(Name *const *names,
......@@ -728,13 +728,13 @@ FloatType *Control::floatType(int kind)
PointerToMemberType *Control::pointerToMemberType(Name *memberName, FullySpecifiedType elementType)
{ return d->findOrInsertPointerToMemberType(memberName, elementType); }
PointerType *Control::pointerType(FullySpecifiedType elementType)
PointerType *Control::pointerType(const FullySpecifiedType &elementType)
{ return d->findOrInsertPointerType(elementType); }
ReferenceType *Control::referenceType(FullySpecifiedType elementType)
ReferenceType *Control::referenceType(const FullySpecifiedType &elementType)
{ return d->findOrInsertReferenceType(elementType); }
ArrayType *Control::arrayType(FullySpecifiedType elementType, size_t size)
ArrayType *Control::arrayType(const FullySpecifiedType &elementType, size_t size)
{ return d->findOrInsertArrayType(elementType, size); }
NamedType *Control::namedType(Name *name)
......
......@@ -82,7 +82,7 @@ public:
OperatorNameId *operatorNameId(int operatorId);
/// Returns the canonical conversion name id.
ConversionNameId *conversionNameId(FullySpecifiedType type);
ConversionNameId *conversionNameId(const FullySpecifiedType &type);
/// Returns the canonical qualified name id.
QualifiedNameId *qualifiedNameId(Name *const *names,
......@@ -107,13 +107,13 @@ public:
FullySpecifiedType elementType);
/// Returns a Type object of type PointerType.
PointerType *pointerType(FullySpecifiedType elementType);
PointerType *pointerType(const FullySpecifiedType &elementType);
/// Returns a Type object of type ReferenceType.
ReferenceType *referenceType(FullySpecifiedType elementType);
ReferenceType *referenceType(const FullySpecifiedType &elementType);
/// Retruns a Type object of type ArrayType.
ArrayType *arrayType(FullySpecifiedType elementType, size_t size = 0);
ArrayType *arrayType(const FullySpecifiedType &elementType, size_t size = 0);
/// Returns a Type object of type NamedType.
NamedType *namedType(Name *name);
......
......@@ -90,7 +90,7 @@ bool PointerToMemberType::isEqualTo(const Type *other) const
void PointerToMemberType::accept0(TypeVisitor *visitor)
{ visitor->visit(this); }
PointerType::PointerType(FullySpecifiedType elementType)
PointerType::PointerType(const FullySpecifiedType &elementType)
: _elementType(elementType)
{ }
......@@ -111,7 +111,7 @@ void PointerType::accept0(TypeVisitor *visitor)
FullySpecifiedType PointerType::elementType() const
{ return _elementType; }
ReferenceType::ReferenceType(FullySpecifiedType elementType)
ReferenceType::ReferenceType(const FullySpecifiedType &elementType)
: _elementType(elementType)
{ }
......@@ -174,7 +174,7 @@ bool FloatType::isEqualTo(const Type *other) const
return _kind == o->_kind;
}
ArrayType::ArrayType(FullySpecifiedType elementType, size_t size)
ArrayType::ArrayType(const FullySpecifiedType &elementType, size_t size)
: _elementType(elementType), _size(size)
{ }
......
......@@ -156,7 +156,7 @@ private:
class CPLUSPLUS_EXPORT PointerType: public Type
{
public:
PointerType(FullySpecifiedType elementType);
PointerType(const FullySpecifiedType &elementType);
virtual ~PointerType();
FullySpecifiedType elementType() const;
......@@ -204,7 +204,7 @@ private:
class CPLUSPLUS_EXPORT ReferenceType: public Type
{
public:
ReferenceType(FullySpecifiedType elementType);
ReferenceType(const FullySpecifiedType &elementType);
virtual ~ReferenceType();
FullySpecifiedType elementType() const;
......@@ -227,7 +227,7 @@ private:
class CPLUSPLUS_EXPORT ArrayType: public Type
{
public:
ArrayType(FullySpecifiedType elementType, size_t size);
ArrayType(const FullySpecifiedType &elementType, size_t size);
virtual ~ArrayType();
FullySpecifiedType elementType() const;
......
......@@ -244,7 +244,7 @@ bool OperatorNameId::isEqualTo(const Name *other) const
return _kind == o->kind();
}
ConversionNameId::ConversionNameId(FullySpecifiedType type)
ConversionNameId::ConversionNameId(const FullySpecifiedType &type)
: _type(type)
{ }
......
......@@ -250,7 +250,7 @@ private:
class CPLUSPLUS_EXPORT ConversionNameId: public Name
{
public:
ConversionNameId(FullySpecifiedType type);
ConversionNameId(const FullySpecifiedType &type);
virtual ~ConversionNameId();
FullySpecifiedType type() const;
......
......@@ -117,7 +117,7 @@ TemplateParameters *Declaration::templateParameters() const
void Declaration::setTemplateParameters(TemplateParameters *templateParameters)
{ _templateParameters = templateParameters; }
void Declaration::setType(FullySpecifiedType type)
void Declaration::setType(const FullySpecifiedType &type)
{ _type = type; }
FullySpecifiedType Declaration::type() const
......@@ -140,7 +140,7 @@ bool Argument::hasInitializer() const
void Argument::setInitializer(bool hasInitializer)
{ _initializer = hasInitializer; }
void Argument::setType(FullySpecifiedType type)
void Argument::setType(const FullySpecifiedType &type)
{ _type = type; }
FullySpecifiedType Argument::type() const
......@@ -230,7 +230,7 @@ FullySpecifiedType Function::type() const
FullySpecifiedType Function::returnType() const
{ return _returnType; }
void Function::setReturnType(FullySpecifiedType returnType)
void Function::setReturnType(const FullySpecifiedType &returnType)
{ _returnType = returnType; }
bool Function::hasReturnType() const
......@@ -773,7 +773,7 @@ FullySpecifiedType ObjCMethod::type() const
FullySpecifiedType ObjCMethod::returnType() const
{ return _returnType; }
void ObjCMethod::setReturnType(FullySpecifiedType returnType)
void ObjCMethod::setReturnType(const FullySpecifiedType &returnType)
{ _returnType = returnType; }
bool ObjCMethod::hasReturnType() const
......
......@@ -120,7 +120,7 @@ public:
TemplateParameters *templateParameters() const;
void setTemplateParameters(TemplateParameters *templateParameters);
void setType(FullySpecifiedType type);
void setType(const FullySpecifiedType &type);
// Symbol's interface
virtual FullySpecifiedType type() const;
......@@ -145,7 +145,7 @@ public:
Argument(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name);
virtual ~Argument();
void setType(FullySpecifiedType type);
void setType(const FullySpecifiedType &type);
bool hasInitializer() const;
void setInitializer(bool hasInitializer);
......@@ -295,7 +295,7 @@ public:
void setTemplateParameters(TemplateParameters *templateParameters);
FullySpecifiedType returnType() const;
void setReturnType(FullySpecifiedType returnType);
void setReturnType(const FullySpecifiedType &returnType);
/** Convenience function that returns whether the function returns something (including void). */
bool hasReturnType() const;
......@@ -680,7 +680,7 @@ public:
virtual ~ObjCMethod();
FullySpecifiedType returnType() const;
void setReturnType(FullySpecifiedType returnType);
void setReturnType(const FullySpecifiedType &returnType);
/** Convenience function that returns whether the function returns something (including void). */
bool hasReturnType() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment