diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index a868d3bb4e3fa1..7f7b5513dff6fe 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 847f141f521caa..063a60db044060 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