]> granicus.if.org Git - clang/commit
libclang: report error code for bad PCH files
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 12 Feb 2014 19:12:37 +0000 (19:12 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 12 Feb 2014 19:12:37 +0000 (19:12 +0000)
commitb670b9b849e8528e77dc65f67652c8513708f4f0
tree81059382c0faa4568f622e3477471aea5b38283a
parente4022bf2ed043db77289bdaf7285c98076e3aa12
libclang: report error code for bad PCH files

This commit improves libclang to report the error condition when
CXTranslationUnit can not be created because of a stale PCH file.  This allows
the caller, for example, to rebuild the PCH file and retry the request.

There two are APIs in libclang that return a CXTranslationUnit and don't
support reporting detailed errors (the only error condition is a NULL result).
For these APIs, a second, superior, version is introduced --
clang_createTranslationUnit2 and clang_parseTranslationUnit2.  These functions
return a CXTranslationUnit indirectly and also return an error code.  Old
functions are still supported and are nothing more than convenience wrappers
that ignore extended error codes.

As a cleanup, this commit also categorizes some libclang errors in the
functions I had to modify anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201249 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang-c/Index.h
include/clang/Basic/DiagnosticSerializationKinds.td
test/Index/pch-depending-on-deleted-module.c [new file with mode: 0644]
test/Modules/fatal-module-loader-error.m
tools/c-index-test/c-index-test.c
tools/libclang/CIndex.cpp
tools/libclang/CXTranslationUnit.h
tools/libclang/Indexing.cpp
tools/libclang/libclang.exports