Git Product home page Git Product logo

Comments (3)

HighCommander4 avatar HighCommander4 commented on September 26, 2024 1

why wouldn't clangd use those flags, nevertheless clang doesn't recognize them, for queries for query driver in order to extract more information about compiler's toolchain?

Good question!

Clangd only forwards arguments from the command line passed to the clang driver to parse the file, to the command line used for --query-driver, for a small set of allow-listed arguments known to impact the system includes. This is mainly so it can effectively cache the results of --query-driver rather than having to run it for every file in the project.

We've added arguments to that list before, for example see the recent addition of -specs in llvm/llvm-project#70285.

However, one difference here is that -specs is recognized by the clang driver (even if it doesn't have any effect).

If we were to add e.g. -qbsp to the list, now --query-driver will get it, but you'll still have the problem that the clang driver will also get it and it will issue an error about it.

(Though I note the error is not a fatal error... so maybe an ability to suppress that error would be sufficient? We have a mechanism to suppress diagnostics in general (https://clangd.llvm.org/config.html#suppress), but it doesn't currently work for driver diagnostics due to #1142.)

Another approach that could be considered is to add support for the clang driver to syntactically recognize the affected flags, even if it ignores them, similar to -specs.

from clangd.

HighCommander4 avatar HighCommander4 commented on September 26, 2024

clangd is a clang-based tool so its support, in terms of things like targets and cpus, is generally determined by what clang supports.

The general procedure is:

  • figure out what set of flags causes clang to successfully compile the code
  • make sure clangd is using those same flags

If the code is not portable to clang / not supported by clang then clangd may not work properly either (though you may be able to find workarounds like manually adding flags that get it to work well enough for editing purposes)

from clangd.

sccoouut avatar sccoouut commented on September 26, 2024

@HighCommander4 thanks for your answer, seems to be fair. on other hand, why wouldn't clangd use those flags, nevertheless clang doesn't recognize them, for queries for query driver in order to extract more information about compiler's toolchain?

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.