/** * \brief 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. * * \param TU The translation unit to save. * * \param FileName The file to which the translation unit will be saved. * * \param 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. */ func (tu TranslationUnit) Save(fname string, options uint) uint32 { cstr := C.CString(fname) defer C.free(unsafe.Pointer(cstr)) o := C.clang_saveTranslationUnit(tu.c, cstr, C.uint(options)) // FIXME: should be a SaveError type... return uint32(o) }
/* 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 CXTranslationUnit with 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. Parameter TU The translation unit to save. Parameter FileName The file to which the translation unit will be saved. Parameter 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. */ func (tu TranslationUnit) SaveTranslationUnit(fileName string, options uint32) int32 { c_fileName := C.CString(fileName) defer C.free(unsafe.Pointer(c_fileName)) return int32(C.clang_saveTranslationUnit(tu.c, c_fileName, C.uint(options))) }