[PATCH] D19725: [Coverage] Fix an issue where a coverage region might not be created for a macro containing for or while statements.

Igor Kudrin via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 06:13:18 PDT 2016


Thank you!

On 02.05.2016 06:40, Justin Bogner wrote:
> Igor Kudrin <ikudrin.dev at gmail.com> writes:
>   
> +  /// \brief Check whether a region with bounds \c StartLoc and \c EndLoc
> +  /// is already added to \c SourceRegions.
> +  bool isRegionAlreadyAdded(SourceLocation StartLoc, SourceLocation EndLoc) {
> +    return SourceRegions.rend() !=
> +           std::find_if(SourceRegions.rbegin(), SourceRegions.rend(),
> Any particular reason for rbegin/rend? I guess you expect the match to
> be near the end of the list when it exists?

Yes, exactly. I suppose that if that region exists, it's probably added 
recently.
>> +                        [=](const SourceMappingRegion &Region) {
> There's no good reason to capture by value here. Best to use [&] for
> efficiency.

OK.



More information about the cfe-commits mailing list