forked from OSchip/llvm-project
parent
6ddb6b1a9a
commit
c97a6bbfd8
|
@ -1658,7 +1658,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
|
|||
SourceLocation EndLoc = AsmLoc;
|
||||
SmallVector<Token, 4> AsmToks;
|
||||
SmallVector<unsigned, 4> LineEnds;
|
||||
do {
|
||||
|
||||
bool InBraces = false;
|
||||
unsigned short savedBraceCount = 0;
|
||||
bool InAsmComment = false;
|
||||
|
@ -1688,7 +1688,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
|
|||
break;
|
||||
|
||||
// The asm keyword is a statement separator, so multiple asm statements
|
||||
// are allowed.
|
||||
// are allowed on a single line.
|
||||
if (!InAsmComment && Tok.is(tok::kw_asm))
|
||||
break;
|
||||
|
||||
|
@ -1753,12 +1753,6 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
|
|||
Diag(Tok, diag::err_expected_lbrace);
|
||||
return StmtError();
|
||||
}
|
||||
// Multiple adjacent asm's form together into a single asm statement
|
||||
// in the AST.
|
||||
if (!Tok.is(tok::kw_asm))
|
||||
break;
|
||||
EndLoc = ConsumeToken();
|
||||
} while (1);
|
||||
|
||||
// FIXME: We should be passing source locations for better diagnostics.
|
||||
return Actions.ActOnMSAsmStmt(AsmLoc, llvm::makeArrayRef(AsmToks),
|
||||
|
|
|
@ -9,7 +9,9 @@ void t1() {
|
|||
|
||||
void t2() {
|
||||
// CHECK: @t2
|
||||
// CHECK: call void asm sideeffect "nop\0Anop\0Anop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: ret void
|
||||
__asm nop
|
||||
__asm nop
|
||||
|
@ -18,14 +20,17 @@ void t2() {
|
|||
|
||||
void t3() {
|
||||
// CHECK: @t3
|
||||
// CHECK: call void asm sideeffect "nop\0Anop\0Anop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: ret void
|
||||
__asm nop __asm nop __asm nop
|
||||
}
|
||||
|
||||
void t4(void) {
|
||||
// CHECK: @t4
|
||||
// CHECK: call void asm sideeffect "mov ebx, eax\0Amov ecx, ebx", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "mov ebx, eax", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "mov ecx, ebx", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: ret void
|
||||
__asm mov ebx, eax
|
||||
__asm mov ecx, ebx
|
||||
|
@ -33,8 +38,8 @@ void t4(void) {
|
|||
|
||||
void t5(void) {
|
||||
// CHECK: @t5
|
||||
// CHECK: call void asm sideeffect "mov ebx, eax\0Amov ecx, ebx", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "mov ebx, eax", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: call void asm sideeffect "mov ecx, ebx", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
||||
// CHECK: ret void
|
||||
__asm mov ebx, eax __asm mov ecx, ebx
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ void t5() {
|
|||
__asm { // expected-warning {{MS-style inline assembly is not supported}}
|
||||
int 0x2c ; } asm comments are fun! }{
|
||||
}
|
||||
__asm {} // no warning as this gets merged with the previous inline asm
|
||||
__asm {} // expected-warning {{MS-style inline assembly is not supported}}
|
||||
}
|
||||
int t6() {
|
||||
__asm int 3 ; } comments for single-line asm // expected-warning {{MS-style inline assembly is not supported}}
|
||||
__asm {} // no warning as this gets merged with the previous inline asm
|
||||
__asm {} // expected-warning {{MS-style inline assembly is not supported}}
|
||||
|
||||
__asm int 4 // no warning as this gets merged with the previous inline asm
|
||||
__asm int 4 // expected-warning {{MS-style inline assembly is not supported}}
|
||||
return 10;
|
||||
}
|
||||
int t7() {
|
||||
|
@ -28,10 +28,10 @@ int t7() {
|
|||
}
|
||||
}
|
||||
void t8() {
|
||||
__asm nop __asm nop __asm nop // expected-warning {{MS-style inline assembly is not supported}}
|
||||
__asm nop __asm nop __asm nop // expected-warning {{MS-style inline assembly is not supported}} expected-warning {{MS-style inline assembly is not supported}} expected-warning {{MS-style inline assembly is not supported}}
|
||||
}
|
||||
void t9() {
|
||||
__asm nop __asm nop ; __asm nop // expected-warning {{MS-style inline assembly is not supported}}
|
||||
__asm nop __asm nop ; __asm nop // expected-warning {{MS-style inline assembly is not supported}} expected-warning {{MS-style inline assembly is not supported}}
|
||||
}
|
||||
int t_fail() { // expected-note {{to match this}}
|
||||
__asm
|
||||
|
|
Loading…
Reference in New Issue