[clang] [clang-scan-deps] Don't inspect Args[0] as an option (PR #109050)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 15:39:15 PDT 2024


================
@@ -839,9 +839,11 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) {
           auto R = std::make_reverse_iterator(FlagsEnd);
           for (auto I = R, E = Args.rend(); I != E; ++I) {
             StringRef Arg = *I;
+            if ((I + 1) == E) // Don't inspect Args[0] as an option.
+              break;
----------------
jansvoboda11 wrote:

Why not adjust `E` in the loop header instead of checking this on each iteration?

https://github.com/llvm/llvm-project/pull/109050


More information about the cfe-commits mailing list