clang(libclang) performance of parse/reparse Translation Unit
Asked Answered
N

0

7

I have a question about parsing performance, when using clang(libclang) and particulary function clang_parseTranslationUnit and clang_reparseTranslationUnit.

I'm trying to optimize the process, but I'm really out of ideas already. The situation is following - I have a .cpp source, that includes a lot of header files. This headers change very seldom. However the .cpp source changes a lot and I need to reparse it often. So, there is a possibility to "preparse/precompile" all the headers and create .pch file, and then use it when parsing .cpp. However, the problem is that, I can use only one .pch. So, I need to create a .pch from all the included headers. However, later, when I include some other header file, I need to reparse all the headers, even though they hadn't changed at all. Also, this is problem, that I need explicitly know, what headers are included in the .cpp (this is not very convenient, as this would mean, I have to scan at least for includes myself, and then create a .pch and then use it, when parsing the .cpp source).

Is there any other option to optimize the process? I hoped that, when I use clang_parseTranslationUnit and later clang_reparseTranslationUnit, the parsing will be optimized in this way actually (at least all the headers, that hadn't changed, do not need to be reparsed again). But, it doesn't work like that.

Nightgown answered 10/11, 2011 at 8:30 Comment(1)
Did you try pre-compiled header?Platyhelminth

© 2022 - 2024 — McMap. All rights reserved.