def parse_string(contents, name='tmp.cpp', **kwargs):
    """ Parse a string of C/C++ code
    """
    idx = clang.cindex.Index.create()
    tu = idx.parse(name, unsaved_files=[(name, contents)], **kwargs)
    return _ensure_parse_valid(tu)
Parse a string of C/C++ code