News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Clang based CC, new CC interface

Started by Alpha, January 11, 2014, 01:45:53 AM

Previous topic - Next topic

Alpha

Quote from: thomas on January 16, 2014, 07:51:59 PM
You got a working Clang on Windows? How so?
I downloaded Clang for Windows form here, installed it, added the proper paths to the project file, and it just worked (which did actually surprise me).  Windows .cbp is now committed.

thomas

Oh wow... last time I checked, that page had something "Windows support is troublesome, but we have a 3.2 experimental build for MSVC only". I had tried their "build from source" instructions (using MinGW, but that failed miserably).

Great, I'll have a look, thank you :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

thomas

That doesn't seem to have anything like WinAPI headers (or libs) or even C++SL, need to copy those over from MinGW?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

killerbot

as for linux, distros have clang, but for a modern C++ developer  :P , you want to use C++11, and then the problem starts, you need their new libc++ library implementation.
As far as i know still hard or impossible to have that on linux, unless someones can tell me otherwise (an the how ) ...

MortenMacFly

Quote from: thomas on January 17, 2014, 11:42:15 AM
That doesn't seem to have anything like WinAPI headers (or libs) or even C++SL, need to copy those over from MinGW?
I've seen that, too - in fact I am monitoring this site. The thing is, you can and have to adjust the compiler config to make use of another compiler that provides those API. If I am not mistaken, this works well with that release for VC, but I doubt it will work reliable for MinGW. What I did was compiling clang itself using MinGW (based on Makefiles created for Code::Blocks using cmake) which ensure ABI compatibility with that compiler. Then you can adjust the compiler settings so they point to exactly this MinGW distribution - and have to add very low-level include folders so it actually FINDS the references. This depends on the standard used, so its really fiddling with settings.

Well - that's how far I came. Compiling a very basic app works, but I am far from compiling anything else than that. At linking time you'll see that (i.e.) wxWidgets needs better to be compiled with clang before, too. And so on...

Still a never-ending story. I'm afraid its still no prime time on Windows, yet. :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

thomas

#20
The way this download page looks, there should actually be C++ standard library somewhere. It starts with "sources", and among these is LibC++, which I assume is CLang's equivalent of glibc++. But I can't find it anywhere in the installed compiler. Be nice if they had something like "install instructions", hehehe...

So basically CLang seems to work, as long as you don't try anything like #include <algorithm> or #include <vector>. It compiles and links int main() { return 0; } lightning fast, too  :P. If only it worked for anything else as well...

Well, maybe in 3-4 months. They do seem to be working on getting something usable together.

QuoteWhat I did was compiling clang itself using MinGW
Sadly, wasting days and days on compiling compilers to no avail is something I can't afford any more :(
For me, it really has to work by unpacking a .tar.gz or a .zip file, or by double-clicking an installer.

(Or, in the most extreme case, a script that I need to run unattended (and leave the computer on over night) to do a fully automatic build. But that one had better work without guessing and trying afterwards.)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MortenMacFly

Quote from: thomas on January 17, 2014, 03:56:28 PM
So basically CLang seems to work, as long as you don't try anything like #include <algorithm> or #include <vector>. It compiles and links int main() { return 0; } lightning fast, too  :P. If only it worked for anything else as well...
That basically summarises my experience except hat I provided a C library through MinGW but the linker complained anyways.

Quote from: thomas on January 17, 2014, 03:56:28 PM
Well, maybe in 3-4 months. They do seem to be working on getting something usable together.
I am waiting ~1,5 years now.

Quote from: thomas on January 17, 2014, 03:56:28 PM
Sadly, wasting days and days on compiling compilers to no avail is something I can't afford any more :(
I never compiled compilers before at all, but this one is rather easy, as configuring, adjusting and start compiling takes ~10 minutes and uses Code::Blocks which works on Windows. Otherwise I wouldn't have wasted my time.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Quote from: Alpha on January 16, 2014, 10:26:17 PM
I downloaded Clang for Windows form here, installed it, added the proper paths to the project file, and it just worked (which did actually surprise me).
Oh, sorry, I should have specified.  By 'worked' I was referring to linking with this plugin, and providing access to its AST and CC.

When initializing a unit with libclang, it takes flags as if compiling through the console.  As part of the flags, my plugin passes it the search paths of MinGW's headers.  Because that seems to have worked in the plugin, maybe it will work for compiling as well... I will do some tests.

Ivan171

Hi, i'm new to the forum. First of all english is not my native language, so, bear with me.

Well, my experience with clang is not that bad. Everything i've tried to compile with it up to now, have worked pretty well (Although i use it mostly for testing purposes at the moment). Including C++, which i see a lot of people saying it doesn't work on Windows. It does work. At the moment, Clang from svn, is able to bootstrap on Windows (using Mingw 4.7+).

But it have some issues, like, dllimport/dllexport does not work for classes. It doesn't support Win64 EH (There's no exceptions at all on Windows 64). This issues is being worked on by the way.

Clang 3.4 does not work with Mingw 4.7+ due to ABI incompatibilities.

Alpha

A few glamour shots of this plugin.

Operator resolution (also right click, jump to declaration works).


Syntax highlighting in documentation popups.


Dynamic checking of code validity.

dmoore

Looks terrific (btw, you can also use the README.md or README.rst to embed screen shots  on the github page using a dir in your repo to place the images. Nice feature of github IMO)

I am sure I could figure out myself, but...

* Which docstring formats are you able to highlight code for? (What tool are you using to do the highlighting?)

* Is the dynamic check highlighting a scintilla feature (can they be hidden by clicking on them or something?) Are you making hooks in the CC manager to make this easy for all plugins to do? (Or is it easy to do without hooks). I want to do something similar for python.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Folco

Kernel Extremist - PedroM power ©

oBFusCATed

The last image is interesting. Can you try to explain how it works and what kind of API do you use?
(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!]

dmoore

Quote from: oBFusCATed on January 29, 2014, 09:52:51 PM
The last image is interesting. Can you try to explain how it works and what kind of API do you use?

Looks like just an editor hook, then uses wxScintilla annotations:

See, esp. DiagnoseEd, in https://github.com/alpha0010/ClangLib/commit/6a0c09cf1cd39448d6fa6d022afd9f3a0bed6ebb#diff-2c47c86d730d3c95d68ec3fa39ad7e7bR719

Would be nice if some of this moved out of the plugin and into the SDK, but I haven't thought about how practical that is.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

oBFusCATed

100% should be part of the SDK...
Does clang provide both CC info + errors/warnings info with a single compile/parse?
(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!]