<div dir="ltr">Decrementing "<span style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif">begin()</span>" makes sanitizer sad. This fix makes sure "I" is never decremented when it is the "begin".</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 28, 2016 at 3:10 PM Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Wed, Sep 28, 2016 at 2:58 PM Eric Liu via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ioeric<br class="gmail_msg">
Date: Wed Sep 28 07:49:14 2016<br class="gmail_msg">
New Revision: 282583<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=282583&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=282583&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Trying to buildbot failures caused by r282577.<br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">A bit more explanation of what failed, and why this fixes it, would be nice in the future :)</div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
cfe/trunk/lib/Tooling/Core/Replacement.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=282583&r1=282582&r2=282583&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=282583&r1=282582&r2=282583&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Wed Sep 28 07:49:14 2016<br class="gmail_msg">
@@ -287,8 +287,13 @@ llvm::Error Replacements::add(const Repl<br class="gmail_msg">
// with them and replace them with the merged replacements.<br class="gmail_msg">
auto MergeBegin = I;<br class="gmail_msg">
auto MergeEnd = std::next(I);<br class="gmail_msg">
- while (I-- != Replaces.begin() && Overlap(R, *I))<br class="gmail_msg">
+ while (I != Replaces.begin()) {<br class="gmail_msg">
+ --I;<br class="gmail_msg">
+ // If `I` doesn't overlap with `R`, don't merge it.<br class="gmail_msg">
+ if (!Overlap(R, *I))<br class="gmail_msg">
+ break;<br class="gmail_msg">
MergeBegin = I;<br class="gmail_msg">
+ }<br class="gmail_msg">
Replacements OverlapReplaces(MergeBegin, MergeEnd);<br class="gmail_msg">
llvm::Expected<Replacements> Merged =<br class="gmail_msg">
OverlapReplaces.mergeIfOrderIndependent(R);<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-commits mailing list<br class="gmail_msg">
<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="gmail_msg">
</blockquote></div></div></blockquote></div>