[all-commits] [llvm/llvm-project] d5cfdc: [clangd] Allow hover over 128-bit variable without...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Wed Nov 8 05:14:04 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d5cfdcaacbd36d6c25011f03a4eb51137f7a804a
      https://github.com/llvm/llvm-project/commit/d5cfdcaacbd36d6c25011f03a4eb51137f7a804a
  Author: Björn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M clang-tools-extra/clangd/Hover.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp

  Log Message:
  -----------
  [clangd] Allow hover over 128-bit variable without crashing (#71415)

When hovering over variables larger than 64 bits, with more than 64
active bits, there were assertion failures since Hover is trying to
print the value as a 64-bit hex value.

There is already protection avoiding to call printHex if there is more
than 64 significant bits. And we already truncate and print negative
values using only 32 bits, when possible. So we can simply truncate
values with more than 64 bits to avoid the assert when using
getZExtValue. The result will be that for example a negative 128 bit
variable is printed using 64 bits, when possible.

There is still no support for printing more than 64 bits. That would
involve more changes since for example llvm::FormatterNumber is limited
to 64 bits.

This is a second attempt at landing this patch. Now with protection
to ensure we use a triple that supports __int128_t.




More information about the All-commits mailing list