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

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 18 12:09:07 PDT 2018


Hi Roman,

Is there any benefit of doing so? Also, I’m not sure whether I understood you correctly. Consuming benchmark options *before* trimming would probably not be the desired behaviour since the first two arguments arguments are passed directly to the tool driver.

I might have misunderstood you, could you please elaborate on the proposed idea?

Kind regards,
Kirill

> On 14 Sep 2018, at 14:46, Roman Lebedev <lebedev.ri at gmail.com> wrote:
> 
> 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