summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakuto Ikuta <takuto.ikuta@gmail.com>2018-11-09 13:25:45 +0000
committerTakuto Ikuta <takuto.ikuta@gmail.com>2018-11-09 13:25:45 +0000
commit7bd78fc1968f251a744f84163692c90423b3d15f (patch)
tree6d3e6f2ed34c7144e895ea64bb2417dfa8726ce0
parentea51f98b9b592d757dc9141674a09b91c38b8b7d (diff)
downloadbcm5719-llvm-7bd78fc1968f251a744f84163692c90423b3d15f.tar.gz
bcm5719-llvm-7bd78fc1968f251a744f84163692c90423b3d15f.zip
[clang-cl] Add warning for /Zc:dllexportInlines- when the flag is used with /fallback
Summary: This is followup of https://reviews.llvm.org/D51340 Reviewers: hans, thakis Reviewed By: hans Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54298 llvm-svn: 346491
-rw-r--r--clang/include/clang/Basic/DiagnosticDriverKinds.td4
-rw-r--r--clang/lib/Driver/ToolChains/MSVC.cpp6
-rw-r--r--clang/test/Driver/cl-options.c2
3 files changed, 12 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 44c9121f7b1..357b739d4ce 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -161,6 +161,10 @@ 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_invalid_value : Error<"invalid value '%1' in '%0'">;
def err_drv_invalid_int_value : Error<"invalid integral value '%1' in '%0'">;
def err_drv_invalid_remap_file : Error<
diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index 839f3136230..ac68db602f8 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -669,6 +669,12 @@ 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/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index aa97c1eb888..12409431726 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -494,6 +494,8 @@
// NoDllExportInlines: "-fno-dllexport-inlines"
// 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]
// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
// Zi: "-gcodeview"
OpenPOWER on IntegriCloud