[cfe-commits] r80135 - in /cfe/trunk: include/clang/AST/Expr.h lib/Sema/SemaExprCXX.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Aug 26 13:34:58 PDT 2009
Author: fjahanian
Date: Wed Aug 26 15:34:58 2009
New Revision: 80135
URL: http://llvm.org/viewvc/llvm-project?rev=80135&view=rev
Log:
AST for conversion by conversion functions. WIP.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=80135&r1=80134&r2=80135&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Aug 26 15:34:58 2009
@@ -1188,7 +1188,11 @@
/// 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 {
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=80135&r1=80134&r2=80135&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Aug 26 15:34:58 2009
@@ -216,9 +216,10 @@
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 @@
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());
More information about the cfe-commits
mailing list