[all-commits] [llvm/llvm-project] 761969: [clang] Make LazyOffsetPtr more portable (#112927)

Jessica Clarke via All-commits all-commits at lists.llvm.org
Fri Oct 18 13:49:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 76196998e25b98d81abc437708622261810782ca
      https://github.com/llvm/llvm-project/commit/76196998e25b98d81abc437708622261810782ca
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2024-10-18 (Fri, 18 Oct 2024)

  Changed paths:
    M clang/include/clang/AST/ExternalASTSource.h

  Log Message:
  -----------
  [clang] Make LazyOffsetPtr more portable (#112927)

LazyOffsetPtr currently relies on uint64_t being able to store a pointer
and, unless sizeof(uint64_t) == sizeof(void *), little endianness, since
getAddressOfPointer reinterprets the memory as a pointer. This also
doesn't properly respect the C++ object model.

As removing getAddressOfPointer would have wide-reaching implications,
improve the implementation to account for these problems by using
placement new and a suitably sized-and-aligned buffer, "right"-aligning
the objects on big-endian platforms so the LSBs are in the same place
for use as the discriminator.

Fixes: bc73ef0031b50f7443615fef614fb4ecaaa4bd11
Fixes: https://github.com/llvm/llvm-project/issues/111993



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list