[TypeSystem] Guard the global `ASTSourceMap` with a mutex

Authored by spyffe on Jul 25 2017, 10:33 AM.


[TypeSystem] Guard the global ASTSourceMap with a mutex

s_source_map in ClangExternalASTSourceCommon.cpp is unguarded
and therefore can break in multithreaded conditions. This can
cause crashes in particular if multiple targets are being set
up at once.

This patch wraps s_source_map in a function that ensures
exclusivity, and makes every user of it use that function

rdar://problem/33429774 lldb crashes after "resume_off"

Differential Revision: https://reviews.llvm.org/D35083

llvm-svn: 308993