[libFuzzer] make libFuzzer work with a bit older clang versions
authorKostya Serebryany <kcc@google.com>
Sat, 6 Aug 2016 21:28:56 +0000 (21:28 +0000)
committerKostya Serebryany <kcc@google.com>
Sat, 6 Aug 2016 21:28:56 +0000 (21:28 +0000)
llvm-svn: 277941

llvm/lib/Fuzzer/FuzzerLoop.cpp

index ebcf892..db8868c 100644 (file)
@@ -123,15 +123,17 @@ class CoverageController {
       C->PcMapBits = NewPcMapBits;
     }
 
-    uint64_t NewPcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos();
-    if (NewPcBufferPos > C->PcBufferPos) {
-      Res = true;
-      C->PcBufferPos = NewPcBufferPos;
-    }
+    if (EF->__sanitizer_get_coverage_pc_buffer_pos) {
+      uint64_t NewPcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos();
+      if (NewPcBufferPos > C->PcBufferPos) {
+        Res = true;
+        C->PcBufferPos = NewPcBufferPos;
+      }
 
-    if (PcBufferLen && NewPcBufferPos >= PcBufferLen) {
-      Printf("ERROR: PC buffer overflow\n");
-      _Exit(1);
+      if (PcBufferLen && NewPcBufferPos >= PcBufferLen) {
+        Printf("ERROR: PC buffer overflow\n");
+        _Exit(1);
+      }
     }
 
     return Res;