summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-03-26 17:03:51 +0000
committerKostya Serebryany <kcc@google.com>2012-03-26 17:03:51 +0000
commit8cb4a070d491ddd671b049110cc8d0accb08b905 (patch)
tree069fdc3e8e7959280024f5ce210b4e2be3cd831a /test/CodeGen
parent1eb18afd931f626713c066ede0707ceb522fa061 (diff)
add tbaa metadata to vtable pointer loads/stores
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/tbaa-for-vptr.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/tbaa-for-vptr.cpp b/test/CodeGen/tbaa-for-vptr.cpp
new file mode 100644
index 0000000000..c63c736852
--- /dev/null
+++ b/test/CodeGen/tbaa-for-vptr.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -emit-llvm -o - -O1 %s | FileCheck %s
+// Check that we generate TBAA for vtable pointer loads and stores.
+struct A {
+ virtual int foo() const ;
+ virtual ~A();
+};
+
+void CreateA() {
+ new A;
+}
+
+void CallFoo(A *a) {
+ a->foo();
+}
+
+// CHECK: %vtable = load {{.*}} !tbaa !0
+// CHECK: store {{.*}} !tbaa !0
+// CHECK: !0 = metadata !{metadata !"vtable pointer", metadata !1}
+// CHECK: !1 = metadata !{metadata !"Simple C/C++ TBAA", null}