[libFuzzer] record traces from the switch statements only when told to do so
authorKostya Serebryany <kcc@google.com>
Fri, 31 Jul 2015 18:09:08 +0000 (18:09 +0000)
committerKostya Serebryany <kcc@google.com>
Fri, 31 Jul 2015 18:09:08 +0000 (18:09 +0000)
llvm-svn: 243768

llvm/lib/Fuzzer/FuzzerTraceState.cpp

index 7af5f74..5eae2ec 100644 (file)
@@ -364,6 +364,7 @@ void TraceState::TraceCmpCallback(uintptr_t PC, size_t CmpSize, size_t CmpType,
 void TraceState::TraceSwitchCallback(uintptr_t PC, size_t ValSizeInBits,
                                      uint64_t Val, size_t NumCases,
                                      uint64_t *Cases) {
+  if (!RecordingTraces) return;
   for (size_t i = 0; i < NumCases; i++)
     TryToAddDesiredData(Val, Cases[i], ValSizeInBits / 8);
 }