[PATCH] D153015: [clangd] Skip function parameter decls when evaluating variables on hover.

Viktoriia Bakalova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 05:10:04 PDT 2023


VitaNuo added a comment.

Thanks!



================
Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:3726
 
+TEST(Hover, FunctionParameterDefaulValueNotEvaluatedOnInvalidDecls) {
+  struct {
----------------
hokein wrote:
> nit: instead of creating a completely-new TEST, it seems simpler to just add a testcase in the existing `TEST(Hover, All)`.
> 
> 
> ```
>    {R"cpp(// Should not crash on an invalid param decl.
>           class Foo {};
>           // error-ok
>           void foo(Foo [[fo^o]] = nullptr);
>           )cpp",
>        [](HoverInfo &HI) {
>          HI.Name = "foo";
>          HI.Type = "Foo";
>          HI.Kind = index::SymbolKind::Parameter;
>          HI.NamespaceScope = "";
>          HI.LocalScope = "foo::";
>          HI.Definition = "Foo foo = <null expr>";
>        }},
> ```
I'm not sure I agree. The `Hover, All` test takes already about 5 seconds to scroll through on the screen :)

On top of that, other test cases that are a result of crash fixes seem to be separate too.
Therefore, I'd prefer to keep it as a separate test case for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153015



More information about the cfe-commits mailing list