[cfe-commits] r144269 - in /cfe/trunk: include/clang-c/ include/clang/Frontend/ lib/Frontend/ tools/c-index-test/ tools/libclang/

Ted Kremenek kremenek at apple.com
Thu Nov 10 10:40:26 PST 2011


On Nov 10, 2011, at 10:32 AM, Argyrios Kyrtzidis wrote:

>> + */
>> +enum CXLoadDiag_Error {
>> +  /**
>> +   * \brief Indicates that no error occurred.
>> +   */
>> +  CXLoadDiag_None = 0,
>> +  
>> +  /**
>> +   * \brief Indicates that an unknown error occurred while attempting to
>> +   * deserialize diagnostics.
>> +   */
>> +  CXLoadDiag_Unknown = 1,
>> +  
>> +  /**
>> +   * \brief Indicates that the file containing the serialized diagnostics
>> +   * could not be opened.
>> +   */
>> +  CXLoadDiag_CannotLoad = 2,
>> +  
>> +  /**
>> +   * \brief Indicates that the serialized diagnostics file is invalid or
>> +   *  corrupt.
>> +   */
>> +  CXLoadDiag_InvalidFile = 3
>> +};
> 
> CXLoadDiag_Error seems useful for other functions that load a file as well, like the one that reads an AST file, the one that reads file remappings, etc.
> Maybe change it to CXLoadFile_Error so it can be reused ?

I'm leery of having a "one error code to rule them all."  What you end up getting is a union of all error cases, which don't apply to everything.  That means that clients of a specific API need to handle all the cases (if they care about error handling) even when only a fraction of them make sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111110/84f2439b/attachment.html>


More information about the cfe-commits mailing list