[clang-tools-extra] r342227 - [clangd] NFC: Fix IndexBenchmark CLI arguments handling

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 05:46:00 PDT 2018


On Fri, Sep 14, 2018 at 3:21 PM, Kirill Bobyrev via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: omtcyfz
> Date: Fri Sep 14 05:21:09 2018
> New Revision: 342227
>
> URL: http://llvm.org/viewvc/llvm-project?rev=342227&view=rev
> Log:
> [clangd] NFC: Fix IndexBenchmark CLI arguments handling
>
> Modified:
>     clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
>
> Modified: clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp?rev=342227&r1=342226&r2=342227&view=diff
> ==============================================================================
> --- clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp (original)
> +++ clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp Fri Sep 14 05:21:09 2018
> @@ -101,9 +101,11 @@ int main(int argc, char *argv[]) {
>    }

>    IndexFilename = argv[1];
>    RequestsFilename = argv[2];
> -  // Trim first two arguments of the benchmark invocation.
> -  argv += 3;
> -  argc -= 3;
> +  // Trim first two arguments of the benchmark invocation and pretend no
> +  // arguments were passed in the first place.
> +  argv[2] = argv[0];
> +  argv += 2;
> +  argc -= 2;
>    ::benchmark::Initialize(&argc, argv);
Passing-by thought: why is this being done in *this* order?
Why not first let the ::benchmark::Initialize() consume it's flags first?

>    ::benchmark::RunSpecifiedBenchmarks();
>  }
>
Roman.

> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list