Uses a heuristic to detect std::function and friends.
Details
- Reviewers
kadircet - Commits
- rZORG511aeea3f836: [CodeComplete] Complete a lambda when preferred type is a function
rG511aeea3f836: [CodeComplete] Complete a lambda when preferred type is a function
rG3a2f0e466b58: [CodeComplete] Complete a lambda when preferred type is a function
rC361461: [CodeComplete] Complete a lambda when preferred type is a function
rL361461: [CodeComplete] Complete a lambda when preferred type is a function
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 32302 Build 32301: arc lint + arc unit
Event Timeline
clang/lib/Sema/SemaCodeComplete.cpp | ||
---|---|---|
4135 | This looks cheesy, do we really want to perform this operation only for templates with "function" in their names? As discussed offline maybe perform this for any template with a single(non-defaulted?) argument, or maybe even better perform a type-check as suggested by you. But I believe there would be too many false positives with the current state. | |
4154 | maybe also add a placeholder for captures? |
- Add placeholder for captures.
- Only accept classes that have exactly one template argument.
clang/lib/Sema/SemaCodeComplete.cpp | ||
---|---|---|
4135 | WDYT about "function" + only template with a single arg? We have an option of making it super-restrictive and only firing on whitelisted things like std::function, boost::function, etc. | |
4154 | Done. With = as a default. |
clang/lib/Sema/SemaCodeComplete.cpp | ||
---|---|---|
4125 | I thought you decided to get rid of this branch after the offline discussions, sorry for not mentioning in earlier revision. | |
4135 | I don't think adding "function" as a restriction is helping much on reducing false positives. I would rather get rid of that check to increase usability. The real problem is rather checking constructors to make sure there is at least one for which we can provide a callable with the signature we found. Anything else just seems cheesy and might result in people adding more and more cases over time. It is up to you, I am OK if you choose to keep this restriction as well. | |
4142 | what about referencetype? void test(); void (&y)() = test; |
- Only work on sugared types
- Do not check for 'function' in the name
clang/lib/Sema/SemaCodeComplete.cpp | ||
---|---|---|
4125 | Sorry, my bad, forgot about it. | |
4135 | Removed the restriction on the function way. | |
4142 | Lambdas are r-values, so suggesting them for l-value references would lead to an error. |
I thought you decided to get rid of this branch after the offline discussions, sorry for not mentioning in earlier revision.