ΒΆint clang_saveTranslationUnit(
    CXTranslationUnit TU,
    const char* FileName,
    unsigned int options)

Description

Saves a translation unit into a serialized representation of that translation unit on disk. Any translation unit that was parsed without error can be saved into a file. The translation unit can then be deserialized into a new \c CXTranslationUnit with \c clang_createTranslationUnit() or, if it is an incomplete translation unit that corresponds to a header, used as a precompiled header when parsing other translation units.

Declared at: clang/include/clang-c/Index.h:1518

Parameters

CXTranslationUnit TU
The translation unit to save.
const char* FileName
The file to which the translation unit will be saved.
unsigned int options
A bitmask of options that affects how the translation unit is saved. This should be a bitwise OR of the CXSaveTranslationUnit_XXX flags.

Returns

A value that will match one of the enumerators of the CXSaveError enumeration. Zero (CXSaveError_None) indicates that the translation unit was saved successfully, while a non-zero value indicates that a problem occurred.