]> granicus.if.org Git - clang/commit
Implement a diagnostics callback for the C interface to Clang, so that
authorDouglas Gregor <dgregor@apple.com>
Thu, 28 Jan 2010 00:27:43 +0000 (00:27 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 28 Jan 2010 00:27:43 +0000 (00:27 +0000)
commit5352ac06d8f6194825bb2a99ffa009b61bafb503
treee50e65bcdcd96fb196e24794c7086caa9b489bfd
parentf291976ecf537dc4f2d5537b1664d47ff4b94865
Implement a diagnostics callback for the C interface to Clang, so that
clients can format diagnostics as they wish rather than having to
parse standard error. All of the important parts of the front end's
diagnostics are exposed: text, severity, location, source ranges, and
fix-its. The diagnostics callback is now available with
clang_createTranslationUnitFromSource() and
clang_createTranslationUnit().

As part of this change, CXSourceLocation and CXSourceRange got one
pointer larger, since we need to hold on to the SourceManager and
LangOptions structures in the source location. This is the minimum
amount of information needed for the functions that operate on source
locations and ranges (as implemented now). Previously we held on to
the ASTContext, but the diagnostics callback can end up with source
locations when there is no ASTContext (or preprocessor).

Still to do:
  - Code completion needs to support the diagnostics callback, once we
  have the ability to (de-)serialize diagnostics.
  - Eliminate the "displayDiagnostics" argument to createIndex; we'll
  always pass diagnostics to the callback and let it deal with display.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94709 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang-c/Index.h
tools/CIndex/CIndex.cpp
tools/CIndex/CIndex.exports
tools/CIndex/CIndexDiagnostic.cpp [new file with mode: 0644]
tools/CIndex/CIndexDiagnostic.h [new file with mode: 0644]
tools/CIndex/CIndexer.h
tools/CIndex/CMakeLists.txt
tools/CIndex/CXSourceLocation.h
tools/c-index-test/c-index-test.c