aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/member-function-pointers.cpp
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-07-24 16:25:13 +0000
committerMark Seaborn <mseaborn@chromium.org>2013-07-24 16:25:13 +0000
commitedf0d38c9d3ef522a43d2cb514c90794eaa50dfd (patch)
treed072db8359f4025e7e001c7b21e90b9fd573df62 /clang/test/CodeGenCXX/member-function-pointers.cpp
parent328da33d19837bdd113f8525ffce070f6ec10153 (diff)
downloadllvm-edf0d38c9d3ef522a43d2cb514c90794eaa50dfd.zip
llvm-edf0d38c9d3ef522a43d2cb514c90794eaa50dfd.tar.gz
llvm-edf0d38c9d3ef522a43d2cb514c90794eaa50dfd.tar.bz2
Use ARM-style representation for C++ method pointers under PNaCl/Emscripten
Before this change, Clang uses the x86 representation for C++ method pointers when generating code for PNaCl. However, the resulting code will assume that function pointers are 0 mod 2. This assumption is not safe for PNaCl, where function pointers could have any value (especially in future sandboxing models). So, switch to using the ARM representation for PNaCl code, which makes no assumptions about the alignment of function pointers. Since we're changing the "le32" target, this change also applies to Emscripten. The change is beneficial for Emscripten too. Emscripten has a workaround to make function pointers 0 mod 2. This change would allow the workaround to be removed. See: https://code.google.com/p/nativeclient/issues/detail?id=3450 llvm-svn: 187051
Diffstat (limited to 'clang/test/CodeGenCXX/member-function-pointers.cpp')
-rw-r--r--clang/test/CodeGenCXX/member-function-pointers.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/member-function-pointers.cpp b/clang/test/CodeGenCXX/member-function-pointers.cpp
index 84b54b6..23a7b00 100644
--- a/clang/test/CodeGenCXX/member-function-pointers.cpp
+++ b/clang/test/CodeGenCXX/member-function-pointers.cpp
@@ -4,6 +4,9 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-unknown-unknown | FileCheck -check-prefix GLOBAL-LP32 %s
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-unknown | FileCheck -check-prefix GLOBAL-ARM %s
+// PNaCl uses the same representation of method pointers as ARM.
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=le32-unknown-nacl | FileCheck -check-prefix GLOBAL-ARM %s
+
struct A { int a; void f(); virtual void vf1(); virtual void vf2(); };
struct B { int b; virtual void g(); };
struct C : B, A { };