VitaNuo added a comment.

thanks!



================
Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:3726
+TEST(Hover, FunctionParameterDefaulValueNotEvaluated) {
+  Annotations T("void foo(int p^aram = 5);");
+  TestTU TU = TestTU::withCode(T.code());
----------------
hokein wrote:
> I believe this case should trigger a crash, but I don't see the crash with a 
> trunk-built clangd, do we miss something here?
It crashes on invalid code. I've inspected two user workspaces:
1.

```
class Foo{};
void foo(Foo param = nullptr);
```

2.
```
void foo(ClassName param = 
functionReturningObjectOfSimilarSoundingButUnrelatedClass());
```

I guess `clangd` is not even expected to act soundly in the face of 
non-compiling code. 
But since these crashes are easy to get rid of, and evaluating parameters in 
function declarations is pointless anyways, we can just avoid these crashes at 
no extra cost. I cannot use non-compiling code in a hover test, though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153015

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

Reply via email to