mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 13:36:09 +00:00

This is quite silly, but casting to uintptr_t seems like the easiest option to quiet ubsan. llvm/lib/Support/xxhash.cpp:107:12: runtime error: applying non-zero offset 8 to null pointer #0 0x7fe3660404c0 in llvm::xxHash64(llvm::StringRef) llvm/lib/Support/xxhash.cpp:107:12
21 lines
735 B
C++
21 lines
735 B
C++
//===- llvm/unittest/Support/xxhashTest.cpp -------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/xxhash.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace llvm;
|
|
|
|
TEST(xxhashTest, Basic) {
|
|
EXPECT_EQ(0xef46db3751d8e999U, xxHash64(StringRef()));
|
|
EXPECT_EQ(0x33bf00a859c4ba3fU, xxHash64("foo"));
|
|
EXPECT_EQ(0x48a37c90ad27a659U, xxHash64("bar"));
|
|
EXPECT_EQ(0x69196c1b3af0bff9U,
|
|
xxHash64("0123456789abcdefghijklmnopqrstuvwxyz"));
|
|
}
|