using libclang to obtain a decorated AST

Hi,

I'm using libclang to parse C and C++ code and I have a few questions.

Our goal is to obtain a decorated AST (with positions for each element, like
where each method or function starts and ends and so on).

We use clang_parseTranslationUnit. In the API docu we see there is a
"-fsyntax-only" flag that is enabled by default. As far as I understand it
is able to skip the compilation process while still getting the structure.
The problem is that even with this flag it is still doing some sort of
unwanted processing.

/Example 1:/

#pragma clang __debug crash

It is crashing the program but I'd like to get the text of the pragma
instead of a crash. Is it possible?

/Example 2:/

#include <string.h>
#include "mylib.h"

void tsb_init(struct tsb *tsb)
{
  memset(tsb, 0, sizeof(tsb));
}

It is telling that it needs to know the size of the structure which is again
an unwanted behavior for my goals.

Help will be welcome,
Míryam