I need a sample code to learn how to Generate C++ Code from clang::ASTContext.
I created ast from c++ code and I made some changes in AST and now I want to Generate Code again.
you cant use Stmt class's print method to generate code from a ast.
virtual bool VisitStmt(Stmt *st){
std::string SStr;
llvm::raw_string_ostream S(SStr);
st->printPretty(S, nullptr, PrintingPolicy(LangOptions()));
const std::string &Str = S.str();
llvm::errs() << "---------begin----------\n";
llvm::errs() << Str << "\n";
llvm::errs() << "---------end----------\n";
}