]> granicus.if.org Git - clang/commitdiff
Make sure we claim arguments that are going to be passed to a gcc tool,
authorEric Christopher <echristo@gmail.com>
Thu, 7 Jan 2016 09:03:42 +0000 (09:03 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 7 Jan 2016 09:03:42 +0000 (09:03 +0000)
even if they're not going to be used to avoid unused option warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257040 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/fortran.f95

index 69a41d0ef33ee73ec31dd0fddf45c177bbb1b106..ec7db3d6f8a5e6470dd7d8253ca655c12346ac7e 100644 (file)
@@ -6095,6 +6095,12 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
 
   for (const auto &A : Args) {
     if (forwardToGCC(A->getOption())) {
+      // 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
+      // to get to the assembler.
+      A->claim();
+
       // Don't forward any -g arguments to assembly steps.
       if (isa<AssembleJobAction>(JA) &&
           A->getOption().matches(options::OPT_g_Group))
@@ -6105,11 +6111,6 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &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
-      // to get to the assembler.
-      A->claim();
       A->render(Args, CmdArgs);
     }
   }
index 982f4eb5e6dfa8707d35e21d2d4217a56c839dbe..47c6e7b50c959d4144483f4c081f489434415587 100644 (file)
@@ -13,3 +13,9 @@
 // CHECK-ASM: "-S"
 // CHECK-ASM: "-x" "f95"
 // CHECK-ASM-NOT: cc1
+
+// RUN: %clang -Wall -target x86_64-unknown-linux-gnu -integrated-as %s -o %t -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s
+// CHECK-WARN: gcc
+// CHECK-WARN-NOT: "-Wall"
+// CHECK-WARN: ld
+// CHECK-WARN-NOT: "-Wall"