This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Show hex value of numeric constants
ClosedPublic

Authored by sammccall on Feb 22 2021, 2:06 PM.

Details

Summary

Don't show negative numbers
Don't show numbers <10 (hex is the same as decimal)
Show numeric enum values in hex too

Diff Detail

Event Timeline

sammccall created this revision.Feb 22 2021, 2:06 PM
sammccall requested review of this revision.Feb 22 2021, 2:06 PM
kadircet accepted this revision.Feb 23 2021, 2:03 AM

thanks, lgtm!

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

clang-tools-extra/clangd/Hover.cpp
398–400

are we okay with printing negatives as hex in here? as in theory one can have

enum {
  foo = -1,
}
This revision is now accepted and ready to land.Feb 23 2021, 2:03 AM
sammccall updated this revision to Diff 325807.Feb 23 2021, 8:55 AM

Add tests
Print negative values too, sign-extended to 32/64 bits

kadircet accepted this revision.Feb 24 2021, 9:56 AM

still lgtm

This revision was automatically updated to reflect the committed changes.