Skip to content

Commit ee03dc1

Browse files
committed
Revert "[clangd] Allow hover over 128-bit variable without crashing (#71415)"
This reverts commit 2626916. It failed on buildbots not supporting __int128_t.
1 parent d1fb930 commit ee03dc1

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

clang-tools-extra/clangd/Hover.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,7 @@ void fillFunctionTypeAndParams(HoverInfo &HI, const Decl *D,
408408
// -2 => 0xfffffffe
409409
// -2^32 => 0xffffffff00000000
410410
static llvm::FormattedNumber printHex(const llvm::APSInt &V) {
411-
assert(V.getSignificantBits() <= 64 && "Can't print more than 64 bits.");
412-
uint64_t Bits =
413-
V.getBitWidth() > 64 ? V.trunc(64).getZExtValue() : V.getZExtValue();
411+
uint64_t Bits = V.getZExtValue();
414412
if (V.isNegative() && V.getSignificantBits() <= 32)
415413
return llvm::format_hex(uint32_t(Bits), 0);
416414
return llvm::format_hex(Bits, 0);

clang-tools-extra/clangd/unittests/HoverTests.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,17 +3349,6 @@ TEST(Hover, NoCrashAPInt64) {
33493349
getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
33503350
}
33513351

3352-
TEST(Hover, NoCrashInt128) {
3353-
Annotations T(R"cpp(
3354-
constexpr __int128_t value = -4;
3355-
void foo() { va^lue; }
3356-
)cpp");
3357-
auto AST = TestTU::withCode(T.code()).build();
3358-
auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
3359-
ASSERT_TRUE(H);
3360-
EXPECT_EQ(H->Value, "-4 (0xfffffffc)");
3361-
}
3362-
33633352
TEST(Hover, DocsFromMostSpecial) {
33643353
Annotations T(R"cpp(
33653354
// doc1

0 commit comments

Comments
 (0)