aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakuto Ikuta <takuto.ikuta@gmail.com>2018-11-13 04:14:09 +0000
committerTakuto Ikuta <takuto.ikuta@gmail.com>2018-11-13 04:14:09 +0000
commitcc778d129b7cdecf1ee316e706dbd5c62c0e7903 (patch)
tree92994b27527cdd867386ac3b9ef95a74b1528376
parent8a80a605c320406422d3e58bc873793d961cc187 (diff)
downloadclang-linaro-local/diana.picus/a.tar.gz
[clang-cl] Do not allow using both /Zc:dllexportInlines- and /fallback flaglinaro-local/diana.picus/a
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346733 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticDriverKinds.td5
-rw-r--r--lib/Driver/ToolChains/Clang.cpp7
-rw-r--r--lib/Driver/ToolChains/MSVC.cpp6
-rw-r--r--test/Driver/cl-options.c2
4 files changed, 9 insertions, 11 deletions
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index 357b739d4c..5d4a2264e7 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -161,9 +161,8 @@ def warn_drv_yc_multiple_inputs_clang_cl : Warning<
"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'">;
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
index c35f7a9405..8de20f6e2e 100644
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -5502,8 +5502,13 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
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);
diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp
index ac68db602f..839f313623 100644
--- a/lib/Driver/ToolChains/MSVC.cpp
+++ b/lib/Driver/ToolChains/MSVC.cpp
@@ -669,12 +669,6 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand(
// 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];
diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c
index 1240943172..f5171d5c04 100644
--- a/test/Driver/cl-options.c
+++ b/test/Driver/cl-options.c
@@ -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"