Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (19 sloc) 714 Bytes
#include <stdio.h>
#include <clang-c/Index.h>
int main(int argc, const char * argv[])
{
CXIndex index = clang_createIndex(0, 0);
CXTranslationUnit txUnit = clang_parseTranslationUnit(index, 0, argv, argc, 0, 0, CXTranslationUnit_None);
unsigned n = clang_getNumDiagnostics(txUnit);
/* printf("numDiags:%d\n", n); */
for(unsigned i = 0, n = clang_getNumDiagnostics(txUnit); i != n; ++i)
{
CXDiagnostic diag = clang_getDiagnostic(txUnit, i);
CXString str = clang_formatDiagnostic(diag, clang_defaultDiagnosticDisplayOptions());
printf("Diag:%s\n", clang_getCString(str));
clang_disposeString(str);
}
clang_disposeTranslationUnit(txUnit);
clang_disposeIndex(index);
return 0;
}