2013-12-04 11:41:33 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2013-01-23 03:38:32 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fasm-blocks -Wno-microsoft -verify -fsyntax-only
|
2012-09-25 03:57:59 +08:00
|
|
|
|
|
|
|
void t1(void) {
|
2012-10-23 10:43:30 +08:00
|
|
|
__asm __asm // expected-error {{__asm used with no assembly instructions}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f() {
|
2012-10-27 02:33:59 +08:00
|
|
|
int foo;
|
2012-10-23 10:43:30 +08:00
|
|
|
__asm {
|
|
|
|
mov eax, eax
|
|
|
|
.unknowndirective // expected-error {{unknown directive}}
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
__asm {
|
2013-12-01 19:48:10 +08:00
|
|
|
mov eax, 1+=2 // expected-error {{unknown token in expression}}
|
2012-10-23 10:43:30 +08:00
|
|
|
}
|
|
|
|
f();
|
|
|
|
__asm {
|
2013-12-01 19:48:10 +08:00
|
|
|
mov eax, 1+++ // expected-error {{unknown token in expression}}
|
2012-10-23 10:43:30 +08:00
|
|
|
}
|
2013-01-18 08:51:29 +08:00
|
|
|
f();
|
|
|
|
__asm {
|
2013-12-01 19:48:10 +08:00
|
|
|
mov eax, LENGTH bar // expected-error {{unable to lookup expression}}
|
2013-01-18 08:51:29 +08:00
|
|
|
}
|
|
|
|
f();
|
|
|
|
__asm {
|
2013-12-01 19:48:10 +08:00
|
|
|
mov eax, SIZE bar // expected-error {{unable to lookup expression}}
|
2013-01-18 08:51:29 +08:00
|
|
|
}
|
|
|
|
f();
|
|
|
|
__asm {
|
2013-12-01 19:48:10 +08:00
|
|
|
mov eax, TYPE bar // expected-error {{unable to lookup expression}}
|
2013-01-18 08:51:29 +08:00
|
|
|
}
|
2012-09-25 03:57:59 +08:00
|
|
|
}
|
2013-12-03 08:48:09 +08:00
|
|
|
|
|
|
|
void rdar15318432(void) {
|
|
|
|
// We used to crash on this. When LLVM called back to Clang to parse a name
|
|
|
|
// and do name lookup, if parsing failed, we did not restore the lexer state
|
|
|
|
// properly.
|
|
|
|
|
|
|
|
// expected-error@+2 {{expected identifier}}
|
|
|
|
__asm {
|
|
|
|
and ecx, ~15
|
|
|
|
}
|
|
|
|
|
|
|
|
int x = 0;
|
|
|
|
// expected-error@+3 {{expected identifier}}
|
|
|
|
__asm {
|
|
|
|
and ecx, x
|
|
|
|
and ecx, ~15
|
|
|
|
}
|
|
|
|
}
|