Author: Bjorn Pettersson Date: 2023-11-08T12:56:26+01:00 New Revision: ee03dc1836348420221f8830cae9868d3a51484c
URL: https://github.com/llvm/llvm-project/commit/ee03dc1836348420221f8830cae9868d3a51484c DIFF: https://github.com/llvm/llvm-project/commit/ee03dc1836348420221f8830cae9868d3a51484c.diff LOG: Revert "[clangd] Allow hover over 128-bit variable without crashing (#71415)" This reverts commit 2626916c45f428226052f5e431e510743aba9e75. It failed on buildbots not supporting __int128_t. Added: Modified: clang-tools-extra/clangd/Hover.cpp clang-tools-extra/clangd/unittests/HoverTests.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index a868d3bb4e3fa1d..7f7b5513dff6fee 100644 --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -408,9 +408,7 @@ void fillFunctionTypeAndParams(HoverInfo &HI, const Decl *D, // -2 => 0xfffffffe // -2^32 => 0xffffffff00000000 static llvm::FormattedNumber printHex(const llvm::APSInt &V) { - assert(V.getSignificantBits() <= 64 && "Can't print more than 64 bits."); - uint64_t Bits = - V.getBitWidth() > 64 ? V.trunc(64).getZExtValue() : V.getZExtValue(); + uint64_t Bits = V.getZExtValue(); if (V.isNegative() && V.getSignificantBits() <= 32) return llvm::format_hex(uint32_t(Bits), 0); return llvm::format_hex(Bits, 0); diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp index 847f141f521caa0..063a60db044060e 100644 --- a/clang-tools-extra/clangd/unittests/HoverTests.cpp +++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp @@ -3349,17 +3349,6 @@ TEST(Hover, NoCrashAPInt64) { getHover(AST, T.point(), format::getLLVMStyle(), nullptr); } -TEST(Hover, NoCrashInt128) { - Annotations T(R"cpp( - constexpr __int128_t value = -4; - void foo() { va^lue; } - )cpp"); - auto AST = TestTU::withCode(T.code()).build(); - auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr); - ASSERT_TRUE(H); - EXPECT_EQ(H->Value, "-4 (0xfffffffc)"); -} - TEST(Hover, DocsFromMostSpecial) { Annotations T(R"cpp( // doc1 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits