|
|
Home » Developing U++ » U++ Developers corner » theide with libclang
|
Re: theide with libclang [message #59094 is a reply to message #59076] |
Tue, 01 November 2022 23:32   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Thank you, Mirek! Both are fixed in UPP version 16523.
Another bug I found a few weeks (maybe months) ago. I tested with version 16523 and it's still there.
To reproduce the experience, move away or rename libclang.so/dll etc so that it cannot be detected when theide starts. Or, change
bool TryLoadLibClang()
at line 120 in <ide/main.cpp> to fail the LibClang loading:
bool TryLoadLibClang()
{
// add the following line to
return false; // make sure detection fails.
String libdir = TrimBoth(Sys("llvm-config --libdir"));
int q = FindIndex(CommandLine(), "--clangdir");
if(q >= 0 && q + 1 < CommandLine().GetCount()) {
libdir = CommandLine()[q + 1];
CommandLineRemove(q, 2);
}
if(LoadLibClang(libdir))
return true;
if(LoadLibClang("/usr/lib"))
return true;
for(int i = 200; i >= 10; i--)
if(LoadLibClang("/usr/lib/llvm-" + AsString(i) + "/lib"))
return true;
return false;
}
F5 to compile and run the modified theide, in it, open button.cpp from <examples/Button>, left click on, for example the word 'TopWindow', the assist++ will start a dialog that will never end unless cancelled.
I am not sure if there are other occassions like this when assist++ will be started by some other key combinations or mouse events, even though theide knows and even prompted the end users of "libclang detection failure". This is no longer bothering me, but could confuse a person who starts to try UPP.
[Updated on: Wed, 02 November 2022 00:22] Report message to a moderator
|
|
|
Re: theide with libclang [message #59096 is a reply to message #59094] |
Wed, 02 November 2022 00:15   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Another more like a feature request:
Take for example, the following code:
class Person
{
int age_;
public:
int get_age()const { return age_; }
void set_age(int age){ age_ = age; }
__declspec(property(get=get_age, put = set_age)) int age;
};
theide/Assist++ will put a red rect at the beginning of __declspec, with error message ...'__declspec' attributes are not enabled; use '-fdeclspec'..., even though the flag has been turned on. This is kind of a fictitious example. The real issue here is, the flags I set in "Setup > Build Methods" for CLANG, under common c++ options
-std=c++20 -Wno-logical-op-parentheses -fdeclspec
is not respected by assist++.
So if someone wants to try some c++20 new language features, assist++ will stick to builtin option of '-std=c++14' and keep bugging him.
[Updated on: Wed, 02 November 2022 00:17] Report message to a moderator
|
|
|
|
Re: theide with libclang [message #59100 is a reply to message #59096] |
Wed, 02 November 2022 10:21   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Wed, 02 November 2022 00:15Another more like a feature request:
Take for example, the following code:
class Person
{
int age_;
public:
int get_age()const { return age_; }
void set_age(int age){ age_ = age; }
__declspec(property(get=get_age, put = set_age)) int age;
};
theide/Assist++ will put a red rect at the beginning of __declspec, with error message ...'__declspec' attributes are not enabled; use '-fdeclspec'..., even though the flag has been turned on. This is kind of a fictitious example. The real issue here is, the flags I set in "Setup > Build Methods" for CLANG, under common c++ options
-std=c++20 -Wno-logical-op-parentheses -fdeclspec
is not respected by assist++.
So if someone wants to try some c++20 new language features, assist++ will stick to builtin option of '-std=c++14' and keep bugging him.
Well, this will be a bit complicated: We are not sure that libclang version is able to support -std=c++20.... Any ideas?
(In general, libclang is not the same thing as clang, so we cannot really use options from build method... Adding " -Wno-logical-op-parentheses -fdeclspec" as fixed options makes sense though.)
Mirek
|
|
|
Re: theide with libclang [message #59103 is a reply to message #59097] |
Wed, 02 November 2022 15:58   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Wed, 02 November 2022 01:58It might be something messed up in my system.
Quote:
Any chance you are trying to search in very long file? In that case, incremental search is disabled (and you need to push "Find next" button).
No.
Quote:
Do you see bottom bar with text?
Yes.
Quote:
Can you type text into into the field?
Yes.
Quote:
Have you tried pressing next/previous buttons?
Yes, nothing happen. O occurrence, or something like that.
Quote:
What about Find in files?
This has always worked fine.
By the way, if I don't go through the menu, but use Ctrl+F instead, I receive a ding, but nothing happen afterwards, not even the text field for entering text to be searched.
I have overwritten the previous compiled version of ide. Above replies are according to my memory. I don't think they matter any more since that problem might be unique to me.
I have installed 22.10 in Virtual Box and tested:

all seems fine 
(On the positively negative note, theide crashed the first time I have run it. I have noticed this before in Windows, so now it is officially a new phantom bug to fix...)
[Updated on: Wed, 02 November 2022 16:00] Report message to a moderator
|
|
|
|
|
Re: theide with libclang [message #59110 is a reply to message #59106] |
Thu, 03 November 2022 20:06   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
additional c++ options for libclang works like a charm in most recent version 16528.
The setting is through:
Main Menu: Setup -> Settings ...
in Assist tab
Second last item "libclang additional options"
After I set it to
-Wno-logical-op-parentheses -std=c++20 -fdeclspec the following sample code are properly understood by Assist++
class Person
{
int age_;
public:
int get_age()const { return age_; }
void set_age(int age){ age_ = age; }
__declspec(property(get=get_age, put = set_age)) int age;
};
template <class T>
concept A = requires(T t) {
++t;
};
Wonderful! Imaging how much work it will involve if libclang is not used and we have to update the homegrown c++ parser to provide intellisense to the ever-updating c++ language.
I remember a while ago I dug into the parser while trying to add support to attribute: it is so complicated and involving that I had to give up.
It's great to see that libclang-powered assist++ becomes quite usable in rapid pace.
[Updated on: Thu, 03 November 2022 20:10] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: theide with libclang [message #59207 is a reply to message #59205] |
Thu, 24 November 2022 03:12  |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
mirek wrote on Wed, 23 November 2022 04:46Lance wrote on Wed, 23 November 2022 00:44Hi Mirek:
In dark theme, the error texts is not legible.

BR,
Lance
Hopefully fixed, thanks for reporting.
Thanks for the quick response. I will check github tomorrow. Version 16566 as of now still not fixed.
PS: Just compiled ver 16575. The problem is gone. Thanks!
[Updated on: Sat, 26 November 2022 01:07] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:02:32 CEST 2025
Total time taken to generate the page: 0.01298 seconds
|
|
|