[PATCH] D117463: [clangd] Disable expand-auto action on constrained auto.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 19 05:56:39 PST 2022


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp:88
+      R"cpp(template <typename T> concept C = true;
+^C a^uto abc();
+    )cpp");
----------------
sammccall wrote:
> This shouldn't be unavailable because it's constrained, it should be unavailable because it's not deduced.
> 
> Does this case pass or fail today?
> 
> If the issue with constrained auto is syntactic, can you add a deductible test case?
> it should be unavailable because it's not deduced.

This is ideal, but not the behavior today -- the tweak is available but being failed to apply as we don't check the auto is deduced during prepare stage (it is expensive, requiring an AST traversal). 

For deducible cases, we replace the `C auto` with the actual type, e.g.
```
template <typename T> concept C = true;
C auto var = 123;  // => int var = 123;
```
I don't think this is an expected behavior. Given the deductible & nondeductible cases, it seems like an improvement to disable the tweak for constrained auto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117463



More information about the cfe-commits mailing list