paulkirth added inline comments.

================
Comment at: clang/test/Driver/clang_f_opts.c:144
+// RUN: %clang -### -S -fprofile-instr-use=%t.profdata 
-fdiagnostics-misexpect-tolerance=10 -Wmisexpect %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-MISEXPECT-TOLLERANCE
+// CHECK-MISEXPECT-TOLLERANCE-NOT: argument unused 
{{.*}}-fdiagnostics-misexpect-tolerance=
+
----------------
hans wrote:
> Instead of checking for absence of the warning, could we just check that the 
> flag is present among the cc1 flags? I think that's how most of the other 
> tests here do it.
It took me a minute to realize what you meant here. I was pretty surprised to 
find out that `"-fdiagnostics-misexpect-tolerance=10"` is how we test for 
`cc1`, but `'-fdiagnostics-misexpect-tolerance='` is a test for an 
error/warning string. The reason I wrote the check this way was so that I 
wouldn't accidentally match on the non-warning case.

TBH Ithink checking the `cc1` flags like this is pretty brittle. They would all 
silently pass (even when they shouldn't) if the warning diagnostic used `"` 
instead of `'`. I'm sure some other tests would fail/need to be changed in that 
case, but there wouldn't be any indication that these tests wouldn't be 
functioning as intended.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149206/new/

https://reviews.llvm.org/D149206

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to