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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 02:27:30 PDT 2023


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

Thanks, looks good, just one nit to simplify the unittest.



================
Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:3726
 
+TEST(Hover, FunctionParameterDefaulValueNotEvaluatedOnInvalidDecls) {
+  struct {
----------------
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>";
       }},
```


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