Git Product home page Git Product logo

Comments (3)

zyn0217 avatar zyn0217 commented on June 24, 2024

If we look at the AST of waldo, we'll see the call expression find_if is modeled as an UnresolvedLookupExpr, and thus the type of such is dependent.

I think there's improvement room regarding the clang side, such as we can eagerly perform the lookup of call expressions with non-dependent arguments, and thereby, the result type would be non-dependent at the time clangd consumes the AST. But I could also envision some earlier diagnostics brought over by such drastic changes might break some existing codebases.

We can definitely invent some heuristics at clangd side - I presume that's basically a duplicate of a somewhat CXXNameLookup.

from clangd.

zyn0217 avatar zyn0217 commented on June 24, 2024

Change the second argument to find_if() to not be a lambda

Fun enough that the lambda expression plays the trick here - probably we are somehow depending on the lambda's dependency?

from clangd.

HighCommander4 avatar HighCommander4 commented on June 24, 2024

While I haven't checked the details, my guess is that, since lambdas are modelled as local classes, and the local class is declared inside the function's DeclContext, it therefore becomes a different type in every instantiation of the function template.

If that's the case, there might be an opportunity to optimize the frontend itself here, to avoid instantiating find_if separately for each instantiation of waldo.

from clangd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.