[cfe-commits] r83045 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/PR5093-static-member-function.cpp
Chris Lattner
clattner at apple.com
Mon Sep 28 21:31:52 PDT 2009
On Sep 28, 2009, at 8:54 PM, Anders Carlsson wrote:
> Author: andersca
> Date: Mon Sep 28 22:54:11 2009
> New Revision: 83045
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83045&view=rev
> Log:
> Handle CXXMemberCallExprs that point to a static method. Fixes PR5093.
Very nice Anders!
A couple of requests about the testcase:
Please put "// PR5093" in the testcase instead of in the filename
(likewise for rdar's). The test runner will pull them out that way.
Also, FileCheck allows you to put multiple tests in one file, please
pull multiple testcases that require the same compile flags into one
big test. This could just go in CodeGenCXX/exprs.cpp or something
like that.
-Chris
>
> Added:
> cfe/trunk/test/CodeGenCXX/PR5093-static-member-function.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGCXX.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=83045&r1=83044&r2=83045&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Sep 28 22:54:11 2009
> @@ -202,6 +202,14 @@
> const MemberExpr *ME = cast<MemberExpr>(CE->getCallee());
> const CXXMethodDecl *MD = cast<CXXMethodDecl>(ME->getMemberDecl());
>
> + if (MD->isStatic()) {
> + // The method is static, emit it as we would a regular call.
> + llvm::Value *Callee = CGM.GetAddrOfFunction(MD);
> + return EmitCall(Callee, getContext().getPointerType(MD->getType
> ()),
> + CE->arg_begin(), CE->arg_end(), 0);
> +
> + }
> +
> const FunctionProtoType *FPT = MD->getType()-
> >getAs<FunctionProtoType>();
>
> const llvm::Type *Ty =
>
> Added: cfe/trunk/test/CodeGenCXX/PR5093-static-member-function.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR5093-static-member-function.cpp?rev=83045&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/test/CodeGenCXX/PR5093-static-member-function.cpp
> (added)
> +++ cfe/trunk/test/CodeGenCXX/PR5093-static-member-function.cpp Mon
> Sep 28 22:54:11 2009
> @@ -0,0 +1,9 @@
> +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
> +struct a {
> + static void f();
> +};
> +
> +void g(a *a) {
> + // CHECK: call void @_ZN1a1fEv()
> + a->f();
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list