[compiler-rt] r259005 - GetArgv returns null on widnows, do not crash

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 14:20:25 PST 2016


Ack... I'll  rework this code quite soon anyway (I need to pass pairs of
binaries/coverage files rather then one binary).

On Wed, Jan 27, 2016 at 10:26 PM David Blaikie <dblaikie at gmail.com> wrote:

> On Wed, Jan 27, 2016 at 4:31 PM, Mike Aizatsky via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: aizatsky
>> Date: Wed Jan 27 18:31:49 2016
>> New Revision: 259005
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=259005&view=rev
>> Log:
>> GetArgv returns null on widnows, do not crash
>>
>> Modified:
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>>
>> Modified:
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=259005&r1=259004&r2=259005&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>> Wed Jan 27 18:31:49 2016
>> @@ -811,8 +811,10 @@ void CoverageData::DumpOffsets() {
>>
>>    InternalMmapVector<char *> sancov_argv(module_name_vec.size() + 2);
>>    sancov_argv.push_back(FindPathToBinary(common_flags()->sancov_path));
>> -  sancov_argv.push_back(internal_strdup("-obj"));
>> -  sancov_argv.push_back(internal_strdup(GetArgv()[0]));
>> +  if (GetArgv() != nullptr) {
>>
>
> Perhaps:
>
> if (auto *GA = getArgv())
>   ... GA[0] ...
>
> instead?
>
>
>> +    sancov_argv.push_back(internal_strdup("-obj"));
>> +    sancov_argv.push_back(internal_strdup(GetArgv()[0]));
>> +  }
>>    sancov_argv.push_back(internal_strdup("-html-report"));
>>    auto argv_deleter = at_scope_exit([&] {
>>      for (uptr i = 0; i < sancov_argv.size(); ++i) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160128/b96a5f88/attachment-0001.html>


More information about the llvm-commits mailing list