[PATCH] D11766: "Claim" the arguments belonging to 'clang_ignored_gcc_optimization_f_Group'

Douglas Katzman dougk at google.com
Wed Aug 5 11:04:32 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL244079: Claim arguments that belong to 'clang_ignored_gcc_optimization_f_Group' (authored by dougk).

Changed prior to commit:
  http://reviews.llvm.org/D11766?vs=31364&id=31377#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11766

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/clang_f_opts.c

Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -3848,6 +3848,7 @@
   for (const Arg *A :
        Args.filtered(options::OPT_clang_ignored_gcc_optimization_f_Group)) {
     D.Diag(diag::warn_ignored_gcc_optimization) << A->getAsString(Args);
+    A->claim();
   }
 
   claimNoWarnArgs(Args);
Index: cfe/trunk/test/Driver/clang_f_opts.c
===================================================================
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -412,6 +412,19 @@
 // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported
 // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported
 
+// Test that an ignored optimization argument only prints 1 warning,
+// not both a warning about not claiming the arg, *and* about not supporting
+// the arg; and that adding -Wno-ignored-optimization silences the warning.
+//
+// RUN: %clang -### -fprofile-correction %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING3 %s
+// CHECK-NO-WARNING3: optimization flag '-fprofile-correction' is not supported
+// CHECK-NO-WARNING3-NOT: argument unused
+// RUN: %clang -### -fprofile-correction -Wno-ignored-optimization-argument %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING4 %s
+// CHECK-NO-WARNING4-NOT: not supported
+// CHECK-NO-WARNING4-NOT: argument unused
+
 // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s
 // CHAR-SIGN1-NOT: -fno-signed-char
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11766.31377.patch
Type: text/x-patch
Size: 1624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150805/34c6ddcf/attachment.bin>


More information about the cfe-commits mailing list