sammccall added inline comments.

================
Comment at: clang-tools-extra/clangd/Hover.cpp:255
+  // Show enums symbolically, not numerically like APValue::printPretty().
+  if (E->getType()->isEnumeralType() &&
+      Constant.Val.getInt().getMinSignedBits() <= 64) {
----------------
kadircet wrote:
> both `Constant.Val.getInt` and `ECD->getInitVal` are `APSInt` and it has an 
> `operator==`, why cast to `int64_t` in between?
operator== asserts(!) that the widths are equal. (And they're not always)
added a comment


================
Comment at: clang-tools-extra/clangd/Hover.cpp:423
+      //  - certain expressions (sizeof etc)
+      //  - built-in types
     }
----------------
lh123 wrote:
> lh123 wrote:
> > sammccall wrote:
> > > lh123 wrote:
> > > > I think we should also support hover on literal.
> > > sure - can you explain what you'd like to see/when you'd expect it to be 
> > > useful?
> > such as:
> > 1. Hovering on "abc" shows char[4], we can get the length information of 
> > the string.
> > 2. Get actual type for user-defined literal types.
> > ```c++
> > struct foo {};
> > struct foo {};
> > 
> > foo operator""_foo(unsigned long long v) { return {}; }
> > 
> > int main() {
> >     1_foo;
> > }
> > 
> > ```
> > 
> ```
> struct foo {};
> 
> foo operator""_foo(unsigned long long v) { return {}; }
> 
> int main() {
>     1_foo;
> }
> ```
Added a comment about literals.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70359



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to