From e93866800330987d31579ae2fb2a323ba46ffecf Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 13 Aug 2010 05:36:37 +0000 Subject: Implement clang_saveTranslationUnit(), which saves a translation unit into a PCH/AST file. llvm-svn: 111006 --- clang/include/clang-c/Index.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'clang/include/clang-c') diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index b3141f2dfe9..4216e96c604 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -764,6 +764,26 @@ CINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx, unsigned num_unsaved_files, unsigned options); +/** + * \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. + * + * \returns Zero if the translation unit was saved successfully, a + * non-zero value otherwise. + */ +CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, + const char *FileName); + /** * \brief Destroy the specified CXTranslationUnit object. */ -- cgit v1.2.3