[ASDL refactor] Move C++ code snippets into gen_cpp.py