Author: tikuta Date: Mon Nov 12 20:14:09 2018 New Revision: 346733 URL: http://llvm.org/viewvc/llvm-project?rev=346733&view=rev Log: [clang-cl] Do not allow using both /Zc:dllexportInlines- and /fallback flag
Summary: /Zc:dllexportInlines with /fallback may cause unexpected linker error. It is better to disallow compile rather than warn for this combination. Reviewers: hans, thakis Reviewed By: hans Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54426 Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/MSVC.cpp cfe/trunk/test/Driver/cl-options.c Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=346733&r1=346732&r2=346733&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Nov 12 20:14:09 2018 @@ -161,9 +161,8 @@ def warn_drv_yc_multiple_inputs_clang_cl "support for '/Yc' with more than one source file not implemented yet; flag ignored">, InGroup<ClangClPch>; -def warn_drv_non_fallback_argument_clang_cl : Warning< - "option '%0' is ignored when /fallback happens">, - InGroup<OptionIgnored>; +def err_drv_dllexport_inlines_and_fallback : Error< + "option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback'">; def err_drv_invalid_value : Error<"invalid value '%1' in '%0'">; def err_drv_invalid_int_value : Error<"invalid integral value '%1' in '%0'">; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=346733&r1=346732&r2=346733&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Nov 12 20:14:09 2018 @@ -5502,8 +5502,13 @@ void Clang::AddClangCLArgs(const ArgList if (Args.hasFlag(options::OPT__SLASH_Zc_dllexportInlines_, options::OPT__SLASH_Zc_dllexportInlines, - false)) + false)) { + if (Args.hasArg(options::OPT__SLASH_fallback)) { + D.Diag(clang::diag::err_drv_dllexport_inlines_and_fallback); + } else { CmdArgs.push_back("-fno-dllexport-inlines"); + } + } Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg); Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb); Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=346733&r1=346732&r2=346733&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Mon Nov 12 20:14:09 2018 @@ -669,12 +669,6 @@ std::unique_ptr<Command> visualstudio::C // them too. Args.AddAllArgs(CmdArgs, options::OPT_UNKNOWN); - // Warning for ignored flag. - if (const Arg *dllexportInlines = - Args.getLastArg(options::OPT__SLASH_Zc_dllexportInlines_)) - C.getDriver().Diag(clang::diag::warn_drv_non_fallback_argument_clang_cl) - << dllexportInlines->getAsString(Args); - // Input filename. assert(Inputs.size() == 1); const InputInfo &II = Inputs[0]; Modified: cfe/trunk/test/Driver/cl-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=346733&r1=346732&r2=346733&view=diff ============================================================================== --- cfe/trunk/test/Driver/cl-options.c (original) +++ cfe/trunk/test/Driver/cl-options.c Mon Nov 12 20:14:09 2018 @@ -495,7 +495,7 @@ // RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s // DllExportInlines-NOT: "-fno-dllexport-inlines" // RUN: %clang_cl /fallback /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlinesFallback %s -// DllExportInlinesFallback: warning: option '/Zc:dllexportInlines-' is ignored when /fallback happens [-Woption-ignored] +// DllExportInlinesFallback: error: option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback' // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits