hans added inline comments.

================
Comment at: clang/lib/Driver/Driver.cpp:2416
   }
+  if (Inputs.size() == InputsBeforeOptX && InputTypeArg != nullptr)
+    Diag(diag::warn_drv_ignored_option_x) << InputTypeArg->getValue(0);
----------------
Could we end up here in clang-cl mode with InputTypeArg pointing to a '/TC' or 
'/TP' option? (Set near the top of the function.) In that case, emitting a 
diagnostic that talks about -x would be misleading.

What if you initialized InputsBeforeOptX to a sentinel value instead (e.g. 
SIZE_MAX)? Could the if statement then be simplified to just

```
if (Inputs.size() == InputsBeforeX)
```

?


================
Comment at: clang/test/Driver/redundant-args.c:2
+// RUN: %clang -target x86_64-apple-darwin10 -Werror -x c -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin10 %s -### -x c 2>&1 | FileCheck %s
+
----------------
These two lines seem to test pretty different things (and I find the first test 
a bit confusing). Maybe there's a better test to add the new warning to, or it 
could go in its own file?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116395

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

Reply via email to