/// BasePath - For derived-to-base and base-to-derived casts, the base array
/// contains the inheritance path.
- CXXBaseSpecifierArray *BasePath;
+ CXXBaseSpecifierArray BasePath;
void CheckBasePath() const {
#ifndef NDEBUG
case CK_MemberPointerToBoolean:
case CK_AnyPointerToObjCPointerCast:
case CK_AnyPointerToBlockPointerCast:
- assert(!BasePath && "Cast kind shoudl not have a base path!");
+ assert(BasePath.empty() && "Cast kind shoudl not have a base path!");
break;
}
#endif
protected:
CastExpr(StmtClass SC, QualType ty, const CastKind kind, Expr *op,
- CXXBaseSpecifierArray *BasePath) :
+ CXXBaseSpecifierArray BasePath) :
Expr(SC, ty,
// Cast expressions are type-dependent if the type is
// dependent (C++ [temp.dep.expr]p3).
public:
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
- CXXBaseSpecifierArray *BasePath, bool Lvalue)
+ CXXBaseSpecifierArray BasePath, bool Lvalue)
: CastExpr(ImplicitCastExprClass, ty, kind, op, BasePath),
LvalueCast(Lvalue) { }
protected:
ExplicitCastExpr(StmtClass SC, QualType exprTy, CastKind kind,
Expr *op, TypeSourceInfo *writtenTy)
- : CastExpr(SC, exprTy, kind, op, 0), TInfo(writtenTy) {}
+ : CastExpr(SC, exprTy, kind, op, CXXBaseSpecifierArray()),
+ TInfo(writtenTy) {}
/// \brief Construct an empty explicit cast.
ExplicitCastExpr(StmtClass SC, EmptyShell Shell)
public:
UsuallyTinyPtrVector() : Storage(0) { }
+ bool empty() const { return !Storage; }
+
typedef const T **iterator;
iterator begin() const;
iterator end() const;
if (!SubExpr)
return 0;
+ // FIXME: Initialize the base path.
+ CXXBaseSpecifierArray BasePath;
return new (Importer.getToContext()) ImplicitCastExpr(T, E->getCastKind(),
- SubExpr,
- /* FIXME: */0,
+ SubExpr, BasePath,
E->isLvalueCast());
}
void CastExpr::DoDestroy(ASTContext &C)
{
- if (BasePath)
- BasePath->Destroy();
+ BasePath.Destroy();
Expr::DoDestroy(C);
}
if (getContext().getCanonicalType(Ivar->getType()) !=
getContext().getCanonicalType(ArgDecl->getType())) {
ImplicitCastExpr ArgCasted(Ivar->getType(), CastExpr::CK_BitCast, &Arg,
- 0, false);
+ CXXBaseSpecifierArray(), false);
BinaryOperator Assign(&IvarRef, &ArgCasted, BinaryOperator::Assign,
Ivar->getType(), Loc);
EmitStmt(&Assign);
QualType pToFunc = Context->getPointerType(msgSendType);
ImplicitCastExpr *ICE =
new (Context) ImplicitCastExpr(pToFunc, CastExpr::CK_Unknown,
- DRE, /*InheritancePath=*/0,
+ DRE, CXXBaseSpecifierArray(),
/*isLvalue=*/false);
const FunctionType *FT = msgSendType->getAs<FunctionType>();
/// If isLvalue, the result of the cast is an lvalue.
void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
CastExpr::CastKind Kind,
- CXXBaseSpecifierArray *BasePath,
- bool isLvalue) {
+ bool isLvalue, CXXBaseSpecifierArray BasePath) {
QualType ExprTy = Context.getCanonicalType(Expr->getType());
QualType TypeTy = Context.getCanonicalType(Ty);
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
if (ImpCast->getCastKind() == Kind) {
- assert(!BasePath && "FIXME: Merge paths!");
+ assert(BasePath.empty() && "FIXME: Merge paths!");
ImpCast->setType(Ty);
ImpCast->setLvalueCast(isLvalue);
return;
/// cast. If there is already an implicit cast, merge into the existing one.
/// If isLvalue, the result of the cast is an lvalue.
void ImpCastExprToType(Expr *&Expr, QualType Type, CastExpr::CastKind Kind,
- CXXBaseSpecifierArray *BasePath = 0,
- bool isLvalue = false);
+ bool isLvalue = false,
+ CXXBaseSpecifierArray BasePath =
+ CXXBaseSpecifierArray());
// UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
// functions and arrays to their respective pointers (C99 6.3.2.1).
ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy,
CastExpr::CK_IntegralCast,
ECD->getInitExpr(),
- /*InheritancePath=*/0,
+ CXXBaseSpecifierArray(),
/*isLvalue=*/false));
if (getLangOptions().CPlusPlus)
// C++ [dcl.enum]p4: Following the closing brace of an
if (PointerConversions)
QType = Context.getPointerType(QType);
ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue=*/!PointerConversions);
FromType = QType;
if (PointerConversions)
UType = Context.getPointerType(UType);
ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue*/ !PointerConversions);
FromType = UType;
FromRecordType = URecordType;
return true;
ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue=*/!PointerConversions);
return false;
}
// type.
if (T.hasQualifiers()) {
ImpCastExprToType(E, T.getUnqualifiedType(), CastExpr::CK_NoOp,
- /*InheritancePath=*/0, E->isLvalue(Context));
+ E->isLvalue(Context));
TyOrExpr = E;
}
}
// or "pointer to function returning T", [...]
if (E->getType().hasQualifiers())
ImpCastExprToType(E, E->getType().getUnqualifiedType(), CastExpr::CK_NoOp,
- /*InheritancePath=*/0,
E->isLvalue(Context) == Expr::LV_Valid);
DefaultFunctionArrayConversion(E);
// FIXME: Not sure about lvalue vs rvalue here in the presence of rvalue
// references.
ImpCastExprToType(From, ToType.getNonReferenceType(),
- CastExpr::CK_NoOp, /*InheritancePath=*/0,
- ToType->isLValueReferenceType());
+ CastExpr::CK_NoOp, ToType->isLValueReferenceType());
if (SCS.DeprecatedStringLiteralToCharPtr)
Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion)
// Cast LHS to type of use.
QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
bool isLValue = !isIndirect && lex->isLvalue(Context) == Expr::LV_Valid;
- ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase,
- /*FIXME: InheritancePath=*/0, isLValue);
+ ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, isLValue);
}
if (isa<CXXZeroInitValueExpr>(rex->IgnoreParens())) {
CurInit = S.Owned(new (S.Context) ImplicitCastExpr(Step->Type,
CastExpr::CK_DerivedToBase,
(Expr*)CurInit.release(),
- /*FIXME:InheritancePath=*/0,
+ CXXBaseSpecifierArray(),
Step->Kind == SK_CastDerivedToBaseLValue));
break;
}
CurInitExpr = CurInit.takeAs<Expr>();
CurInit = S.Owned(new (S.Context) ImplicitCastExpr(CurInitExpr->getType(),
- CastKind,
- CurInitExpr,
- /*InheritancePath=*/0,
- IsLvalue));
+ CastKind,
+ CurInitExpr,
+ CXXBaseSpecifierArray(),
+ IsLvalue));
if (RequiresCopy)
CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity,
case SK_QualificationConversionRValue:
// Perform a qualification conversion; these can never go wrong.
S.ImpCastExprToType(CurInitExpr, Step->Type,
- CastExpr::CK_NoOp, /*InheritancePath=*/0,
+ CastExpr::CK_NoOp,
Step->Kind == SK_QualificationConversionLValue);
CurInit.release();
CurInit = S.Owned(CurInitExpr);
return PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);
if (!Context.hasSameType(From->getType(), DestType))
- ImpCastExprToType(From, DestType, CastExpr::CK_NoOp, /*InheritancePath=*/0,
- /*isLvalue=*/!From->getType()->getAs<PointerType>());
+ ImpCastExprToType(From, DestType, CastExpr::CK_NoOp,
+ /*isLvalue=*/!From->getType()->isPointerType());
return false;
}
From->getLocStart());
ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()),
CastExpr::CK_FunctionToPointerDecay,
- &ConversionRef, /*InheritancePath=*/0, false);
+ &ConversionRef, CXXBaseSpecifierArray(), false);
// Note that it is safe to allocate CallExpr on the stack here because
// there are 0 arguments (i.e., nothing is allocated using ASTContext's
return new (Context) ImplicitCastExpr(ICE->getType(),
ICE->getCastKind(),
- SubExpr,
- /*InheritancePath=*/0,
+ SubExpr, CXXBaseSpecifierArray(),
ICE->isLvalueCast());
}
if (IsQualificationConversion(ArgType, ParamType.getNonReferenceType())) {
ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp,
- /*InheritancePath=*/0,
Arg->isLvalue(Context) == Expr::LV_Valid);
} else if (!Context.hasSameUnqualifiedType(ArgType,
ParamType.getNonReferenceType())) {
// Types match exactly: nothing more to do here.
} else if (IsQualificationConversion(ArgType, ParamType)) {
ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp,
- /*InheritancePath=*/0,
Arg->isLvalue(Context) == Expr::LV_Valid);
} else {
// We can't perform this conversion.