Comments (3)
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.
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.
@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)
- Does Clangd support Pull diagnostics ? textdocument/diagnostic
- Does Clangd support Pull diagnostics ? HOT 2
- fails to properly read compilation database for system headers HOT 4
- Clang Language Server server crashes with specific changes. HOT 1
- compile_commands.json is not correct. HOT 1
- Crash During specific Template Case HOT 7
- Quickfix to "MissingIncludes" adds absolute path to '#include' directive
- Bad tradeoff memory-performance when loading symbols
- Add symbol tags to document symbols for modifiers like public, private, static, abstract, etc. HOT 1
- clangd produces diagnostic of severity 0 HOT 2
- Make the project configuration have precedence over the user configuration HOT 1
- Unknown argument clangd error insight with gcc option HOT 3
- Release checklist for clangd 19 HOT 8
- MIssing code Snippets in Function Completion for Class Definitions HOT 1
- Crashing parsing header HOT 1
- clang-tidy `AllowInternalLinkage` option for non-const global variables still flags static variables when enabled HOT 8
- Make clang-tidy documention hyperlinks be version-specific HOT 1
- Find references of a variable should show if it is a read or write access HOT 1
- Does clangd support DidRenameFiles, WillRenameFiles ?? HOT 5
- Clangd doesn't understand RISC-V vector intrisics (<riscv_vector.h>) HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clangd.