voskresensky.vladimir added a comment.

I have some experience with PTH implementation, because had to fix it for 
Java-port of Clang (https://github.com/java-port/clank).

It was sometime ago, but making it completely workable was not hard.
As I remember the key fix was just to have PTH be EMITTED using raw-Lex mode 
(where real keyword-IDs are not used, so all Token Kinds nicely fit 8-bits).
It worked, because on token automatically became keyword by PTHLexer::Lex:
...

     // Change the kind of this identifier to the appropriate token kind, e.g.
     // turning "for" into a keyword.
  Tok.setKind(II->getTokenID());

...

We used PTH, because multiple translation units are parsed in the context of 
single run.
In this case preprocessing phase was be upto 10x faster when take token stream 
was deserialized from PTH (i.e. for all system headers lexed once).
Also it was also helpful, because we were able to parse from concurrent thread 
using the same shared immutable PTH.

I thought clang-d service is using it to speed up indexing.


https://reviews.llvm.org/D54547



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to