aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-24 16:57:13 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-24 16:57:13 +0000
commitf1b48b7014992155286d58bb1676f9f51031d18b (patch)
tree8bbd12ee8c2c73a29c2c08c91dfc7d5448a959cb /lib/Sema
parentc70e93c8b1e9dc566bb9a31951c21de7a166d4ac (diff)
CastExpr should not hold a pointer to the base path. More cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/Sema.cpp5
-rw-r--r--lib/Sema/Sema.h5
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--lib/Sema/SemaExpr.cpp3
-rw-r--r--lib/Sema/SemaExprCXX.cpp9
-rw-r--r--lib/Sema/SemaInit.cpp12
-rw-r--r--lib/Sema/SemaOverload.cpp9
-rw-r--r--lib/Sema/SemaTemplate.cpp2
8 files changed, 19 insertions, 28 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index ad4be1a3ab..6975da0b3e 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -159,8 +159,7 @@ Sema::~Sema() {
/// 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);
@@ -180,7 +179,7 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType 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;
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 862de98e1b..48b12b5712 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -3959,8 +3959,9 @@ public:
/// 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).
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index bf2cba10c7..20e4200fbe 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -6511,7 +6511,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
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
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f5ecff8184..02c41da30b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1443,7 +1443,6 @@ Sema::PerformObjectMemberConversion(Expr *&From,
if (PointerConversions)
QType = Context.getPointerType(QType);
ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue=*/!PointerConversions);
FromType = QType;
@@ -1480,7 +1479,6 @@ Sema::PerformObjectMemberConversion(Expr *&From,
if (PointerConversions)
UType = Context.getPointerType(UType);
ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue*/ !PointerConversions);
FromType = UType;
FromRecordType = URecordType;
@@ -1499,7 +1497,6 @@ Sema::PerformObjectMemberConversion(Expr *&From,
return true;
ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase,
- /*FIXME: InheritancePath=*/0,
/*isLvalue=*/!PointerConversions);
return false;
}
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 042f2c14ab..71d8914761 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -341,7 +341,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
// type.
if (T.hasQualifiers()) {
ImpCastExprToType(E, T.getUnqualifiedType(), CastExpr::CK_NoOp,
- /*InheritancePath=*/0, E->isLvalue(Context));
+ E->isLvalue(Context));
TyOrExpr = E;
}
}
@@ -392,7 +392,6 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&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);
@@ -1792,8 +1791,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
// 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)
@@ -1887,8 +1885,7 @@ QualType Sema::CheckPointerToMemberOperands(
// 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())) {
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 904489cdd9..90c8e3bac6 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -3468,7 +3468,7 @@ InitializationSequence::Perform(Sema &S,
CurInit = S.Owned(new (S.Context) ImplicitCastExpr(Step->Type,
CastExpr::CK_DerivedToBase,
(Expr*)CurInit.release(),
- /*FIXME:InheritancePath=*/0,
+ CXXBaseSpecifierArray(),
Step->Kind == SK_CastDerivedToBaseLValue));
break;
}
@@ -3586,10 +3586,10 @@ InitializationSequence::Perform(Sema &S,
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,
@@ -3601,7 +3601,7 @@ InitializationSequence::Perform(Sema &S,
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);
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 732b9ee3eb..50afb7e1bc 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2675,8 +2675,8 @@ Sema::PerformObjectArgumentInitialization(Expr *&From,
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;
}
@@ -3157,7 +3157,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
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
@@ -6859,8 +6859,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
return new (Context) ImplicitCastExpr(ICE->getType(),
ICE->getCastKind(),
- SubExpr,
- /*InheritancePath=*/0,
+ SubExpr, CXXBaseSpecifierArray(),
ICE->isLvalueCast());
}
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 14d04563d6..7e7413f296 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -2868,7 +2868,6 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
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())) {
@@ -2933,7 +2932,6 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// 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.