aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/ms-inline-asm.cpp
blob: 3e445b80f8874f1ceb6d72ce43e86e72ac32ac7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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();
}