[compiler-rt] r334002 - [XRay][compiler-rt] Use DCHECK instead of assert(...) (NFC)

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 5 03:27:20 PDT 2018


Author: dberris
Date: Tue Jun  5 03:27:20 2018
New Revision: 334002

URL: http://llvm.org/viewvc/llvm-project?rev=334002&view=rev
Log:
[XRay][compiler-rt] Use DCHECK instead of assert(...) (NFC)

Use DCHECK instead of assert(...) in the XRay runtime.

Modified:
    compiler-rt/trunk/lib/xray/xray_fdr_logging.cc

Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=334002&r1=334001&r2=334002&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Tue Jun  5 03:27:20 2018
@@ -15,8 +15,6 @@
 //
 //===----------------------------------------------------------------------===//
 #include "xray_fdr_logging.h"
-
-#include <cassert>
 #include <errno.h>
 #include <limits>
 #include <pthread.h>
@@ -363,10 +361,10 @@ static void rewindRecentCall(uint64_t TS
   decrementExtents(FunctionRecSize);
   FunctionRecord FuncRecord;
   internal_memcpy(&FuncRecord, TLD.RecordPtr, FunctionRecSize);
-  assert(FuncRecord.RecordKind ==
+  DCHECK(FuncRecord.RecordKind ==
              uint8_t(FunctionRecord::RecordKinds::FunctionEnter) &&
          "Expected to find function entry recording when rewinding.");
-  assert(FuncRecord.FuncId == (FuncId & ~(0x0F << 28)) &&
+  DCHECK(FuncRecord.FuncId == (FuncId & ~(0x0F << 28)) &&
          "Expected matching function id when rewinding Exit");
   --TLD.NumConsecutiveFnEnters;
   LastTSC -= FuncRecord.TSCDelta;
@@ -388,7 +386,7 @@ static void rewindRecentCall(uint64_t TS
     FunctionRecord ExpectedTailExit;
     internal_memcpy(&ExpectedTailExit, RewindingRecordPtr, FunctionRecSize);
 
-    assert(ExpectedTailExit.RecordKind ==
+    DCHECK(ExpectedTailExit.RecordKind ==
                uint8_t(FunctionRecord::RecordKinds::FunctionTailExit) &&
            "Expected to find tail exit when rewinding.");
     RewindingRecordPtr -= FunctionRecSize;
@@ -396,10 +394,10 @@ static void rewindRecentCall(uint64_t TS
     FunctionRecord ExpectedFunctionEntry;
     internal_memcpy(&ExpectedFunctionEntry, RewindingRecordPtr,
                     FunctionRecSize);
-    assert(ExpectedFunctionEntry.RecordKind ==
+    DCHECK(ExpectedFunctionEntry.RecordKind ==
                uint8_t(FunctionRecord::RecordKinds::FunctionEnter) &&
            "Expected to find function entry when rewinding tail call.");
-    assert(ExpectedFunctionEntry.FuncId == ExpectedTailExit.FuncId &&
+    DCHECK(ExpectedFunctionEntry.FuncId == ExpectedTailExit.FuncId &&
            "Expected funcids to match when rewinding tail call.");
 
     // This tail call exceeded the threshold duration. It will not be erased.
@@ -576,7 +574,7 @@ static void processFunctionHook(int32_t
   // handleArg0 to happen at any given time.
   RecursionGuard Guard{Running};
   if (!Guard) {
-    assert(Running == true && "RecursionGuard is buggy!");
+    DCHECK(Running == true && "RecursionGuard is buggy!");
     return;
   }
 
@@ -630,7 +628,7 @@ static void processFunctionHook(int32_t
   }
 
   // By this point, we are now ready to write up to 40 bytes (explained above).
-  assert((TLD.RecordPtr + MaxSize) - static_cast<char *>(TLD.Buffer.Data) >=
+  DCHECK((TLD.RecordPtr + MaxSize) - static_cast<char *>(TLD.Buffer.Data) >=
              static_cast<ptrdiff_t>(MetadataRecSize) &&
          "Misconfigured BufferQueue provided; Buffer size not large enough.");
 
@@ -859,7 +857,7 @@ XRayLogFlushStatus fdrLoggingFlush() XRA
     // data.
     MetadataRecord ExtentsRecord;
     auto BufferExtents = atomic_load(&B.Extents->Size, memory_order_acquire);
-    assert(BufferExtents <= B.Size);
+    DCHECK(BufferExtents <= B.Size);
     ExtentsRecord.Type = uint8_t(RecordType::Metadata);
     ExtentsRecord.RecordKind =
         uint8_t(MetadataRecord::RecordKinds::BufferExtents);




More information about the llvm-commits mailing list