Libclang -ast-dump


I am trying to write a program that dumps the AST for a piece of code using Libclang. For this, I am passing “-Xclang” and “-ast-dump” as arguments to “clang_createTranslationUnitFromSourceFile”. But this does not work. Can anyone tell me what I am doing wrong? Here is my exact code snippet:

const char* args = {“-Xclang”, “-ast-dump”};
CXTranslationUnit tu = clang_createTranslationUnitFromSourceFile(CIdx, fileName, 2, args, 0, 0);