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

Jessica Clarke via All-commits all-commits at lists.llvm.org
Tue Oct 29 02:06:27 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: e541aa5ff994a370bacb9b039f70efb0672c4a1b
      https://github.com/llvm/llvm-project/commit/e541aa5ff994a370bacb9b039f70efb0672c4a1b
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2024-10-29 (Tue, 29 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
(cherry picked from commit 76196998e25b98d81abc437708622261810782ca)



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