More reduction of dynamic allocations in lDoTypeConv()
This commit is contained in:
12
expr.cpp
12
expr.cpp
@@ -279,10 +279,10 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr,
|
|||||||
const Type *eltType = fromArrayType->GetElementType();
|
const Type *eltType = fromArrayType->GetElementType();
|
||||||
if (toPointerType->GetBaseType()->IsConstType())
|
if (toPointerType->GetBaseType()->IsConstType())
|
||||||
eltType = eltType->GetAsConstType();
|
eltType = eltType->GetAsConstType();
|
||||||
if (Type::Equal(toPointerType,
|
|
||||||
new PointerType(eltType,
|
PointerType pt(eltType, toPointerType->GetVariability(),
|
||||||
toPointerType->GetVariability(),
|
toPointerType->IsConstType());
|
||||||
toPointerType->IsConstType())))
|
if (Type::Equal(toPointerType, &pt))
|
||||||
goto typecast_ok;
|
goto typecast_ok;
|
||||||
else {
|
else {
|
||||||
if (!failureOk)
|
if (!failureOk)
|
||||||
@@ -392,7 +392,9 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr,
|
|||||||
|
|
||||||
// Convert from type T -> const T; just return a TypeCast expr, which
|
// Convert from type T -> const T; just return a TypeCast expr, which
|
||||||
// can handle this
|
// can handle this
|
||||||
if (Type::Equal(toType, fromType->GetAsConstType()))
|
if (Type::EqualIgnoringConst(toType, fromType) &&
|
||||||
|
toType->IsConstType() == true &&
|
||||||
|
fromType->IsConstType() == false)
|
||||||
goto typecast_ok;
|
goto typecast_ok;
|
||||||
|
|
||||||
if (CastType<ReferenceType>(fromType)) {
|
if (CastType<ReferenceType>(fromType)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user