[Kde-bindings] smokegen on clang

Arno Rehn arno at arnorehn.de
Sun Sep 6 13:04:53 UTC 2015


Hi Chris,

On 02/09/15 02:33, Chris Burel wrote:
> Hey guys,
> It seems that the smoke library isn't actively being maintained, and the
> current smokegen tool doesn't successfully parse the Qt5 headers anymore.
> I was wondering if anyone has considered using clang's libraries to parse
> the Qt5 headers, and generate the smoke libraries that way.  IIRC,
> smokegen's parser is based on kdevelop's parser that was written for syntax
> highlighting, and was presumably forked from that project some time ago, so
> as new language features are added, smokegen will lag behind.  Granted,
> clang is a moving target too, as its API changes frequently, but it does
> seem like smokegen could use the RecursiveASTVisitor and be a lot less code
> to maintain.
In theory, yes, using clang's parser would probably be a good idea. 
Nevertheless, I see (at least) two problems:

First, as you already said, clang is a moving target. The API breaks 
with practically every release and always adjustung smokegen to work 
with the latest clang can be quite a burden. I've worked a little with 
and on the crack programming language (crack-lang.org) which is based on 
LLVM. New releases of LLVM always involved some porting overhead. 
Sometimes minor, but sometimes huge.
Now LLVM isn't clang, but I doubt that the clang API is any more stable.

Second, I don't know how to handle the Qt macros like "signals", 
"slots", etc. which expand to basic C++ (or even nothing at all). Maybe 
a proper handling would need some extensions to the parser itself.

Both points could be solved by forking a version of clang's parser, but 
I think that would kind of defeat the purpose...

Regards,

-- 
Arno Rehn


More information about the Kde-bindings mailing list