clang api in qt5.2

I'm a novice developer, use clang api for astdump. I use
clang-check --version
LLVM (http://llvm.org/):
  LLVM version 3.4
  
  Optimized build.
  Built Jul 31 2013 (18:59:40).
  Default target: x86_64-pc-linux-gnu
  Host CPU: core-avx-i

but as I can not get through ast.
here is my code,

#include <QCoreApplication>
#include <vector>
#include <iostream>
#include <QDebug>
#include <clang/Basic/Diagnostic.h>
#include <clang/Basic/DiagnosticOptions.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/CompilerInvocation.h>
#include <clang/Frontend/Utils.h>
#include <clang/Frontend/ASTUnit.h>
#include <clang/Frontend/TextDiagnosticBuffer.h>
#include <clang/Frontend/VerifyDiagnosticConsumer.h>
#include <clang/Frontend/FrontendActions.h>

using namespace clang ;
using namespace llvm ;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    DiagnosticOptions* diagOpts = new DiagnosticOptions();
        CodeGenOptions* codeGenOpts = new CodeGenOptions();
        CompilerInstance compiler;
        compiler.createDiagnostics(
            diagOpts,
            false,
            false,
            codeGenOpts
        ); // to stdout
        assert(compiler.hasDiagnostics());
        const char *args[] =
        {
            "-cc1", // вызов LLVM Clang
            "a.cpp" // входной файл
        };

        clang::CompilerInvocation::CreateFromArgs(
        compiler.getInvocation(),
            args,
            args + 2,
            compiler.getDiagnostics());
            assert(0 == compiler.getDiagnostics().getErrorsAsFatal());
            FrontendAction *action = new ASTDumpAction;
            if(compiler.ExecuteAction(action)){
                std::cout << "ok:";
            }else{
                std::cout << "error:";
            }
        std::cout << "8" << std::endl;
            assert(0 == compiler.getDiagnostics().getNumWarnings());
            assert(actionSuccessful);
    return a.exec();
}

please do not abuse for the code and my English

I’d suggest to use libtooling (http://clang.llvm.org/docs/LibTooling.html) instead of setting up your own compiler instance.