[cfe-commits] r83000 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CodeGenCXX/convert-to-fptr.cpp www/cxx_status.html

Anders Carlsson andersca at mac.com
Mon Sep 28 11:58:15 PDT 2009


On Sep 28, 2009, at 11:35 AM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Mon Sep 28 13:35:46 2009
> New Revision: 83000
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83000&view=rev
> Log:
> Patch for AST representation for the implicit conversion to a function
> reference/pointer. And a test case for code gen.

Nice!

> +
> +    // Create an implicit member expr to refer to the conversion  
> operator.
> +    MemberExpr *ME =
> +      new (Context) MemberExpr(Object, /*IsArrow=*/false, Conv,
> +                               SourceLocation(), Conv->getType());
> +    QualType ResultType = Conv->getConversionType 
> ().getNonReferenceType();
> +    CXXMemberCallExpr *CE =
> +      new (Context) CXXMemberCallExpr(Context, ME, 0, 0,
> +                                      ResultType,
> +                                      SourceLocation());
> +
> +    return ActOnCallExpr(S, ExprArg(*this, CE), LParenLoc,
>                          MultiExprArg(*this, (ExprTy**)Args, NumArgs),
>                          CommaLocs, RParenLoc).release();

I see the same code in Sema::BuildCXXCastArgument. Could you factor  
this out into a helper member function that both BuildCXXCastArgument  
and this could use?

Anders




More information about the cfe-commits mailing list