aaron.ballman added a comment.

In D147073#4261633 <https://reviews.llvm.org/D147073#4261633>, @zequanwu wrote:

> In D147073#4258981 <https://reviews.llvm.org/D147073#4258981>, @aaron.ballman 
> wrote:
>
>> Perhaps a way to split the middle would be to assert that the source 
>> locations are valid in coverage mapping, but then do the right thing in 
>> non-asserts builds instead of crashing. This way, we don't lose the benefit 
>> of knowing the issues happen in development builds, but we don't punish 
>> users of coverage mapping with the released product. WDYT?
>
> Won't this still cause assertion failure on assert builds?

Yes, it will, but that's the goal in this case. I think we want the loud 
failure to tell us when we've

> I don't quite understand "do the right thing in non-asserts builds instead of 
> crashing".

For example:

  // If either of these locations is invalid, something elsewhere in the 
compiler has broken...
  assert(StartLoc && StartLoc->isInvalid() && "Start location is not valid");
  assert(EndLoc && EndLoc->isInvalid() && "End location is not valid");
  
  // ... however, we can still recover without crashing.
  if (StartLoc && StartLoc->isInvalid())
    StartLoc = std::nullopt;
  if (EndLoc && EndLoc->isInvalid())
    EndLoc = std::nullopt;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147073

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

Reply via email to