[Lldb-commits] [PATCH] D157455: [lldb][NFCI] Remove MappedHash.h

2023-08-08 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jasonmolenda, jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is no longer used as of 8e71d14972b48df8c5b701a9aec19af3194f9a5e 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157455

Files:
  lldb/include/lldb/Core/MappedHash.h
  lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
@@ -10,7 +10,6 @@
 #include "ObjCLanguageRuntime.h"
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "lldb/Core/MappedHash.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/ValueObject.h"
Index: lldb/include/lldb/Core/MappedHash.h
===
--- lldb/include/lldb/Core/MappedHash.h
+++ /dev/null
@@ -1,308 +0,0 @@
-//===-- MappedHash.h *- 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
-//
-//===--===//
-
-#ifndef LLDB_CORE_MAPPEDHASH_H
-#define LLDB_CORE_MAPPEDHASH_H
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/Stream.h"
-#include "llvm/Support/DJB.h"
-
-class MappedHash {
-public:
-  enum HashFunctionType {
-eHashFunctionDJB = 0u // Daniel J Bernstein hash function that is also used
-  // by the ELF GNU_HASH sections
-  };
-
-  static uint32_t HashString(uint32_t hash_function, llvm::StringRef s) {
-switch (hash_function) {
-case MappedHash::eHashFunctionDJB:
-  return llvm::djbHash(s);
-
-default:
-  break;
-}
-llvm_unreachable("Invalid hash function index");
-  }
-
-  static const uint32_t HASH_MAGIC = 0x48415348u;
-  static const uint32_t HASH_CIGAM = 0x48534148u;
-
-  template  struct Header {
-typedef T HeaderData;
-
-uint32_t
-magic; // HASH_MAGIC or HASH_CIGAM magic value to allow endian detection
-uint16_t version = 1; // Version number
-uint16_t hash_function =
-eHashFunctionDJB;  // The hash function enumeration that was used
-uint32_t bucket_count = 0; // The number of buckets in this hash table
-uint32_t hashes_count = 0; // The total number of unique hash values and
-   // hash data offsets in this table
-uint32_t header_data_len; // The size in bytes of the "header_data" template
-  // member below
-HeaderData header_data;   //
-
-Header() : magic(HASH_MAGIC), header_data_len(sizeof(T)), header_data() {}
-
-virtual ~Header() = default;
-
-size_t GetByteSize() const {
-  return sizeof(magic) + sizeof(version) + sizeof(hash_function) +
- sizeof(bucket_count) + sizeof(hashes_count) +
- sizeof(header_data_len) + header_data_len;
-}
-
-virtual size_t GetByteSize(const HeaderData &header_data) = 0;
-
-void SetHeaderDataByteSize(uint32_t header_data_byte_size) {
-  header_data_len = header_data_byte_size;
-}
-
-void Dump(lldb_private::Stream &s) {
-  s.Printf("header.magic  = 0x%8.8x\n", magic);
-  s.Printf("header.version= 0x%4.4x\n", version);
-  s.Printf("header.hash_function  = 0x%4.4x\n", hash_function);
-  s.Printf("header.bucket_count   = 0x%8.8x %u\n", bucket_count,
-   bucket_count);
-  s.Printf("header.hashes_count   = 0x%8.8x %u\n", hashes_count,
-   hashes_count);
-  s.Printf("header.header_data_len= 0x%8.8x %u\n", header_data_len,
-   header_data_len);
-}
-
-virtual lldb::offset_t Read(lldb_private::DataExtractor &data,
-lldb::offset_t offset) {
-  if (data.ValidOffsetForDataOfSize(
-  offset, sizeof(magic) + sizeof(version) + sizeof(hash_function) +
-  sizeof(bucket_count) + sizeof(hashes_count) +
-  sizeof(header_data_len))) {
-magic = data.GetU32(&offset);
-if (magic != HASH_MAGIC) {
-  if (magic == HASH_CIGAM) {
-switch (data.GetByteOrder()) {
-case lldb::eByteOrderBig:
-  data.SetByteOrder(lldb::eByteOrderLittle);
-  break;
-case lldb::eByteOrderLittl

[Lldb-commits] [PATCH] D157455: [lldb][NFCI] Remove MappedHash.h

2023-08-09 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157455/new/

https://reviews.llvm.org/D157455

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D157455: [lldb][NFCI] Remove MappedHash.h

2023-08-09 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG44c876fd75c2: [lldb][NFCI] Remove MappedHash.h (authored by 
bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157455/new/

https://reviews.llvm.org/D157455

Files:
  lldb/include/lldb/Core/MappedHash.h
  lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
@@ -10,7 +10,6 @@
 #include "ObjCLanguageRuntime.h"
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "lldb/Core/MappedHash.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/ValueObject.h"
Index: lldb/include/lldb/Core/MappedHash.h
===
--- lldb/include/lldb/Core/MappedHash.h
+++ /dev/null
@@ -1,308 +0,0 @@
-//===-- MappedHash.h *- 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
-//
-//===--===//
-
-#ifndef LLDB_CORE_MAPPEDHASH_H
-#define LLDB_CORE_MAPPEDHASH_H
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/Stream.h"
-#include "llvm/Support/DJB.h"
-
-class MappedHash {
-public:
-  enum HashFunctionType {
-eHashFunctionDJB = 0u // Daniel J Bernstein hash function that is also used
-  // by the ELF GNU_HASH sections
-  };
-
-  static uint32_t HashString(uint32_t hash_function, llvm::StringRef s) {
-switch (hash_function) {
-case MappedHash::eHashFunctionDJB:
-  return llvm::djbHash(s);
-
-default:
-  break;
-}
-llvm_unreachable("Invalid hash function index");
-  }
-
-  static const uint32_t HASH_MAGIC = 0x48415348u;
-  static const uint32_t HASH_CIGAM = 0x48534148u;
-
-  template  struct Header {
-typedef T HeaderData;
-
-uint32_t
-magic; // HASH_MAGIC or HASH_CIGAM magic value to allow endian detection
-uint16_t version = 1; // Version number
-uint16_t hash_function =
-eHashFunctionDJB;  // The hash function enumeration that was used
-uint32_t bucket_count = 0; // The number of buckets in this hash table
-uint32_t hashes_count = 0; // The total number of unique hash values and
-   // hash data offsets in this table
-uint32_t header_data_len; // The size in bytes of the "header_data" template
-  // member below
-HeaderData header_data;   //
-
-Header() : magic(HASH_MAGIC), header_data_len(sizeof(T)), header_data() {}
-
-virtual ~Header() = default;
-
-size_t GetByteSize() const {
-  return sizeof(magic) + sizeof(version) + sizeof(hash_function) +
- sizeof(bucket_count) + sizeof(hashes_count) +
- sizeof(header_data_len) + header_data_len;
-}
-
-virtual size_t GetByteSize(const HeaderData &header_data) = 0;
-
-void SetHeaderDataByteSize(uint32_t header_data_byte_size) {
-  header_data_len = header_data_byte_size;
-}
-
-void Dump(lldb_private::Stream &s) {
-  s.Printf("header.magic  = 0x%8.8x\n", magic);
-  s.Printf("header.version= 0x%4.4x\n", version);
-  s.Printf("header.hash_function  = 0x%4.4x\n", hash_function);
-  s.Printf("header.bucket_count   = 0x%8.8x %u\n", bucket_count,
-   bucket_count);
-  s.Printf("header.hashes_count   = 0x%8.8x %u\n", hashes_count,
-   hashes_count);
-  s.Printf("header.header_data_len= 0x%8.8x %u\n", header_data_len,
-   header_data_len);
-}
-
-virtual lldb::offset_t Read(lldb_private::DataExtractor &data,
-lldb::offset_t offset) {
-  if (data.ValidOffsetForDataOfSize(
-  offset, sizeof(magic) + sizeof(version) + sizeof(hash_function) +
-  sizeof(bucket_count) + sizeof(hashes_count) +
-  sizeof(header_data_len))) {
-magic = data.GetU32(&offset);
-if (magic != HASH_MAGIC) {
-  if (magic == HASH_CIGAM) {
-switch (data.GetByteOrder()) {
-case lldb::eByteOrderBig:
-  data.SetByteOrder(lldb::eByteOrderLittle);
-  break;
-case lldb::eByteOrderLittle:
-  data.SetByteOrder(lldb::eByteOrderBig);
-  break;
-default:
-  return LLDB_INVALID_OFFSET;
-