Factor out clic specific code from libclang.py.