This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 26th, 2012  |  syntax: C  |  size: 0.67 KB  |  views: 69  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include "Index.h"
  3.  
  4. int main (int argc, const char *argv[])
  5. {
  6.     CXIndex Index = clang_createIndex(0, 0);
  7.     CXTranslationUnit TU = clang_parseTranslationUnit(Index, 0, argv, argc, 0, 0, CXTranslationUnit_None);
  8.    
  9.     for (unsigned I = 0, N = clang_getNumDiagnostics(TU); I != N; ++I)
  10.     {
  11.         CXDiagnostic Diag = clang_getDiagnostic(TU, I);
  12.         CXString String = clang_formatDiagnostic(Diag, clang_defaultDiagnosticDisplayOptions());
  13.         fprintf(stderr, "%s\n", clang_getCString(String));
  14.  
  15.         clang_disposeString(String);
  16.     }
  17.    
  18.     clang_disposeTranslationUnit(TU);
  19.      clang_disposeIndex(Index);
  20.  
  21.      return 0;
  22. }
clone this paste RAW Paste Data