[PATCH] D54547: PTH-- Remove feature entirely-

Vladimir Voskresensky via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 10:50:50 PST 2018


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





More information about the cfe-commits mailing list