shenhan updated this revision to Diff 553219. Repository: rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158755/new/ https://reviews.llvm.org/D158755 Files: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/fsplit-machine-functions.c Index: clang/test/Driver/fsplit-machine-functions.c =================================================================== --- clang/test/Driver/fsplit-machine-functions.c +++ clang/test/Driver/fsplit-machine-functions.c @@ -15,6 +15,10 @@ // RUN: not %clang -### -c --target=arm-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR // ERR: error: unsupported option '-fsplit-machine-functions' for target -/// FIXME -// RUN: not %clang -### -c --target=arm-unknown-linux -fsplit-machine-functions -fno-split-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR2 -// ERR2: error: unsupported option '-fno-split-machine-functions' for target +// RUN: not %clang -### -x cuda -S -nocudainc -nocudalib -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR2 +// ERR2: clang: error: unsupported option '-fsplit-machine-functions' for target + +// The following all run successfully. +// RUN: %clang -### -x cuda -S -nocudainc -nocudalib -fsplit-machine-functions -Xarch_device -fno-split-machine-functions %s +// RUN: %clang -### -x cuda -S -nocudainc -nocudalib -Xarch_host -fsplit-machine-functions %s +// RUN: %clang -### --target=arm-unknown-linux -fsplit-machine-functions -fno-split-machine-functions %s Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -5872,13 +5872,13 @@ if (Arg *A = Args.getLastArg(options::OPT_fsplit_machine_functions, options::OPT_fno_split_machine_functions)) { - // This codegen pass is only available on x86-elf targets. - if (Triple.isX86() && Triple.isOSBinFormatELF()) { - if (A->getOption().matches(options::OPT_fsplit_machine_functions)) + if (!A->getOption().matches(options::OPT_fno_split_machine_functions)) { + // This codegen pass is only available on x86-elf targets. + if (Triple.isX86() && Triple.isOSBinFormatELF()) A->render(Args, CmdArgs); - } else { - D.Diag(diag::err_drv_unsupported_opt_for_target) - << A->getAsString(Args) << TripleStr; + else + D.Diag(diag::err_drv_unsupported_opt_for_target) + << A->getAsString(Args) << TripleStr; } }
Index: clang/test/Driver/fsplit-machine-functions.c =================================================================== --- clang/test/Driver/fsplit-machine-functions.c +++ clang/test/Driver/fsplit-machine-functions.c @@ -15,6 +15,10 @@ // RUN: not %clang -### -c --target=arm-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR // ERR: error: unsupported option '-fsplit-machine-functions' for target -/// FIXME -// RUN: not %clang -### -c --target=arm-unknown-linux -fsplit-machine-functions -fno-split-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR2 -// ERR2: error: unsupported option '-fno-split-machine-functions' for target +// RUN: not %clang -### -x cuda -S -nocudainc -nocudalib -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefix=ERR2 +// ERR2: clang: error: unsupported option '-fsplit-machine-functions' for target + +// The following all run successfully. +// RUN: %clang -### -x cuda -S -nocudainc -nocudalib -fsplit-machine-functions -Xarch_device -fno-split-machine-functions %s +// RUN: %clang -### -x cuda -S -nocudainc -nocudalib -Xarch_host -fsplit-machine-functions %s +// RUN: %clang -### --target=arm-unknown-linux -fsplit-machine-functions -fno-split-machine-functions %s Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -5872,13 +5872,13 @@ if (Arg *A = Args.getLastArg(options::OPT_fsplit_machine_functions, options::OPT_fno_split_machine_functions)) { - // This codegen pass is only available on x86-elf targets. - if (Triple.isX86() && Triple.isOSBinFormatELF()) { - if (A->getOption().matches(options::OPT_fsplit_machine_functions)) + if (!A->getOption().matches(options::OPT_fno_split_machine_functions)) { + // This codegen pass is only available on x86-elf targets. + if (Triple.isX86() && Triple.isOSBinFormatELF()) A->render(Args, CmdArgs); - } else { - D.Diag(diag::err_drv_unsupported_opt_for_target) - << A->getAsString(Args) << TripleStr; + else + D.Diag(diag::err_drv_unsupported_opt_for_target) + << A->getAsString(Args) << TripleStr; } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits