[xxHash] Don't trigger UB on empty StringRef
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 8 Feb 2023 11:53:54 +0000 (12:53 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 8 Feb 2023 11:53:54 +0000 (12:53 +0100)
commit72eac42f21c0f45a27f3eaaff9364cbb5189b9e4
treef06f23e22c0228cc2633dd11459b82026c669ce8
parentcfc486002117f2759d624a47856ec487e1a77735
[xxHash] Don't trigger UB on empty StringRef

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
llvm/lib/Support/xxhash.cpp
llvm/unittests/Support/xxhashTest.cpp