This is a subset of #68288, with hopefully narrower scope. It does not support bitcasting to non-integral types yet. Bitfields are supported, but only if they result in a full byte-sized final buffer. It does not support casting from null-pointers yet or casting from indeterminate bits. The tests are from #68288 and partially from #74775. The `BitcastBuffer` struct is currently always working in single bits, but I plan to (try to) optimize this for the common full-byte case.
27 lines
771 B
C++
27 lines
771 B
C++
//===------------------ InterpBuiltinBitCast.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 LLVM_CLANG_AST_INTERP_BUILITN_BIT_CAST_H
|
|
#define LLVM_CLANG_AST_INTERP_BUILITN_BIT_CAST_H
|
|
|
|
#include <cstddef>
|
|
|
|
namespace clang {
|
|
namespace interp {
|
|
class Pointer;
|
|
class InterpState;
|
|
class CodePtr;
|
|
|
|
bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
|
|
std::byte *Buff, size_t BuffSize, bool &HasIndeterminateBits);
|
|
|
|
} // namespace interp
|
|
} // namespace clang
|
|
|
|
#endif
|