Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gccsense vs. clang_complete

I've been using omniCppComplete + ctags for a while, and want to make a further improvement on the code completion.

According to the suggestion in here [1], gccsense and clang_complete seems to be alternatives. However, I am not sure which one is better. Any idea on their performance?
Thanks!

Update: After I tried clang_complete, I found the completion speed extremely unacceptable. I then tried it using libclang.dylib, which speeds up a lot but still make one feels lagging. I think I should stick to ctags for now.

like image 608
Ivan Xiao Avatar asked Mar 28 '11 04:03

Ivan Xiao


2 Answers

You should probably use clang_complete, not gccsense.

The main point here is the architecture of the two. The idea behind both solutions is very similar: you can't get normal C++ completion without access to internal compiler (gcc) information (Abstract Syntax Tree) while gcc doesn't provide you with sufficient interfaces for that. The implementation part of accessing this info though is quite different here: gccsense is a kind of "hack" - it's a custom build of gcc capable for storing the neccessary info for futher providing it to plugin, while clang_complete goes the other way by using alternative compiler: clang, one of the main goals of creation of which was exactly making AST easily accessible by external tools.

So, in case of using gccsense you'll need to compile your code with a kind of custom gcc compiler, which is already a little bit outdated (gccsense is using gcc 4.4) now and will constantly need developer's support in feature. On the contrary, clang_complete doesn't depend so much on clang compiler, it uses it as external tool.

As for performance: again clang was designed to be faster than gcc and it is. Clang_complete can be slightly slower on Windows than on MacOS/Linux, however gccsense can't even be compiled for Windows at the time.

like image 162
lithuak Avatar answered Nov 17 '22 21:11

lithuak


GCCsense can be built on Windows. See my patch on gcc 4.5.2 here: http://forums.codeblocks.org/index.php/topic,13812.msg94824.html#msg94824

I admit that gccsense is just a hack to gcc, but clang has much better design from its beginning.

I hope anyone could improve gcc/gccsense.

like image 26
ollydbg23 Avatar answered Nov 17 '22 21:11

ollydbg23