Author Topic: Clang CC  (Read 18708 times)

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1087
Re: Clang CC
« Reply #180 on: November 01, 2016, 12:17:40 pm »
i made the clean up, but i can't test it because i am not able to compiler clang probably into a shared monolithic library... Still working on it, but with not much hope...


greetings

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #181 on: December 09, 2016, 01:30:29 pm »
I pushed a cleanedup version of the codeblocks project for Windows + fixed some path issues for Windows.

Been using the plugin for a while on the windows version and no issues encountered for now.

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9650
Re: Clang CC
« Reply #182 on: December 09, 2016, 09:06:07 pm »
How does this plugin gather and feed the files and flags to clang?
Can it use a compiler database?
<debugger plugin maintainer>
(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!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #183 on: December 09, 2016, 09:42:33 pm »
Hi Obfuscated,

It gathers the compile command from codeblocks for GCC or clang.
I'm currently working on a new feature to output the 'compiler_commands.json' file so that we can use the clang tools without the need to rebuild this database with external tools.

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9650
Re: Clang CC
« Reply #184 on: December 10, 2016, 12:58:13 am »
I don't have a proper project, but a cmake ninja based one. Cmake can generate the correct database. So it will be useful if the cc plugin can use it to do its parsing.

p.s. it is not a good idea to put the generation of the compile_command.json in the clangcc plugin. It is best done as script when the scripting api is expanded or as another plugin or even as a core feature.
<debugger plugin maintainer>
(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!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #185 on: December 10, 2016, 08:47:34 am »
Yes I was allready thinking about splitting off this feature since it's not directly using anything from libclang itself, it's currently only recycling some plugin internal utility function. I'm glad you agree.

While using the clang codecompletion I noticed the plugin doesn't handle paths with spaces correctly yet, so that will be fixed soon.

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

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #186 on: December 10, 2016, 01:23:08 pm »
How does this plugin gather and feed the files and flags to clang?
Can it use a compiler database?

I guess you are need the compilation flags to come out of the compiler_commands.json that is generated from ninja ?

It can't do that right now, but I can't imagine it's difficult to add.

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9650
Re: Clang CC
« Reply #187 on: December 10, 2016, 02:02:44 pm »
I guess you are need the compilation flags to come out of the compiler_commands.json that is generated from ninja ?
Yes, the cb project generated by cmake doesn't contain flags (it is custom makefile based project), so the cc will have very hard time gathering them.
Probably we can add a field in the project with the path of the compilation database and then the CC could use it.
We can also teach other tools and plugins to use it.
<debugger plugin maintainer>
(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!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #188 on: December 10, 2016, 05:39:50 pm »
I guess you are need the compilation flags to come out of the compiler_commands.json that is generated from ninja ?
Yes, the cb project generated by cmake doesn't contain flags (it is custom makefile based project), so the cc will have very hard time gathering them.
Probably we can add a field in the project with the path of the compilation database and then the CC could use it.
We can also teach other tools and plugins to use it.
My main job's project is also using a custom makefile. I simply mirror the compiler options enough so that ClangCC is working fine. To change options, i switch from custom makefile to cb, set an option and then toggle the custom makefile option back to 'on'. I'm not sure this is a bug in cb to be able to query the compile options when the custom makefile option is on but it sure is handy for me.

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

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #189 on: January 09, 2017, 07:42:50 am »
Pushed a new feature on the 'staging' branch where for each #include, it now adds a warning/error in case the specified header has a warning/error.

I doesn't work (yet) with multiple levels though (a header that includes a header that includes a header that has an error). I specifically didn't do this yet because it should filter out system headers for warnings (passed with -isystem) and the programmer isn't supposed to fix warnings in system headers..

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

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 162
Re: Clang CC
« Reply #190 on: January 10, 2017, 09:42:57 pm »
I guess you are need the compilation flags to come out of the compiler_commands.json that is generated from ninja ?
Yes, the cb project generated by cmake doesn't contain flags (it is custom makefile based project), so the cc will have very hard time gathering them.
Probably we can add a field in the project with the path of the compilation database and then the CC could use it.
We can also teach other tools and plugins to use it.

FYI next thing I'm implementing is support for this compiler_commands.json file

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