INNER CODE UNIT · Python

gen_cpp_file

stp/stp · lib/AST/genkinds.py:176

def gen_cpp_file(now, kindnames, cat_bits):
    """Generate the .cpp file."""
    try:
        cppfile = open("ASTKind.cpp", "w", encoding="utf-8",
                       errors="surrogateescape", newline="\n")
    except OSError as e:
        sys.exit("Cannot open .h file: %s\n" % e.strerror)

    with cppfile:
        cppfile.write(
            "// Generated automatically by genkinds.py from ASTKind.kinds%s.\n"
            "// Do not edit\n"
            "namespace stp {\n"
            "#if defined(__GNUC__) || defined(__clang__)\n\n"
            "__attribute__((visibility(\"default\")))\n\n"
            "#endif\n\n"
            "const char * _kind_names[] =  {\n" % now
        )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…