title: libclang parsing generates wrong output
body: <p>I am trying to build a small parsing program using libclang. </p>
  
  <p>The source file to parse (Node.h):</p>
  
  <pre><code>#pragma once
  
  struct Node {
      int value;
      struct Node *next;
  };
  </code></pre>
  
  <p>The main program simple invokes the clang parser and walks all elements in the AST:</p>
  
  <pre><code>int main(int argc, char *argv[]) {
      CXIndex index = clang_createIndex(0, 0);
  
      const char *filename = "Node.h";
  
      CXTranslationUnit TU = clang_parseTranslationUnit(index, filename, NULL, 0, NULL, 0, CXTranslationUnit_None);
  
      CXCursor rootCursor = clang_getTranslationUnitCursor(TU);
  
      clang_visitChildren(rootCursor, printVisitor, NULL);
  
      clang_disposeTranslationUnit(TU);
      clang_disposeIndex(index);
      return 0;
  }
  </code></pre>
  
  <p>The visitor:</p>
  
  <pre><code>CXChildVisitResult printVisitor(CXCursor cursor, CXCursor parent, CXClientData client_data) {
  
      CXSourceRange range = clang_getCursorExtent(cursor);
      CXSourceLocation startLocation = clang_getRangeStart(range);
      CXSourceLocation endLocation = clang_getRangeEnd(range);
  
      CXFile file;
      unsigned int line, column, offset;
      clang_getInstantiationLocation(startLocation, &amp;file, &amp;line, &amp;column, &amp;offset);
      printf("Start: Line: %u Column: %u Offset: %u\n", line, column, offset);
      clang_getInstantiationLocation(endLocation, &amp;file, &amp;line, &amp;column, &amp;offset);
      printf("End: Line: %u Column: %u Offset: %u\n", line, column, offset); 
  
      return CXChildVisit_Recurse;
  }
  </code></pre>
  
  <p>However, the output shows some weird parts:</p>
  
  <pre><code>Start: Line: 99 Column: 9 Offset: 3160 
  End: Line: 99 Column: 122 Offset: 3273 
  Kind: A field (in C) or non-static data member (in C++) in a struct.
  Filename: (null)
  </code></pre>
  
  <p>Where does this come from?</p>
  
  <p>When removing the pragma, nothing changes. The same happens with a completely empty header file to parse.</p>
  
  <p>Do I have to bypass all found node in the AST until I get a "first statement"- or "first expression"-node?</p>