Why isn't gcc used for that? Where is the difference between them and why does almost any autocomplete plugin require clang?
The simple answer is that clang was designed to support completion while gcc was not.
Clang has a command line option that prints out possible completions at a given point in a source file, which makes it easy to use in scripts: Just shell out to clang, parse its output, done. Gcc has nothing comparable.
As for why, see this list of differences between gcc and clang:
[...]
- Clang is designed as an API from its inception, allowing it to be reused by source analysis tools, refactoring, IDEs (etc) as well as for code generation. GCC is built as a monolithic static compiler, which makes it extremely difficult to use as an API and integrate into other tools. Further, its historic design and current policy makes it difficult to decouple the front-end from the rest of the compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With