[cfe-dev] Serialize/Deserialize AST without original headers.
Dmitri Gribenko
gribozavr at gmail.com
Fri Feb 14 17:40:08 PST 2014
On Fri, Feb 14, 2014 at 9:51 PM, Alejandro Jimenez <whilealex at gmail.com> wrote:
> Hi
> I am trying to implement a big set of API + overloads around 10k
> instructions in a library. I want to minimize the parsing cost, so my
> approach was to pre generate an ast of my library using clang.
>
> clang -x c++ -emit-ast mylibrary.h -o redistributable.ast
>
> I plan to make this binary file redistributable along with my aplication.
>
> Problem:
>
> When I am loading the files from a different machine, it no longer works,
> since I think the ast binary is linked to the original sources that are no
> longer redistributed. Is there any way to avoid this link?
This is by design and will be probably very hard to change. Not only
Clang wants to print diagnostics referencing lines from the original
header file (obviously), but sometimes it needs to re-tokenize
something even when there are no errors, as far as I remember.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-dev
mailing list