Prepone callback initialization in cling.
Prepone callback initialization in cling.

We should setup our callbacks for ExternalASTSource/ExternalSemaSource
before we parse *any* code to prevent that any part of the code
stores a reference to a non-cling external sources. If this happens,
then the clang data structures such redecl chain could go out of
sync if they reference different sources and produce errors like failing
to merge declarations correctly or creating invalid redecl chains.

To fix this, we move this initalization before the initalization of
the incremental parser which is the first part that can generate
any AST nodes. We only do this for the modules case because in
the non-modules case the clang PCH overwrites our callback
in the ExternalASTSource and therefore would destroy our external
source.

karies/cling,karies/cling,karies/cling,karies/cling,karies/cling,karies/cling,root-mirror/cling,root-mirror/cling,root-mirror/cling,root-mirror/cling,root-mirror/cling,root-mirror/cling