[cfe-dev] cindex example produces a warning

bruce.r.stephens at gmail.com bruce.r.stephens at gmail.com
Wed Feb 2 13:53:02 PST 2011

The following (taken from slides on libclang) produces a warning when
run on a file:
warning: ./syntax-checker: 'linker' input unused when '-fsyntax-only' is present

Is that expected?

#include "Index.h"

int main(int argc, const char *const argv[]) {
  CXIndex Index = clang_createIndex(0, 0);
  CXTranslationUnit TU = clang_parseTranslationUnit(Index, 0,
                              argv, argc, 0, 0, CXTranslationUnit_None);
  for (unsigned I = 0, N = clang_getNumDiagnostics(TU); I != N; ++I) {
    CXDiagnostic Diag = clang_getDiagnostic(TU, I);
    CXString String = clang_formatDiagnostic(Diag,
    fprintf(stderr, "%s\n", clang_getCString(String));
  return 0;

More information about the cfe-dev mailing list