diff options
author | Reid Kleckner <rnk@google.com> | 2015-08-26 21:57:20 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-08-26 21:57:20 +0000 |
commit | 14e96b49302ba90b50078b6a9f48248ab79dd0d3 (patch) | |
tree | 316752ba25d92a48efa5d34d513de9806206278a /clang/test/SemaCXX/ms-inline-asm.cpp | |
parent | 06c199ac9dde91cdebbf7e3899d773db797b0fdb (diff) | |
download | bcm5719-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/SemaCXX/ms-inline-asm.cpp')
-rw-r--r-- | clang/test/SemaCXX/ms-inline-asm.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/ms-inline-asm.cpp b/clang/test/SemaCXX/ms-inline-asm.cpp new file mode 100644 index 00000000000..3e445b80f88 --- /dev/null +++ b/clang/test/SemaCXX/ms-inline-asm.cpp @@ -0,0 +1,54 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -verify + +struct A { + int a1; + int a2; + struct B { + int b1; + int b2; + enum { kValue = 42 }; + } a3; + struct { + int indirect_field; + }; +}; + +namespace asdf { +A a_global; +} + +// The parser combines adjacent __asm blocks into one. Avoid that by calling +// this. +void split_inline_asm_call(); + +void test_field_lookup() { + __asm mov eax, asdf::a_global.a3.b2 + split_inline_asm_call(); + + // FIXME: These diagnostics are crap. + + // expected-error@+1 {{undeclared label}} + __asm mov eax, asdf::a_global.not_a_field.b2 + split_inline_asm_call(); + + // expected-error@+1 {{undeclared label}} + __asm mov eax, asdf::a_global.a3.not_a_field + split_inline_asm_call(); + + __asm mov eax, A::B::kValue + split_inline_asm_call(); + + // expected-error@+1 {{undeclared label}} + __asm mov eax, asdf::a_global.a3.kValue + split_inline_asm_call(); + + __asm mov eax, asdf :: a_global.a3.b2 + split_inline_asm_call(); + + __asm mov eax, asdf::a_global . a3 . b2 + split_inline_asm_call(); + + __asm mov eax, asdf::a_global.indirect_field + split_inline_asm_call(); +} |