[PATCH] D126498: [clangd] Fix hover crashing on integral or enumeral casts

Georg Kotheimer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 31 15:44:13 PDT 2022


gkll updated this revision to Diff 433211.
gkll added a comment.

Use `uintptr_t` instead of `unsigned long` for the casts, to ensure the pointer always fits into the integer type.
For example on Windows x64 that was previously not the case, because there `unsigned long` is only 32-bits wide.
Thus the pointer got truncated during the cast, which resulted in `getHover()` returning `None` instead of `&global_var`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126498/new/

https://reviews.llvm.org/D126498

Files:
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/TestTU.cpp
  clang-tools-extra/clangd/unittests/TestTU.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126498.433211.patch
Type: text/x-patch
Size: 3993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220531/160aafa6/attachment.bin>


More information about the cfe-commits mailing list