Page 1 of 1
clang completion undefining builtin defines
Posted: Sun Jan 08, 2017 6:40 pm
by Tomeamis
Hello,
when using Clang code completion, there is a way to specify command line defines (-D<macro>) in the project settings.
Is there a way to undefine sumething (-U<macro>)? I need this to work around platform detection macros.
A way to specify -nostdinc would also be nice, but is not completely necessary for me.
Thanks.
Re: clang completion undefining builtin defines
Posted: Mon Jan 09, 2017 9:24 am
by eranif
When using clang code completion, CodeLite passes to libclang the exact build line from the project settings.
i.e. you just need to create a build configuration with the proper settings - you don't need to do something special for making clang work
Re: clang completion undefining builtin defines
Posted: Tue Jan 10, 2017 2:13 am
by Tomeamis
Unfortunately, it doesn't seem to work.
If you unpack the attached archive, on line 17 clang suggests bar after the dot, but thanks to the -U__GNUC__ in the project settings,
it should suggest baz. If you accept the completion and build the project, you get a compilation error, because bar is not a member of the struct.
Also, how would it be possible to specify undefs in projects with custom Makefiles?
Re: clang completion undefining builtin defines
Posted: Tue Jan 10, 2017 10:10 am
by eranif
Thanks for providing a sample workspace.
Indeed, the -U was not passed to libclang so it was always defined which caused the wrong entry to show in the code completion.
This is now fixed in git master and will be available in the next weekly build (or you can build your own CodeLite from git)