summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/ms-inline-asm-fields.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-08-26 21:57:20 +0000
committerReid Kleckner <rnk@google.com>2015-08-26 21:57:20 +0000
commit14e96b49302ba90b50078b6a9f48248ab79dd0d3 (patch)
tree316752ba25d92a48efa5d34d513de9806206278a /clang/test/CodeGenCXX/ms-inline-asm-fields.cpp
parent06c199ac9dde91cdebbf7e3899d773db797b0fdb (diff)
downloadbcm5719-llvm-14e96b49302ba90b50078b6a9f48248ab79dd0d3.tar.gz
bcm5719-llvm-14e96b49302ba90b50078b6a9f48248ab79dd0d3.zip
[ms-inline-asm] Add field access to MS inline asm identifier lookup
Now we can parse code like this: struct A { int field; }; int f(A o) { __asm mov eax, o.field } Fixes PR19117. llvm-svn: 246088
Diffstat (limited to 'clang/test/CodeGenCXX/ms-inline-asm-fields.cpp')
-rw-r--r--clang/test/CodeGenCXX/ms-inline-asm-fields.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/ms-inline-asm-fields.cpp b/clang/test/CodeGenCXX/ms-inline-asm-fields.cpp
new file mode 100644
index 00000000000..a78d511485a
--- /dev/null
+++ b/clang/test/CodeGenCXX/ms-inline-asm-fields.cpp
@@ -0,0 +1,31 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
+
+struct A {
+ int a1;
+ int a2;
+ struct B {
+ int b1;
+ int b2;
+ } a3;
+};
+
+namespace asdf {
+A a_global;
+}
+
+extern "C" int test_param_field(A p) {
+// CHECK: define i32 @test_param_field(%struct.A* byval align 4 %p)
+// CHECK: getelementptr inbounds %struct.A, %struct.A* %p, i32 0, i32 0
+// CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $1"
+// CHECK: ret i32
+ __asm mov eax, p.a1
+}
+
+extern "C" int test_namespace_global() {
+// CHECK: define i32 @test_namespace_global()
+// CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $1", "{{.*}}"(i32* getelementptr inbounds (%struct.A, %struct.A* @_ZN4asdf8a_globalE, i32 0, i32 2, i32 1))
+// CHECK: ret i32
+ __asm mov eax, asdf::a_global.a3.b2
+}
+
OpenPOWER on IntegriCloud