aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-07 06:22:56 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-07 06:22:56 +0000
commitf871d0cc377a1367b519a6cce26be74607566eba (patch)
treef4304b917361b0a077555fca4955eac01309d642 /lib/Sema/SemaOverload.cpp
parent93a00357f2795404c6709d9e06b4f717c82e6efb (diff)
Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 5dfbe09709..27e6c2c2a3 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -1663,7 +1663,7 @@ bool Sema::FunctionArgTypesAreEqual(FunctionProtoType* OldType,
/// error, or returns false otherwise.
bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
CastExpr::CastKind &Kind,
- CXXBaseSpecifierArray& BasePath,
+ CXXCastPath& BasePath,
bool IgnoreBaseAccess) {
QualType FromType = From->getType();
@@ -1755,7 +1755,7 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
/// otherwise.
bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
CastExpr::CastKind &Kind,
- CXXBaseSpecifierArray &BasePath,
+ CXXCastPath &BasePath,
bool IgnoreBaseAccess) {
QualType FromType = From->getType();
const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>();
@@ -3725,10 +3725,10 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
// well-formed.
DeclRefExpr ConversionRef(Conversion, Conversion->getType(),
From->getLocStart());
- ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()),
+ ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack,
+ Context.getPointerType(Conversion->getType()),
CastExpr::CK_FunctionToPointerDecay,
- &ConversionRef, CXXBaseSpecifierArray(),
- ImplicitCastExpr::RValue);
+ &ConversionRef, ImplicitCastExpr::RValue);
// 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
@@ -7636,13 +7636,14 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
assert(Context.hasSameType(ICE->getSubExpr()->getType(),
SubExpr->getType()) &&
"Implicit cast type cannot be determined from overload");
+ assert(ICE->path_empty() && "fixing up hierarchy conversion?");
if (SubExpr == ICE->getSubExpr())
return ICE->Retain();
- return new (Context) ImplicitCastExpr(ICE->getType(),
- ICE->getCastKind(),
- SubExpr, CXXBaseSpecifierArray(),
- ICE->getCategory());
+ return ImplicitCastExpr::Create(Context, ICE->getType(),
+ ICE->getCastKind(),
+ SubExpr, 0,
+ ICE->getCategory());
}
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(E)) {