diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-26 20:34:58 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-26 20:34:58 +0000 |
commit | 9099ff0cf91ac9e0b2d5a142807fa384ce842fc4 (patch) | |
tree | a5dcaf5053252a5ca71de044a3fd572353e18f95 | |
parent | 47421a2ddae59936b4d6013dd00831eb343b4427 (diff) |
AST for conversion by conversion functions. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80135 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Expr.h | 6 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 20 |
2 files changed, 19 insertions, 7 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index febda6971b..1f9d6e2e9e 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1188,7 +1188,11 @@ public: /// CK_BaseToDerivedMemberPointer - Member pointer in base class to /// member pointer in derived class. - CK_BaseToDerivedMemberPointer + CK_BaseToDerivedMemberPointer, + + /// CK_Unknown - Conversion using a user defined type conversion + /// function. + CK_UserDefinedConversion }; struct CastInfo { diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 2b0749aec0..ae5010cfac 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -216,9 +216,10 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep, return ExprError(); exprs.release(); return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(), - Ty, TyBeginLoc, Kind, - Exprs[0], ConversionDecl, - RParenLoc)); + Ty, TyBeginLoc, + CastExpr::CK_UserDefinedConversion, + Exprs[0], ConversionDecl, + RParenLoc)); } if (const RecordType *RT = Ty->getAs<RecordType>()) { @@ -906,9 +907,16 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, break; case ImplicitConversionSequence::UserDefinedConversion: - // FIXME: This is, of course, wrong. We'll need to actually call the - // constructor or conversion operator, and then cope with the standard - // conversions. + // FIXME. Support other kinds of user defined convesions. + if (CXXConversionDecl *CV = + dyn_cast<CXXConversionDecl>(ICS.UserDefined.ConversionFunction)) + // FIXME. Get actual Source Location. + From = + new (Context) CXXFunctionalCastExpr(ToType.getNonReferenceType(), + ToType, SourceLocation(), + CastExpr::CK_UserDefinedConversion, + From, CV, + SourceLocation()); ImpCastExprToType(From, ToType.getNonReferenceType(), CastExpr::CK_Unknown, ToType->isLValueReferenceType()); |