I would welcome a mature and refined Lexer/Parser/AST/"Give me tokens and the most information about them you can" tool I can then use to make advanced features like enabling proper CC for variable like following: auto window = std::make_shared<InterfaceWindow>(); // only example
ATM the only way (I am aware of) to get CC for window variable is to declare it's type:
std::shared_ptr<InterfaceWindow> window = std::make_shared<InterfaceWindow>();
So if
1) Alpha will be able to get it running (fingers crossed)
2) the use of LLVM/CLang will be only to compile Parser plugin for Code::Blocks - it won't be necessary for user to have these in their enviroment
3) Windows!
then the plugin should work for any C/C++/"what CLang language is supported" file, because it only parses the files and gives us AST with all the information about tokens we can then use to make smart Code Completion. The Parser doesn't have to touch user's compiler at all. Although it should ask it for defines.
BTW that's how current CC works too, unfortunately with all it's flaws and "how the hell I'm supposed to implement that without making it worse" features we would like to see in CC - no offense intended, authors did a great job and they even were not paid for it. C++11 (and the following C++14) moved C++ to a new century (I know about C++03, not the point here) and I doubt CC was made minding that in advance (no crystal ball) and now the requirements for CC Parser are enormous - so why not use Parser used by compiler?
If it would work like this, then it's fantastic.
(note: I'm not experienced in parsing/code completion and terminology, so what you've just read is only my understanding of how it works)
First: I now see where this really is beneficial using clang.
And for a bit of on topic: Thank you, MortenMacFly
So for 1K lines for code completion, one has to install (and on source based distributions like Gentoo Linux compile) the full LLVM and CLANG suites? Sweet.
On the source based distros you get llvm/clang compiled for you automagically, at least if you're using some smart source based distro.
And by the way the chance that you won't have llvm/clang installed in the future is getting smaller and smaller.
Yes, unless you have an intel graphics chipset. In that case there is no point to use mesa with LLVM as there is no Gallium3D support for modern intel HD. And apart from mesa there aren't many consumers for LLVM, yet.
Currently, on Gentoo at least, there are:- dev-lang/ghc : The Glasgow Haskell Compiler
- dev-lang/rubinius : A re-implementation of the Ruby VM designed for speed
- media-libs/mesa : OpenGL-like graphic library for Linux
- sys-devel/sparse : C semantic parser
- app-vim/youcompleteme : vim plugin: a code-completion engine for Vim
That is not much. And I doubt this list is more excessive elsewhere.
However, there is the next part:
Can you link to libclang statically?
The precompiled binaries I downloaded only contain shared libs; I will have to look into seeing if the build system supports static libraries.
Well, the main llvm configure script understands these options: --enable-shared Build a shared library and link tools against it
(default is NO)
--enable-embed-stdcxx Build a shared library with embedded libstdc++ for
Win32 DLL (default is NO)
So as far as I understand it, static linking is the default. Although the second option more sounds like whether or not to statically link libstdc++ into the windows dll, so no static library here (it seems).