forked from OSchip/llvm-project
[driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag. rdar://12808010 llvm-svn: 169422
This commit is contained in:
parent
79e68bcf0e
commit
c8e56e8931
clang
include/clang
lib
test
|
@ -45,6 +45,7 @@ LANGOPT(C99 , 1, 0, "C99")
|
|||
LANGOPT(C11 , 1, 0, "C11")
|
||||
LANGOPT(MicrosoftExt , 1, 0, "Microsoft extensions")
|
||||
LANGOPT(MicrosoftMode , 1, 0, "Microsoft compatibility mode")
|
||||
LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks")
|
||||
LANGOPT(Borland , 1, 0, "Borland extensions")
|
||||
LANGOPT(CPlusPlus , 1, 0, "C++")
|
||||
LANGOPT(CPlusPlus0x , 1, 0, "C++0x")
|
||||
|
|
|
@ -300,7 +300,7 @@ def fthread_sanitizer : Flag<["-"], "fthread-sanitizer">, Group<f_Group>;
|
|||
def fno_thread_sanitizer : Flag<["-"], "fno-thread-sanitizer">, Group<f_Group>;
|
||||
def fasm : Flag<["-"], "fasm">, Group<f_Group>;
|
||||
|
||||
def fasm_blocks : Flag<["-"], "fasm-blocks">, Group<f_Group>;
|
||||
def fasm_blocks : Flag<["-"], "fasm-blocks">, Group<f_Group>, Flags<[CC1Option]>;
|
||||
def fno_asm_blocks : Flag<["-"], "fno-asm-blocks">, Group<f_Group>;
|
||||
|
||||
def fassume_sane_operator_new : Flag<["-"], "fassume-sane-operator-new">, Group<f_Group>;
|
||||
|
|
|
@ -2942,9 +2942,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back("-fno-spell-checking");
|
||||
|
||||
|
||||
// Silently ignore -fasm-blocks for now.
|
||||
(void) Args.hasFlag(options::OPT_fasm_blocks, options::OPT_fno_asm_blocks,
|
||||
false);
|
||||
// -fno-asm-blocks is default.
|
||||
if (Args.hasFlag(options::OPT_fasm_blocks, options::OPT_fno_asm_blocks,
|
||||
false))
|
||||
CmdArgs.push_back("-fasm-blocks");
|
||||
|
||||
if (Arg *A = Args.getLastArg(options::OPT_fshow_overloads_EQ))
|
||||
A->render(Args, CmdArgs);
|
||||
|
|
|
@ -1172,6 +1172,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.MicrosoftExt
|
||||
= Args.hasArg(OPT_fms_extensions) || Args.hasArg(OPT_fms_compatibility);
|
||||
Opts.MicrosoftMode = Args.hasArg(OPT_fms_compatibility);
|
||||
Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks);
|
||||
Opts.MSCVersion = Args.getLastArgIntValue(OPT_fmsc_version, 0, Diags);
|
||||
Opts.Borland = Args.hasArg(OPT_fborland_extensions);
|
||||
Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
|
||||
|
|
|
@ -1820,7 +1820,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
|
|||
assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
|
||||
SourceLocation AsmLoc = ConsumeToken();
|
||||
|
||||
if (getLangOpts().MicrosoftExt && Tok.isNot(tok::l_paren) &&
|
||||
if (getLangOpts().AsmBlocks && Tok.isNot(tok::l_paren) &&
|
||||
!isTypeQualifier()) {
|
||||
msAsm = true;
|
||||
return ParseMicrosoftAsmStatement(AsmLoc);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: x86-64-registered-target
|
||||
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O0 -fms-extensions -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O0 -fasm-blocks -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void t1() {
|
||||
int var = 10;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: x86-64-registered-target
|
||||
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -O0 -fms-extensions -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -O0 -fasm-blocks -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void t1() {
|
||||
// CHECK: @t1
|
||||
|
@ -201,7 +201,6 @@ void t20() {
|
|||
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
|
||||
}
|
||||
|
||||
|
||||
void t21() {
|
||||
__asm {
|
||||
__asm push ebx
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang -target x86_64-apple-darwin10 \
|
||||
// RUN: -### -fsyntax-only -fasm-blocks %s 2> %t
|
||||
// RUN: FileCheck --check-prefix=CHECK-BLOCKS < %t %s
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin10 \
|
||||
// RUN: -### -fsyntax-only -fno-asm-blocks -fasm-blocks %s 2> %t
|
||||
// RUN: FileCheck --check-prefix=CHECK-BLOCKS < %t %s
|
||||
|
||||
// CHECK-BLOCKS: "-fasm-blocks"
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin10 \
|
||||
// RUN: -### -fsyntax-only -fasm-blocks -fno-asm-blocks %s 2> %t
|
||||
// RUN: FileCheck --check-prefix=CHECK-NO-BLOCKS < %t %s
|
||||
|
||||
// CHECK-NO-BLOCKS-NOT: "-fasm-blocks"
|
|
@ -18,15 +18,6 @@ void * __ptr32 PtrToPtr32(const void *p)
|
|||
return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p );
|
||||
}
|
||||
|
||||
void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
|
||||
{
|
||||
__asm { // expected-warning {{MS-style inline assembly is not supported}}
|
||||
mov eax, Bit
|
||||
mov ecx, Base
|
||||
lock bts [ecx], eax
|
||||
setc al
|
||||
};
|
||||
}
|
||||
_inline int foo99() { return 99; }
|
||||
|
||||
void test_ms_alignof_alias() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -verify -fms-extensions
|
||||
// RUN: %clang_cc1 %s -verify -fasm-blocks
|
||||
|
||||
#define M __asm int 0x2c
|
||||
#define M2 int
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// REQUIRES: x86-64-registered-target
|
||||
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fms-extensions -fenable-experimental-ms-inline-asm -Wno-microsoft -verify -fsyntax-only
|
||||
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fasm-blocks -fenable-experimental-ms-inline-asm -Wno-microsoft -verify -fsyntax-only
|
||||
|
||||
void t1(void) {
|
||||
__asm __asm // expected-error {{__asm used with no assembly instructions}}
|
||||
|
|
Loading…
Reference in New Issue