diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-07-06 16:43:36 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-07-06 16:43:36 +0000 |
| commit | 30c80fa3eb5cd162699a6a685a21a72e28e4548d (patch) | |
| tree | ab0b2d90f8d2def9cf190b31e45ca8cdb3aeea7e /clang/include/clang-c | |
| parent | b4836ea7a8817b7fe02267c94c38ae028ac3b3c1 (diff) | |
| download | bcm5719-llvm-30c80fa3eb5cd162699a6a685a21a72e28e4548d.tar.gz bcm5719-llvm-30c80fa3eb5cd162699a6a685a21a72e28e4548d.zip | |
libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.
llvm-svn: 134495
Diffstat (limited to 'clang/include/clang-c')
| -rw-r--r-- | clang/include/clang-c/Index.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 01e7bce6bd4..5bf20316b12 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -933,6 +933,41 @@ enum CXSaveTranslationUnit_Flags { CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); /** + * \brief Describes the kind of error that occurred (if any) in a call to + * \c clang_saveTranslationUnit(). + */ +enum CXSaveError { + /** + * \brief Indicates that no error occurred while saving a translation unit. + */ + CXSaveError_None = 0, + + /** + * \brief Indicates that an unknown error occurred while attempting to save + * the file. + * + * This error typically indicates that file I/O failed when attempting to + * write the file. + */ + CXSaveError_Unknown = 1, + + /** + * \brief Indicates that errors during translation prevented this attempt + * to save the translation unit. + * + * Errors that prevent the translation unit from being saved can be + * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). + */ + CXSaveError_TranslationErrors = 2, + + /** + * \brief Indicates that the translation unit to be saved was somehow + * invalid (e.g., NULL). + */ + CXSaveError_InvalidTU = 3 +}; + +/** * \brief Saves a translation unit into a serialized representation of * that translation unit on disk. * @@ -951,8 +986,9 @@ CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); * is saved. This should be a bitwise OR of the * CXSaveTranslationUnit_XXX flags. * - * \returns Zero if the translation unit was saved successfully, a - * non-zero value otherwise. + * \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. */ CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, const char *FileName, |

