• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -verify
3 
4 struct A {
5   int a1;
6   int a2;
7   struct B {
8     int b1;
9     int b2;
10     enum { kValue = 42 };
11   } a3;
12   struct {
13     int indirect_field;
14   };
15 };
16 
17 namespace asdf {
18 A a_global;
19 }
20 
21 // The parser combines adjacent __asm blocks into one. Avoid that by calling
22 // this.
23 void split_inline_asm_call();
24 
test_field_lookup()25 void test_field_lookup() {
26   __asm mov eax, asdf::a_global.a3.b2
27   split_inline_asm_call();
28 
29   // FIXME: These diagnostics are crap.
30 
31   // expected-error@+1 {{undeclared label}}
32   __asm mov eax, asdf::a_global.not_a_field.b2
33   split_inline_asm_call();
34 
35   // expected-error@+1 {{undeclared label}}
36   __asm mov eax, asdf::a_global.a3.not_a_field
37   split_inline_asm_call();
38 
39   __asm mov eax, A::B::kValue
40   split_inline_asm_call();
41 
42   // expected-error@+1 {{undeclared label}}
43   __asm mov eax, asdf::a_global.a3.kValue
44   split_inline_asm_call();
45 
46   __asm mov eax, asdf :: a_global.a3.b2
47   split_inline_asm_call();
48 
49   __asm mov eax, asdf::a_global . a3 . b2
50   split_inline_asm_call();
51 
52   __asm mov eax, asdf::a_global.indirect_field
53   split_inline_asm_call();
54 }
55