[PATCH] D97226: [clangd] Show hex value of numeric constants

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 02:03:56 PST 2021


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm!

should we also have some tests for a negative value in hover?



================
Comment at: clang-tools-extra/clangd/Hover.cpp:384
       if (ECD->getInitVal() == Val)
-        return llvm::formatv("{0} ({1})", ECD->getNameAsString(), Val).str();
+        return llvm::formatv("{0} ({1:x})", ECD->getNameAsString(), Val).str();
   }
----------------
are we okay with printing negatives as hex in here? as in theory one can have
```
enum {
  foo = -1,
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97226



More information about the cfe-commits mailing list