PTH vs PCH usage

Hello,

What kind of caching (i.e. for Indexing) should be used if Clang is to be used from IDE-like applications for completion/x-ref features?
Does PCH is the right thing to use in such situations (at least I see it mentioned in documentation for clang_createIndex)?

What is the status of PTH? Is it live or deprecated?
Should it be used in interactive applications as cache mechanism as well?

Thanks,
Vladimir.

Hello,

What kind of caching (i.e. for Indexing) should be used if Clang is to
be used from IDE-like applications for completion/x-ref features?
Does PCH is the right thing to use in such situations (at least I see it
mentioned in documentation for clang_createIndex)?

PCH provides the best build-time and indexing-time improvements. I strongly recommend using it if you can, although it often requires that the user intervene by creating a prefix header that you can precompile.

What is the status of PTH? Is it live or deprecated?

It's live. Performance gains from PTH are fairly limited… IIRC they were in the 10-20% range, which is far below what we tend to see with PCH.

Should it be used in interactive applications as cache mechanism as well?

This idea has come up, although I don't know if anyone has tried it. Presumably, one could use PTH on all of the header files and then PCH for the prefix header, since the mechanisms compose.

  - Doug

Thanks for info.
Btw, any hints where to look in clang APIs/Impl for parts to be used for supporting fast incremental reparse/index-update in client which control editor/file changes?

Thanks,
Vladimir.

Thanks for info.
Btw, any hints where to look in clang APIs/Impl for parts to be used for supporting fast incremental reparse/index-update in client which control editor/file changes?

You can check out libclang's support for precompiled preambles, which implicitly create a precompiled header up to and including the last #include of the main source file. It's useful when reparsing that source file many times, e.g., during editing.

  - Doug

Thanks. Will have a look.
Vladimir.