From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../CodeGenCXX/member-function-pointer-calls.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 clang/test/CodeGenCXX/member-function-pointer-calls.cpp (limited to 'clang/test/CodeGenCXX/member-function-pointer-calls.cpp') diff --git a/clang/test/CodeGenCXX/member-function-pointer-calls.cpp b/clang/test/CodeGenCXX/member-function-pointer-calls.cpp new file mode 100644 index 0000000..f8960aa --- /dev/null +++ b/clang/test/CodeGenCXX/member-function-pointer-calls.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s +struct A { + virtual int vf1() { return 1; } + virtual int vf2() { return 2; } +}; + +int f(A* a, int (A::*fp)()) { + return (a->*fp)(); +} + +// CHECK: define i32 @_Z2g1v() +// CHECK: ret i32 1 +int g1() { + A a; + return f(&a, &A::vf1); +} + +// CHECK: define i32 @_Z2g2v() +// CHECK: ret i32 2 +int g2() { + A a; + return f(&a, &A::vf2); +} -- cgit v1.2.3