Author Topic: Clang CC  (Read 259423 times)

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Clang CC
« on: October 02, 2015, 07:44:04 pm »
Hello,

Just a quick question, did development on the Clang-based CC stall? Or is there a branch somewhere with the latest code since it seems https://github.com/alpha0010/ClangLib is the latest incarnation ?

-Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Clang CC
« Reply #1 on: October 03, 2015, 01:23:03 pm »
Yes, that is the most recent work on Clang based CC.  Unfortunately, a variety of events/issues in my life have stalled my ability to do large chunks of programming anywhere currently.  At whatever point I am able to return to my projects, this will be my top priority.  (In the mean time, I still will happily review any pull requests there.)

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #2 on: October 06, 2015, 05:42:28 am »
Great!

I'll work on it a bit, probably first fixing small bugs to improve its usability and send pull-requests when something is ready.

-Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #3 on: October 21, 2015, 08:32:50 pm »
First pull-request is ready. For people that want faster access to bugfixes/new features, I commit them on

https://github.com/yvesdm3000/ClangLib

Constructive feedback is always welcome.

Current state is so far pretty stable, but oviously the expected lags are still there since the clang functionality should be moved to a thread.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline scarphin

  • Lives here!
  • ****
  • Posts: 640
Re: Clang CC
« Reply #4 on: October 22, 2015, 12:37:02 am »
yvesdm3000: Considering this plugin can differentiate between a '.' and '->', the only reason preventing me to use it over cb's own cc is the non-threaded functionality. Unfortunately I'm not skilled enough to fix this but I will sure test your commits. Thanks for that.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #5 on: October 22, 2015, 05:14:47 am »
I want to make the base functionality work without freezes and crashes first before the introduction of a thread. The threading is also why I'm not using it for any other coding just yet, only using it to develop the plugin itself.

I'm also missing the "Find declaration"/"Find implementation" context menu items that are available in the basic CC functionality. There is only a "Resolve symbol (clang)" or something which is not really what you'd expect.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #6 on: October 31, 2015, 10:13:13 pm »
I have a reworked version that uses multi-threading now. Works pretty smoothly, but you need a long initial wait until you get code-completion, but that doesn't block the UI ! There is this bug where, initially, the file gets parsed a couple of times and you don't get code-completion when the file is being parsed. It's only when you load the project, after that it's fine. I'm aware of the issue.

https://github.com/yvesdm3000/ClangLib

I think I'll also need a separate configuration window to add Clang/Code-Completion specific compile flags and I figure having a configurable timeout on the code-completion operation might be handy for some people too.

As always constructive feedback is always welcome!

-Yves

Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline scarphin

  • Lives here!
  • ****
  • Posts: 640
Re: Clang CC
« Reply #7 on: November 01, 2015, 02:31:55 pm »
That looks nice, thanks. I couldn't find much time to try it recently but my workload is less nowadays and I'll check it out before giving feedback.

Btw are you working on this on a 64 or 32-bit environment? Last time I checked there was a weird bug (a buffer overflow or something) that occurs only on a 64-bit build. 32-bit didn't exhibit this behavior. I'll give more information when I try it. Thanks again.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #8 on: November 01, 2015, 08:06:31 pm »
64 bit with wxWindows 2.8

I'm now trying it on a Centos 5 with wxWindows 3.0 and it suffers from a couple of problems, mostly scintilla events not being received when editing the file so I advise you to use wx 2.8. It's mostly impacting the inline diagnostics not being updated. I'm looking at the c::b builtin codecompletion to see if I can take over their structure of c::b events to solve these problems.

Yves

Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline scarphin

  • Lives here!
  • ****
  • Posts: 640
Re: Clang CC
« Reply #9 on: November 02, 2015, 01:32:44 pm »
I had the time to try your changes and they work quite well. Good job. The long parsing time bug is there as you've previously stated. Apart from that I get the errors attached when it's parsing a big project (I tried it on a Qt project). I don't get these errors with small projects so I think it's some kind of a buffer limitation but I have no idea where to look, any ideas?

I may contribute some changes starting with the coloring of the information boxes but I'm not sure if each code completion plugin needs to have its own set of colors. I think they do because of the different coloring schemes for different languages. What do you think? I'll submit patches using the name 'Clang Code Completion' under color settings in 'settings->environment->colors'.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 640
Re: Clang CC
« Reply #10 on: November 02, 2015, 02:38:23 pm »
Oh, one more thing I forgot about. I had to add:
Code
#include <iostream>
to 'clangplugin.cpp' and 'translationunit.cpp' to build the plugin. I don't know why iostream were missing in those 2 files initially.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #11 on: November 02, 2015, 09:03:23 pm »
I'll add those includes. I guess my compiler (GCC 4.8) probably doesn't need them to be there.

I'm going to try the plugin on a 800mb sourcecode project tomorrow, a lot of files with over 5000 lines, big amount of defines+template code etc and see what happens. The builtin codecompletion plugin doesn't have any issue with the project, but it doesn't like the templating code at all, and I don't start about the defines...

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #12 on: November 02, 2015, 09:06:06 pm »
What do you think? I'll submit patches using the name 'Clang Code Completion' under color settings in 'settings->environment->colors'.

No problem for me as long as Alpha0010 and the other nice C::B guys approve.

-Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Clang CC
« Reply #13 on: November 03, 2015, 01:37:47 am »
Oh, one more thing I forgot about. I had to add:
Code
#include <iostream>
to 'clangplugin.cpp' and 'translationunit.cpp' to build the plugin. I don't know why iostream were missing in those 2 files initially.
Erm... why do we need iostream?  Logging/debug logging should be directed through C::B's log manager.

What do you think? I'll submit patches using the name 'Clang Code Completion' under color settings in 'settings->environment->colors'.
No problem for me as long as Alpha0010 and the other nice C::B guys approve.
I believe the main CC plugin already registers some colors; if possible, reuse those first.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Clang CC
« Reply #14 on: November 03, 2015, 01:43:07 am »
I may contribute some changes starting with the coloring of the information boxes but I'm not sure if each code completion plugin needs to have its own set of colors. I think they do because of the different coloring schemes for different languages. What do you think? I'll submit patches using the name 'Clang Code Completion' under color settings in 'settings->environment->colors'.
Can you give better details what colour do you need to define?
If you can make them generic it will be best.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]