clang/Driver: [PR12920] Don't forward any -W arguments to gcc-as and gcc-ld.

AFAIK, there are no -W options for gcc-as and gcc-ld.
It caused failure to build clang with gcc-4.7 on cygwin.

FIXME: Could we recategorize Options for gcc-as and gcc-ld?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188668 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index ad004ba..3257946 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -3906,6 +3906,11 @@
           A->getOption().matches(options::OPT_g_Group))
         continue;
 
+      // Don't forward any -W arguments to assembly and link steps.
+      if ((isa<AssembleJobAction>(JA) || isa<LinkJobAction>(JA)) &&
+          A->getOption().matches(options::OPT_W_Group))
+        continue;
+
       // It is unfortunate that we have to claim here, as this means
       // we will basically never report anything interesting for
       // platforms using a generic gcc, even if we are just using gcc