[all-commits] [llvm/llvm-project] cf1006: [clang][Interp] Fully serialize Floating values to...

Timm Baeder via All-commits all-commits at lists.llvm.org
Thu Aug 17 03:44:03 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf10061da75e41286c28690e45eee6ee70dad766
  Author: Timm B├Ąder <tbaeder at redhat.com>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M clang/lib/AST/Interp/ByteCodeEmitter.cpp
    M clang/lib/AST/Interp/Disasm.cpp
    M clang/lib/AST/Interp/Floating.h
    M clang/lib/AST/Interp/Interp.h
    M clang/lib/AST/Interp/Source.h
    M clang/test/AST/Interp/floats.cpp

  Log Message:
  [clang][Interp] Fully serialize Floating values to bytes

The Floating class wraps a APFloat, which might heap allocate memory to
represent large floating values. When writing those to bytecode, we
would free() the heap allocation after writing, when destroying the
actual APFloat we wrote.

Fix this by seralizing a Floating as Semantics + APInt.

This will be neccessary in more cases later, when we support
arbitrary-precision integers or _BitInt.

Differential Revision: https://reviews.llvm.org/D155165

More information about the All-commits mailing list