summarylogtreecommitdiffstats
path: root/hover-hex-formats.patch
blob: f285f25bc2f0f52a27a37d75924c942451debd6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp
index 0ae70dd121eb..094a4471ddee 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -1406,6 +1406,10 @@ std::optional<HoverInfo> getHover(ParsedAST &AST, Position Pos,
 static std::string formatSize(uint64_t SizeInBits) {
   uint64_t Value = SizeInBits % 8 == 0 ? SizeInBits / 8 : SizeInBits;
   const char *Unit = Value != 0 && Value == SizeInBits ? "bit" : "byte";
+  if (Value > 10 && Value != SizeInBits)
+    return llvm::formatv("{0} ({0:x}) {1}{2}", Value, Unit,
+                         Value == 1 ? "" : "s")
+        .str();
   return llvm::formatv("{0} {1}{2}", Value, Unit, Value == 1 ? "" : "s").str();
 }