]> granicus.if.org Git - llvm/commitdiff
Reverting r357901 as fails to build on some of the buildbots
authorEugene Leviant <eleviant@accesssoftek.com>
Mon, 8 Apr 2019 11:37:20 +0000 (11:37 +0000)
committerEugene Leviant <eleviant@accesssoftek.com>
Mon, 8 Apr 2019 11:37:20 +0000 (11:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357902 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/CRC.h [deleted file]
lib/DebugInfo/Symbolize/Symbolize.cpp
lib/Support/CMakeLists.txt
lib/Support/CRC.cpp [deleted file]
unittests/Support/CMakeLists.txt
unittests/Support/CRCTest.cpp [deleted file]

diff --git a/include/llvm/Support/CRC.h b/include/llvm/Support/CRC.h
deleted file mode 100644 (file)
index 6ea8e3e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-//===-- llvm/Support/CRC.h - Cyclic Redundancy Check-------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains basic functions for calculating Cyclic Redundancy Check
-// or CRC.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_CRC_H
-#define LLVM_SUPPORT_CRC_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
-
-namespace llvm {
-/// zlib independent CRC32 calculation.
-uint32_t crc32(uint32_t CRC, StringRef S);
-} // end namespace llvm
-
-#endif
index 52192287b719334198c1e1ddfd073b5e12b12dc8..43c65c43c74889c8550c8cbeab0840ac326b6e4a 100644 (file)
@@ -23,7 +23,6 @@
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/MachO.h"
 #include "llvm/Object/MachOUniversal.h"
-#include "llvm/Support/CRC.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Compression.h"
 #include "llvm/Support/DataExtractor.h"
@@ -164,7 +163,7 @@ bool checkFileCRC(StringRef Path, uint32_t CRCHash) {
       MemoryBuffer::getFileOrSTDIN(Path);
   if (!MB)
     return false;
-  return CRCHash == crc32(0, MB.get()->getBuffer());
+  return !zlib::isAvailable() || CRCHash == zlib::crc32(MB.get()->getBuffer());
 }
 
 bool findDebugBinary(const std::string &OrigPath,
index 7dfa97c53568cc2ab04bf63820808345549ea7c8..c5846ad6c81110e9b900418fd8572c425f40492b 100644 (file)
@@ -76,7 +76,6 @@ add_llvm_library(LLVMSupport
   CodeGenCoverage.cpp
   CommandLine.cpp
   Compression.cpp
-  CRC.cpp
   ConvertUTF.cpp
   ConvertUTFWrapper.cpp
   CrashRecoveryContext.cpp
diff --git a/lib/Support/CRC.cpp b/lib/Support/CRC.cpp
deleted file mode 100644 (file)
index 6f8edf6..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//===--- CRC.cpp - Cyclic Redundancy Check implementation -----------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file implements llvm::crc32 function.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/CRC.h"
-#include "llvm/Config/config.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Threading.h"
-#include <array>
-
-using namespace llvm;
-
-#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H
-using CRC32Table = std::array<uint32_t, 256>;
-
-static void initCRC32Table(CRC32Table &Tbl) {
-  auto Shuffle = [](uint32_t V) {
-    return (V & 1) ? (V >> 1) ^ 0xEDB88320U : V >> 1;
-  };
-
-  for (size_t I = 0; I < Tbl.size(); ++I) {
-    uint32_t V = Shuffle(I);
-    V = Shuffle(V);
-    V = Shuffle(V);
-    V = Shuffle(V);
-    V = Shuffle(V);
-    V = Shuffle(V);
-    V = Shuffle(V);
-    Tbl[I] = Shuffle(V);
-  }
-}
-
-uint32_t llvm::crc32(uint32_t CRC, StringRef S) {
-  static llvm::once_flag InitFlag;
-  static CRC32Table Tbl;
-  llvm::call_once(InitFlag, initCRC32Table, Tbl);
-
-  const uint8_t *P = reinterpret_cast<const uint8_t *>(S.data());
-  size_t Len = S.size();
-  CRC ^= 0xFFFFFFFFU;
-  for (; Len >= 8; Len -= 8) {
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-  }
-  while (Len--)
-    CRC = Tbl[(CRC ^ *P++) & 0xFF] ^ (CRC >> 8);
-  return CRC ^ 0xFFFFFFFFU;
-}
-#else
-#include <zlib.h>
-uint32_t llvm::crc32(uint32_t CRC, StringRef S) {
-  return ::crc32(CRC, (const Bytef *)S.data(), S.size());
-}
-#endif
index 12c983df50ccd1ffe72c025c3c601190f4418f40..40bf939400249548d5522f1faaad7887a27af6c7 100644 (file)
@@ -18,7 +18,6 @@ add_llvm_unittest(SupportTests
   CommandLineTest.cpp
   CompressionTest.cpp
   ConvertUTFTest.cpp
-  CRCTest.cpp
   DataExtractorTest.cpp
   DebugTest.cpp
   DebugCounterTest.cpp
diff --git a/unittests/Support/CRCTest.cpp b/unittests/Support/CRCTest.cpp
deleted file mode 100644 (file)
index 71afb0a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//===- llvm/unittest/Support/CRCTest.cpp - CRC tests ----------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements unit tests for CRC calculation functions.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/CRC.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-
-namespace {
-
-TEST(CRCTest, CRC32) {
-  EXPECT_EQ(0x414FA339U,
-            llvm::crc32(
-                0, StringRef("The quick brown fox jumps over the lazy dog")));
-  // CRC-32/ISO-HDLC test vector
-  // http://reveng.sourceforge.net/crc-catalogue/17plus.htm#crc.cat.crc-32c
-  EXPECT_EQ(0xCBF43926U, llvm::crc32(0, StringRef("123456789")));
-}
-
-} // end anonymous namespace