<div dir="ltr">Thanks!<div><br></div><div style>For some reason our cpplint does not catch it (it does catch simpler variants in the same file). </div><div style><div>% cat check.cc </div><div>void foo() {</div><div>  CHECK(0 == m->a);         // Detected.</div>
<div>  CHECK(FOO_BAR == 0);      // Detected.</div><div>  CHECK(FOO_BAR == m->a);   // Missed.</div><div>}</div><div>% cpplint.py --filter=-legal check.cc</div><div>check.cc:2:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]</div>
<div>check.cc:3:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]</div><div>Done processing check.cc</div><div>Total errors found: 2</div><div>% </div><div><br></div></div><div style><br></div><div style>
<br></div><div style>Oh, how I wish to have lint integrated with clang!! </div><div style><br></div><div style>--kcc</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, May 18, 2013 at 10:27 PM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: timurrrr<br>
Date: Sat May 18 13:27:33 2013<br>
New Revision: 182198<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=182198&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=182198&view=rev</a><br>
Log:<br>
Replace CHECK(a == b); with CHECK_EQ(a, b); throughout asan_allocator2.cc<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
<br>
Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=182198&r1=182197&r2=182198&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=182198&r1=182197&r2=182198&view=diff</a><br>

==============================================================================<br>
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)<br>
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Sat May 18 13:27:33 2013<br>
@@ -260,7 +260,7 @@ struct QuarantineCallback {<br>
   }<br>
<br>
   void Recycle(AsanChunk *m) {<br>
-    CHECK(m->chunk_state == CHUNK_QUARANTINE);<br>
+    CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE);<br>
     m->chunk_state = CHUNK_AVAILABLE;<br>
     CHECK_NE(m->alloc_tid, kInvalidTid);<br>
     CHECK_NE(m->free_tid, kInvalidTid);<br>
@@ -454,7 +454,7 @@ static void Deallocate(void *ptr, StackT<br>
     m->free_context_id = 0;<br>
     StackTrace::CompressStack(stack, m->FreeStackBeg(), m->FreeStackSize());<br>
   }<br>
-  CHECK(m->chunk_state == CHUNK_QUARANTINE);<br>
+  CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE);<br>
   // Poison the region.<br>
   PoisonShadow(m->Beg(),<br>
                RoundUpTo(m->UsedSize(), SHADOW_GRANULARITY),<br>
@@ -488,7 +488,7 @@ static void *Reallocate(void *old_ptr, u<br>
   thread_stats.reallocs++;<br>
   thread_stats.realloced += new_size;<br>
<br>
-  CHECK(m->chunk_state == CHUNK_ALLOCATED);<br>
+  CHECK_EQ(m->chunk_state, CHUNK_ALLOCATED);<br>
   uptr old_size = m->UsedSize();<br>
   uptr memcpy_size = Min(new_size, old_size);<br>
   void *new_ptr = Allocate(new_size, 8, stack, FROM_MALLOC, true);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>