Hi,
I invoke CDT programmatically on a large number of variants of small pieces of code and it tooks a loooong time. I am looking for way to factorize the initialization of other tricks to reduce this time.
Currently I invoke for each variant this method:
private IASTTranslationUnit getTranslationUnit(String code, File currentDir, IIncludeFileResolutionHeuristics includeFileResolutionHeuristics) throws AstNotBuiltException {
if (code == null) { throw new IllegalArgumentException("Null code given"); }
// FIXME it avoids temporarily a ClassNotFoundException
code = takeOutDateAndTimeMacros(code);
CodeReader reader = CPreprocessorParser.getReader(code);
Map definedSymbols = new HashMap();
IScannerInfo info = new ScannerInfo(definedSymbols, headerPathProvider.getIncludePath().toArray);
AbstractCodeReaderFactory readerFactory = new MyCodeReaderFactory(includeFileResolutionHeuristics);
try {
IASTTranslationUnit translationUnit = GCCLanguage.getDefault().getASTTranslationUnit(reader, info, readerFactory, null, log);
return translationUnit;
} catch (Throwable t) {
throw new AstNotBuiltException(t);
}
}