r257040 - Make sure we claim arguments that are going to be passed to a gcc tool,

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 7 01:03:42 PST 2016


Author: echristo
Date: Thu Jan  7 03:03:42 2016
New Revision: 257040

URL: http://llvm.org/viewvc/llvm-project?rev=257040&view=rev
Log:
Make sure we claim arguments that are going to be passed to a gcc tool,
even if they're not going to be used to avoid unused option warnings.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/fortran.f95

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=257040&r1=257039&r2=257040&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan  7 03:03:42 2016
@@ -6095,6 +6095,12 @@ void gcc::Common::ConstructJob(Compilati
 
   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(Compilati
           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);
     }
   }

Modified: cfe/trunk/test/Driver/fortran.f95
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fortran.f95?rev=257040&r1=257039&r2=257040&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fortran.f95 (original)
+++ cfe/trunk/test/Driver/fortran.f95 Thu Jan  7 03:03:42 2016
@@ -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"




More information about the cfe-commits mailing list