Author: Timm Baeder Date: 2024-11-04T14:00:24+01:00 New Revision: fb30208d1e4c2c1ba34c331f6f90a99552d2df97
URL: https://github.com/llvm/llvm-project/commit/fb30208d1e4c2c1ba34c331f6f90a99552d2df97 DIFF: https://github.com/llvm/llvm-project/commit/fb30208d1e4c2c1ba34c331f6f90a99552d2df97.diff LOG: [clang][bytecode][NFC] Make Floating::bitcastToMemory const (#114777) The other functions like this are also const. Added: Modified: clang/lib/AST/ByteCode/Floating.h clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Floating.h b/clang/lib/AST/ByteCode/Floating.h index be38e6991dad75..3a874fc6f0b412 100644 --- a/clang/lib/AST/ByteCode/Floating.h +++ b/clang/lib/AST/ByteCode/Floating.h @@ -135,7 +135,7 @@ class Floating final { return Floating(APFloat(Sem, API)); } - void bitcastToMemory(std::byte *Buff) { + void bitcastToMemory(std::byte *Buff) const { llvm::APInt API = F.bitcastToAPInt(); llvm::StoreIntToMemory(API, (uint8_t *)Buff, bitWidth() / 8); } diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp index 8160707e8654d6..948a78f6f787e3 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp @@ -321,7 +321,7 @@ static bool readPointerToBuffer(const Context &Ctx, const Pointer &FromPtr, // This is really just `long double` on x86, which is the only // fundamental type with padding bytes. if (T == PT_Float) { - Floating &F = P.deref<Floating>(); + const Floating &F = P.deref<Floating>(); unsigned NumBits = llvm::APFloatBase::getSizeInBits(F.getAPFloat().getSemantics()); assert(NumBits % 8 == 0); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits