Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » theide with libclang
theide with libclang [message #58579] Sun, 26 June 2022 09:32 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
In https://github.com/ultimatepp/ultimatepp/tree/llbm_ide branch there lives my recent development effort of integrating theide with libclang.

Now I can proudly announce that I have reached the first milestone: libclang autocomplete is now integrated well enough for me to actually start using this version of theide. Did not tested/fixed outside of windows yet though... (that said, windows seems the most complicated as we have to provide libclang.dll to the release).

Anyway, I would appreciate some more testers for this. In order to compile/use this version in windows, you need libclang.dll from official llvm release and you will also need to add include/lib paths to build method (in future, this will be coming with theide).

Mirek

[Updated on: Thu, 07 July 2022 15:29]

Report message to a moderator

Re: theide with libclang, first milestone finished [message #58580 is a reply to message #58579] Sun, 26 June 2022 12:53 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1092
Registered: August 2007
Senior Contributor
Hello Mirek,


I've succesfully compiled the branch on Linux, however, it doesn't seem to work at all. (No assist/code completion, etc...)

(Linux 5.18, GNOME 42.1 (Wayland), LLVM/CLANG 13.0.1 (x64))

Keep in mind that this was just a quick test, Later I'll do some more...


Best regards,
Oblivion


Re: theide with libclang, first milestone finished [message #58581 is a reply to message #58580] Sun, 26 June 2022 14:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Oblivion wrote on Sun, 26 June 2022 12:53
Hello Mirek,


I've succesfully compiled the branch on Linux, however, it doesn't seem to work at all. (No assist/code completion, etc...)

(Linux 5.18, GNOME 42.1 (Wayland), LLVM/CLANG 13.0.1 (x64))

Keep in mind that this was just a quick test, Later I'll do some more...


Best regards,
Oblivion


Probably RedefineMacros() function problems - in linux, I believe it should not be there at all.
Re: theide with libclang, first milestone finished [message #58582 is a reply to message #58581] Sun, 26 June 2022 16:37 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

Good news! I will test when it will be compatible with Linux.

Klugier


U++ - one framework to rule them all.
Re: theide with libclang, first milestone finished [message #58583 is a reply to message #58582] Sun, 26 June 2022 18:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, good news and bad news (for now):

The problem is caused by CXTranslationUnit_PrecompiledPreamble flag for clang parser. For some reason, when I specify this in Linux, libclang ignores #includes.

Without this flag, it now works. Downside is that it is much slower than in Win32 where CXTranslationUnit_PrecompiledPreamble works...

Now I am pretty sure this must be some problem of my code, as you are actually supposed to use this and I bet other ides are using this flag. But so far I was not able to crack it...

Anyway, you should now be able to test it, hopefully, for initial impressions.

[Updated on: Sun, 26 June 2022 18:08]

Report message to a moderator

Re: theide with libclang, first milestone finished [message #58584 is a reply to message #58583] Mon, 27 June 2022 10:58 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I must be missing something here... Compilation fails with:
C:\upp-git\upp.src\uppsrc\ide/clang/clang.h (5): fatal error C1083: Cannot open include file: 'clang-c/Index.h': No such file or directory


Best regards,

Tom

EDIT: This is on Windows using MSBT22x64 and the same happens with CLANGx64.

[Updated on: Mon, 27 June 2022 10:59]

Report message to a moderator

Re: theide with libclang, first milestone finished [message #58585 is a reply to message #58584] Mon, 27 June 2022 11:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Mon, 27 June 2022 10:58
Hi,

I must be missing something here... Compilation fails with:
C:\upp-git\upp.src\uppsrc\ide/clang/clang.h (5): fatal error C1083: Cannot open include file: 'clang-c/Index.h': No such file or directory


Best regards,

Tom

EDIT: This is on Windows using MSBT22x64 and the same happens with CLANGx64.


It is using LLVM, so you need to have LLVM installed and paths properly set (in build method), libclang.dll has to be in the same dir as the new theide.exe.

Alternatively, you can wait before it becomes part of nightly (in the beginning, I plan to just add .dll and part of llvm sdk so that you can build llbm_ide out of box).
Re: theide with libclang, first milestone finished [message #58586 is a reply to message #58585] Mon, 27 June 2022 11:25 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
OK, I see. Maybe I'll wait a while, until it becomes part of nightly with those dependencies and settings included...

Thanks and best regards,

Tom
Re: theide with libclang, first milestone finished [message #58587 is a reply to message #58586] Mon, 27 June 2022 14:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Mon, 27 June 2022 11:25
OK, I see. Maybe I'll wait a while, until it becomes part of nightly with those dependencies and settings included...

Thanks and best regards,

Tom


That might take a while, I do not think I will merge before everything else is changed to use libclang (like navigator, Alt+J etc...)

Mirek
Re: theide with libclang, first milestone finished [message #58607 is a reply to message #58587] Sun, 03 July 2022 05:28 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Linux:
ultimatepp/uppsrc/ide/clang/clang.cpp:105:2: error: expected expression
        DDUMP(cmdline);
        ^


Regards,
Novo
Re: theide with libclang, first milestone finished [message #58612 is a reply to message #58579] Sun, 03 July 2022 16:19 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I checked a clang-enabled version of TheIDE in Linux (debug version).
It is using 100% of CPU all the time. Initially, I thought that this is Clang indexing UPP files, but after waiting for 50 minutes I figured out that this must be a bug with TheIDE.


Regards,
Novo
Re: theide with libclang, first milestone finished [message #58616 is a reply to message #58612] Mon, 04 July 2022 00:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Sun, 03 July 2022 16:19
I checked a clang-enabled version of TheIDE in Linux (debug version).
It is using 100% of CPU all the time. Initially, I thought that this is Clang indexing UPP files, but after waiting for 50 minutes I figured out that this must be a bug with TheIDE.


Yeah, that is temporary issue, it is fixed in latest version (hopefully).

Mirek
Re: theide with libclang, first milestone finished [message #58626 is a reply to message #58616] Thu, 07 July 2022 13:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
So after developing this in Windows for a while (the hardest part now is to make clang obtained code references compatible with existing topic++ documentation) I have returned to try to fix linux issue with preamble and to my surprise it worked immediately, so probably something I have accidentally fixed in Windows.

Can please somebody retest in Linux? I believe autocomplete works now great (I mean, fast enough).

BTW, one hard job I would be happy to delegate is changing installation scripts to accound for libclang - or maybe even lack of it.

Mirek
Re: theide with libclang [message #58627 is a reply to message #58579] Thu, 07 July 2022 15:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Second milestone finished: File annotations and Topic++ (I mean, those documentation boxes in the left bar) are now clang based.

Moving on to third milestone: Alt+C, hopefully this one will be easier...
Re: theide with libclang, first milestone finished [message #58628 is a reply to message #58626] Thu, 07 July 2022 16:33 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Thu, 07 July 2022 07:23
Can please somebody retest in Linux? I believe autocomplete works now great (I mean, fast enough).

"make -f umkMakefile" - works.
Regular "make" (build TheIDE) didn't work (problem with linking).

Problem with CPU is fixed.
Autocomplete doesn't work for me. For example:
WStringBuffer txt;
txt.

Dot won't be autocompled. Ctrl+Space doesn't help either. I also tried autocomplete with TAB.
To be fair, I never used autocomplete with TheIDE before, but I use it with VIM all the time.


Regards,
Novo
Re: theide with libclang, first milestone finished [message #58629 is a reply to message #58628] Thu, 07 July 2022 17:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Thu, 07 July 2022 16:33
mirek wrote on Thu, 07 July 2022 07:23
Can please somebody retest in Linux? I believe autocomplete works now great (I mean, fast enough).

"make -f umkMakefile" - works.
Regular "make" (build TheIDE) didn't work (problem with linking).

Problem with CPU is fixed.
Autocomplete doesn't work for me. For example:
WStringBuffer txt;
txt.

Dot won't be autocompled. Ctrl+Space doesn't help either. I also tried autocomplete with TAB.
To be fair, I never used autocomplete with TheIDE before, but I use it with VIM all the time.


That is weird. Looks like the whole thing is somewhat fragile in Linux Sad

Are you testing latest llbm_ide branch, right? (make reference is confusing me a bit)

Mirek
Re: theide with libclang, first milestone finished [message #58630 is a reply to message #58629] Thu, 07 July 2022 17:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Can you test removing "CXTranslationUnit_PrecompiledPreamble" from sources (you will easily find where)?
Re: theide with libclang, first milestone finished [message #58631 is a reply to message #58629] Thu, 07 July 2022 18:00 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Thu, 07 July 2022 11:01

Are you testing latest llbm_ide branch, right? (make reference is confusing me a bit)

Yes, I'm using the llbm_ide branch. Last time I tested against rev. 14dad3e.
The only possible problem I can imagine is that I copied .config (all of it) from the previous version of TheIDE.


Regards,
Novo
Re: theide with libclang, first milestone finished [message #58632 is a reply to message #58630] Thu, 07 July 2022 18:41 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Thu, 07 July 2022 11:02
Can you test removing "CXTranslationUnit_PrecompiledPreamble" from sources (you will easily find where)?

I checked that. Removing "CXTranslationUnit_PrecompiledPreamble" doesn't make any difference.
Ctrl+Space uses string on the left as a prefix for search.
Dot doesn't trigger method autocomplition.

Interestingly, umk doesn't check dependencies anymore. I need to "rebuild all" each time.


Regards,
Novo
Re: theide with libclang, first milestone finished [message #58633 is a reply to message #58632] Thu, 07 July 2022 18:49 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
So Ctrl+Space does show something?

You can also try something selfcontained (no headers) like

struct Foo { int x; };

void foo() { Foo(). };


Mirek
Previous Topic: Impressive improvement in stl::vector when dealing with raw memory.
Next Topic: about unicode supporting
Goto Forum:
  


Current Time: Tue Apr 23 13:55:43 CEST 2024

Total time taken to generate the page: 0.02318 seconds