[PATCH] D70359: [clangd] Show values of more expressions on hover
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 18 02:14:06 PST 2019
kadircet marked an inline comment as done.
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/Hover.cpp:247
+ // to the enclosing call.
+ if (E->getType()->isFunctionType() || E->getType()->isFunctionPointerType() ||
+ E->getType()->isFunctionReferenceType())
----------------
nit extract `E->getType()` into a variable
================
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) {
----------------
both `Constant.Val.getInt` and `ECD->getInitVal` are `APSInt` and it has an `operator==`, why cast to `int64_t` in between?
================
Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:278
};
+ HI.Value = "false";
return HI;
----------------
wow, that's hilarious.
================
Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:450
+ HI.Type = "enum Color";
+ HI.Value = "GREEN"; // Symbolic when hovering on an expression.
}},
----------------
what about `GREEN (1)` ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70359/new/
https://reviews.llvm.org/D70359
More information about the cfe-commits
mailing list